nRF51 SDK: Simple UART driver

| nRF51 SDK

- Home
- Related Pages
- API Reference
- Data Structures

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions
Simple UART driver
Peripheral Drivers

Simple UART driver. More...

## Functions

uint8_t | simple_uart_get (void)
| Function for reading a character from UART. Execution is blocked until UART peripheral detects character has been received. More...
bool | simple_uart_get_with_timeout (int32_t timeout_ms, uint8_t *rx_data)

Function for reading a character from UART with timeout on how long to wait for the byte to be received. Execution is blocked until UART peripheral detects character has been received or until the timeout expires, which even occurs first. More...

void | simple_uart_put (uint8_t cr)
| Function for sending a character to UART. Execution is blocked until UART peripheral reports character to have been send. More...
void | simple_uart_putstring (const uint8_t *str)
| Function for sending a string to UART. Execution is blocked until UART peripheral reports all characters to have been send. Maximum string length is 254 characters including null character in the end. More...
void | simple_uart_config (uint8_t rts_pin_number, uint8_t txd_pin_number, uint8_t cts_pin_number, uint8_t rxd_pin_number, bool hwfc)
| Function for configuring UART to use 38400 baud rate. More...

## Detailed Description

Simple UART driver.

## Function Documentation

void simple_uart_config | ( | uint8_t | rts_pin_number,
|  | uint8_t | txd_pin_number,
|  | uint8_t | cts_pin_number,
|  | uint8_t | rxd_pin_number,
|  | bool | hwfc
| ) |  |

Function for configuring UART to use 38400 baud rate.

Parameters

  rts_pin_number | Chip pin number to be used for UART RTS
  txd_pin_number | Chip pin number to be used for UART TXD
  cts_pin_number | Chip pin number to be used for UART CTS
  rxd_pin_number | Chip pin number to be used for UART RXD
  hwfc | Enable hardware flow control

uint8_t simple_uart_get | ( | void |  | ) |

Function for reading a character from UART. Execution is blocked until UART peripheral detects character has been received.

Returns
  cr Received character.

bool simple_uart_get_with_timeout | ( | int32_t | timeout_ms,
|  | uint8_t * | rx_data
| ) |  |

Function for reading a character from UART with timeout on how long to wait for the byte to be received. Execution is blocked until UART peripheral detects character has been received or until the timeout expires, which even occurs first.

Returns
  bool True, if byte is received before timeout, else returns False.

Parameters

  timeout_ms | maximum time to wait for the data.
  rx_data | pointer to the memory where the received data is stored.

void simple_uart_put | ( | uint8_t | cr | ) |

Function for sending a character to UART. Execution is blocked until UART peripheral reports character to have been send.

Parameters

  cr | Character to send.

void simple_uart_putstring | ( | const uint8_t * | str | ) |

Function for sending a string to UART. Execution is blocked until UART peripheral reports all characters to have been send. Maximum string length is 254 characters including null character in the end.

Parameters

  str | Null terminated string to send.