cpu/nrf5x_common: UART: capture whole nrf52 lineup
This commit is contained in:
parent
1713dca711
commit
ca2b7e1952
@ -179,7 +179,7 @@ typedef struct {
|
|||||||
gpio_t pin[PWM_CHANNELS]; /**< PWM out pins */
|
gpio_t pin[PWM_CHANNELS]; /**< PWM out pins */
|
||||||
} pwm_conf_t;
|
} pwm_conf_t;
|
||||||
|
|
||||||
#if defined(CPU_MODEL_NRF52811XXAA) || defined(CPU_MODEL_NRF52840XXAA)
|
#if !defined(CPU_MODEL_NRF52832XXAA)
|
||||||
/**
|
/**
|
||||||
* @brief Structure for UART configuration data
|
* @brief Structure for UART configuration data
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
#include "periph/uart.h"
|
#include "periph/uart.h"
|
||||||
#include "periph/gpio.h"
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
#if defined(CPU_MODEL_NRF52811XXAA) || defined(CPU_MODEL_NRF52840XXAA)
|
#if !defined(CPU_MODEL_NRF52832XXAA) && !defined(CPU_FAM_NRF51)
|
||||||
#define UART_INVALID (uart >= UART_NUMOF)
|
#define UART_INVALID (uart >= UART_NUMOF)
|
||||||
#define REG_BAUDRATE dev(uart)->BAUDRATE
|
#define REG_BAUDRATE dev(uart)->BAUDRATE
|
||||||
#define REG_CONFIG dev(uart)->CONFIG
|
#define REG_CONFIG dev(uart)->CONFIG
|
||||||
@ -114,7 +114,7 @@ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg)
|
|||||||
gpio_init(UART_PIN_TX, GPIO_OUT);
|
gpio_init(UART_PIN_TX, GPIO_OUT);
|
||||||
PSEL_TXD = UART_PIN_TX;
|
PSEL_TXD = UART_PIN_TX;
|
||||||
|
|
||||||
#if defined(CPU_MODEL_NRF52811XXAA) || defined(CPU_MODEL_NRF52840XXAA)
|
#if !defined(CPU_MODEL_NRF52832XXAA) && !defined(CPU_FAM_NRF51)
|
||||||
/* enable HW-flow control if defined */
|
/* enable HW-flow control if defined */
|
||||||
#ifdef MODULE_PERIPH_UART_HW_FC
|
#ifdef MODULE_PERIPH_UART_HW_FC
|
||||||
/* set pin mode for RTS and CTS pins */
|
/* set pin mode for RTS and CTS pins */
|
||||||
@ -199,7 +199,7 @@ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* enable the UART device */
|
/* enable the UART device */
|
||||||
#if defined(CPU_MODEL_NRF52811XXAA) || defined(CPU_MODEL_NRF52840XXAA)
|
#if !defined(CPU_MODEL_NRF52832XXAA) && !defined(CPU_FAM_NRF51)
|
||||||
dev(uart)->ENABLE = UARTE_ENABLE_ENABLE_Enabled;
|
dev(uart)->ENABLE = UARTE_ENABLE_ENABLE_Enabled;
|
||||||
#else
|
#else
|
||||||
NRF_UART0->ENABLE = UART_ENABLE_ENABLE_Enabled;
|
NRF_UART0->ENABLE = UART_ENABLE_ENABLE_Enabled;
|
||||||
@ -207,7 +207,7 @@ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (rx_cb) {
|
if (rx_cb) {
|
||||||
#if defined(CPU_MODEL_NRF52811XXAA) || defined(CPU_MODEL_NRF52840XXAA)
|
#if !defined(CPU_MODEL_NRF52832XXAA) && !defined(CPU_FAM_NRF51)
|
||||||
dev(uart)->RXD.MAXCNT = 1;
|
dev(uart)->RXD.MAXCNT = 1;
|
||||||
dev(uart)->RXD.PTR = (uint32_t)&rx_buf[uart];
|
dev(uart)->RXD.PTR = (uint32_t)&rx_buf[uart];
|
||||||
dev(uart)->INTENSET = UARTE_INTENSET_ENDRX_Msk;
|
dev(uart)->INTENSET = UARTE_INTENSET_ENDRX_Msk;
|
||||||
@ -226,7 +226,7 @@ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* nrf52840 || nrf52811 (using EasyDMA) */
|
/* nrf52840 || nrf52811 (using EasyDMA) */
|
||||||
#if defined(CPU_MODEL_NRF52811XXAA) || defined(CPU_MODEL_NRF52840XXAA)
|
#if !defined(CPU_MODEL_NRF52832XXAA) && !defined(CPU_FAM_NRF51)
|
||||||
static void _write_buf(uart_t uart, const uint8_t *data, size_t len)
|
static void _write_buf(uart_t uart, const uint8_t *data, size_t len)
|
||||||
{
|
{
|
||||||
/* reset endtx flag */
|
/* reset endtx flag */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user