Marco Hsu / WIFI_API_32kRAM
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers simple_uart.h Source File

simple_uart.h

00001  /* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved.
00002  *
00003  * The information contained herein is property of Nordic Semiconductor ASA.
00004  * Terms and conditions of usage are described in detail in NORDIC
00005  * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
00006  *
00007  * Licensees are granted free, non-transferable use of the information. NO
00008  * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
00009  * the file.
00010  *
00011  */
00012 
00013 #ifndef SIMPLE_UART_H
00014 #define SIMPLE_UART_H
00015 
00016 /*lint ++flb "Enter library region" */
00017 
00018 #include <stdbool.h>
00019 #include <stdint.h>
00020 
00021 /* @file
00022 * @brief Simple UART driver
00023 *
00024 *
00025 * @defgroup nrf_drivers_simple_uart Simple UART driver
00026 * @{
00027 * @ingroup nrf_drivers
00028 * @brief Simple UART driver
00029 */
00030 
00031 /** Reads a character from UART.
00032 Execution is blocked until UART peripheral detects character has been received.
00033 \return cr Received character.
00034 */
00035 uint8_t simple_uart_get(void);
00036 
00037 /** Reads a character from UART with timeout on how long to wait for the byte to be received
00038 Execution is blocked until UART peripheral detects character has been received or until the timeout expires, which even occurs first
00039 \return bool True, if byte is received before timeout, else returns False.
00040 @param timeout_ms maximum time to wait for the data.
00041 @param rx_data pointer to the memory where the received data is stored.
00042 */
00043 bool simple_uart_get_with_timeout(int32_t timeout_ms, uint8_t *rx_data);
00044 
00045 /** Sends a character to UART.
00046 Execution is blocked until UART peripheral reports character to have been send.
00047 @param cr Character to send.
00048 */
00049 void simple_uart_put(uint8_t cr);
00050 
00051 /** Sends a string to UART.
00052 Execution is blocked until UART peripheral reports all characters to have been send.
00053 Maximum string length is 254 characters including null character in the end.
00054 @param str Null terminated string to send.
00055 */
00056 void simple_uart_putstring(const uint8_t *str);
00057 
00058 /** Configures UART to use 38400 baud rate.
00059 @param rts_pin_number Chip pin number to be used for UART RTS
00060 @param txd_pin_number Chip pin number to be used for UART TXD
00061 @param cts_pin_number Chip pin number to be used for UART CTS
00062 @param rxd_pin_number Chip pin number to be used for UART RXD
00063 @param hwfc Enable hardware flow control
00064 */
00065 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);
00066 
00067 /**
00068  *@}
00069  **/
00070 
00071 /*lint --flb "Leave library region" */
00072 #endif