Defines | Functions | Variables

hal/nrf24le1/hal_uart.c File Reference

Implementation of hal_uart. More...

#include "nrf24le1.h"
#include <stdint.h>
#include <stdbool.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.
_Bool hal_uart_tx_complete ()
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 hal_uart.

Definition in file hal_uart.c.


Define Documentation

#define UART_NBUF   8

Definition at line 27 of file hal_uart.c.

#define BAUD_57K6   1015

Definition at line 30 of file hal_uart.c.

#define BAUD_38K4   1011

Definition at line 31 of file hal_uart.c.

#define BAUD_19K2   998

Definition at line 32 of file hal_uart.c.

#define BAUD_9K6   972

Definition at line 33 of file hal_uart.c.


Function Documentation

UART0_ISR (  )

Definition at line 41 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 35 of file hal_uart.c.

uint8_t uart_tx_cnt

Definition at line 35 of file hal_uart.c.

uint8_t uart_rx_rp

Definition at line 38 of file hal_uart.c.

uint8_t uart_rx_cnt

Definition at line 38 of file hal_uart.c.