EasyManua.ls Logo

Waveshare NRF52840 - Chapter 5. UART; Codes

Waveshare NRF52840
72 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
NRF52840 Eval Kit User Manual
Vision: V1.0.1 Date: 2019.01.19 23 / 72
CHAPTER 5. UART
In this chapter, we describe about how to use UART interface of NRF52840. The
example used herein is 003_UART. With the example, data can be sent from NRF52840
to UART interface, and LED on eval board will turn on/off when receive corresponding
data from UART interface.
CODES
uart.h
#ifndef _UART_H_
#define _UART_H_
#include "nrf.h"
#include "nrf_gpio.h"
#include "app_uart.h"
#include "nrf_uart.h"
#define RX_PIN_NUMBER NRF_GPIO_PIN_MAP(0,8)
#define TX_PIN_NUMBER NRF_GPIO_PIN_MAP(0,6)
#define CTS_PIN_NUMBER NRF_GPIO_PIN_MAP(0,7)
#define RTS_PIN_NUMBER NRF_GPIO_PIN_MAP(0,5)
#define UART_HWFC APP_UART_FLOW_CONTROL_DISABLED
#define MAX_TEST_DATA_BYTES (15U)
#define UART_TX_BUF_SIZE 256
#define UART_RX_BUF_SIZE 256
extern app_uart_comm_params_t comm_params;
void uart_error_handle(app_uart_evt_t * p_event);
#endif
uart.c:
#include "uart.h"