Defines | Functions | Variables

hal/nrf24lu1p/hal_uart.c File Reference

Implementation of the UART HAL module for nRF24LU1+ with data buffering. More...

#include "nrf24lu1p.h"
#include <stdint.h>
#include "hal_uart.h"

Go to the source code of this file.

Defines

#define UART_NBUF   8
#define BAUD_57K6   1015
#define BAUD_38K4   1011
#define BAUD_19K2   998
#define BAUD_9K6   972

Functions

 UART0_ISR ()
void hal_uart_init (hal_uart_baudrate_t baud)
void hal_uart_putchar (uint8_t ch)
uint8_t hal_uart_chars_available (void)
 Find number of characters in the UART receive buffer.
uint8_t hal_uart_getchar (void)

Variables

static uint8_t uart_tx_rp
static uint8_t uart_tx_cnt
static uint8_t uart_rx_rp
static uint8_t uart_rx_cnt

Detailed Description

Implementation of the UART HAL module for nRF24LU1+ with data buffering.

Definition in file hal_uart.c.


Define Documentation

#define UART_NBUF   8

Definition at line 23 of file hal_uart.c.

#define BAUD_57K6   1015

Definition at line 26 of file hal_uart.c.

#define BAUD_38K4   1011

Definition at line 27 of file hal_uart.c.

#define BAUD_19K2   998

Definition at line 28 of file hal_uart.c.

#define BAUD_9K6   972

Definition at line 29 of file hal_uart.c.


Function Documentation

UART0_ISR (  )

Definition at line 37 of file hal_uart.c.

{
  if (RI0 == 1)
  {
    RI0 = 0;
    if (uart_rx_cnt < UART_NBUF)
    {
      uart_rx[uart_rx_wp] = S0BUF;
      uart_rx_wp = (uart_rx_wp + 1) % UART_NBUF;
      uart_rx_cnt++;
    }
  }
  if (TI0 == 1)
  {
    TI0 = 0;
    if (uart_tx_cnt > 1)
    {
      S0BUF = uart_tx[uart_tx_rp];
      uart_tx_rp = (uart_tx_rp + 1) % UART_NBUF;
    }
    uart_tx_cnt--;
  }
}

Variable Documentation

uint8_t uart_tx_rp

Definition at line 31 of file hal_uart.c.

uint8_t uart_tx_cnt

Definition at line 31 of file hal_uart.c.

uint8_t uart_rx_rp

Definition at line 34 of file hal_uart.c.

uint8_t uart_rx_cnt

Definition at line 34 of file hal_uart.c.