Defines | Typedefs | Enumerations | Functions | Variables

# wuart.c File Reference

Implementation of the Wireless UART Application. More...

Go to the source code of this file.

## Defines
#define | CRC_SIZE (sizeof(crc_t))
#define | ESC_NONE (0)
#define | ESC_PATTERN (2)
#define | ESC_TMO_1 (1)
#define | ESC_TMO_2 (3)
#define | NL "\n\r"
#define | PAYLD_END (UART_FRAME_SIZE - CRC_SIZE)
#define | PAYLD_SIZE (PROT_WUART_PAYLD_SIZE)
#define | PAYLD_START (PROT_WUART_HEADER_SIZE)
#define | UART_FRAME_SIZE
## Typedefs
typedef uint16_t | crc_t
## Enumerations
enum | wuart_state_t { CMD_MODE, DATA_MODE }
## Functions
int | main (void)
| Main function of WUART application.
wuart_state_t | wuart_check_escape (uint8_t *cmd, uint8_t size)
void | wuart_init ()
| Initialize MCU ressources.
wuart_state_t | wuart_parse_at_command (char *cmd)
uint8_t * | wuart_usr_radio_receive_frame ()
uint8_t * | wuart_usr_radio_tx_done ()
## Variables
volatile bool | chkrxbuf
bool | echo = false
wuart_buffer_t | rxbuf [2]
volatile uint8_t | rxbuf_idx = 0
timer_hdl_t | tmr_uart
volatile bool | txpending
volatile wuart_state_t | wuart_state

## Detailed Description

Implementation of the Wireless UART Application.

This Application implements a wireless UART bridge.

Definition in file wuart.c.

## Define Documentation

#define CRC_SIZE (sizeof(crc_t))

Number of bytes for CRC16

Definition at line 51 of file wuart.c.

#define ESC_NONE (0)

escape state : none / normal data mode

Definition at line 63 of file wuart.c.

#define ESC_PATTERN (2)

escape state : the +++ pattern was detected

Definition at line 69 of file wuart.c.

#define ESC_TMO_1 (1)

escape state : the first timeout had occured

Definition at line 66 of file wuart.c.

#define ESC_TMO_2 (3)

escape state : the second timeout had occured

Definition at line 72 of file wuart.c.

#define NL "\n\r"

END of line delimitter

Definition at line 60 of file wuart.c.

#define PAYLD_END (UART_FRAME_SIZE - CRC_SIZE)

Index of last payload byte

Definition at line 58 of file wuart.c.

#define PAYLD_SIZE (PROT_WUART_PAYLD_SIZE)

Max. number of payload bytes per frame

Definition at line 49 of file wuart.c.

#define PAYLD_START (PROT_WUART_HEADER_SIZE)

Index of first payload byte

Definition at line 56 of file wuart.c.

#define UART_FRAME_SIZE

Value:

    (PROT_WUART_HEADER_SIZE +\
                               PAYLD_SIZE + CRC_SIZE )

Maximum frame size

Definition at line 53 of file wuart.c.

## Typedef Documentation

typedef uint16_t crc_t

Data type for CRC16 values

Definition at line 78 of file wuart.c.

## Enumeration Type Documentation

enum wuart_state_t

application states

Enumerator:

  CMD_MODE | application is in command mode
  DATA_MODE | application is in data mode

Definition at line 90 of file wuart.c.

## Function Documentation

int main | ( | void |  | ) |

Main function of WUART application.

Definition at line 165 of file wuart.c.

wuart_state_t wuart_check_escape | ( | uint8_t * | cmd,
|  | uint8_t | size |
| ) |  |  |

check for the sequence for escape from the data mode

       [ no data on HIF ]+++[ no data on HIF ]
             |            |       |
             |            |       `- ESC_TMO_2
             |            `- ESC_PATTERN
             `- ESC_TMO_1

Definition at line 394 of file wuart.c.

void wuart_init | ( |  | ) |

Initialize MCU ressources.

Definition at line 119 of file wuart.c.

wuart_state_t wuart_parse_at_command | ( | char * | cmd | ) |

Process AT command

Definition at line 460 of file wuart.c.

uint8_t* wuart_usr_radio_receive_frame | ( |  | ) |

Implementation of callback function usr_radio_receive_frame.

Definition at line 340 of file wuart.c.

uint8_t* wuart_usr_radio_tx_done | ( |  | ) |

Implementation of callback function usr_radio_tx_done.

Definition at line 323 of file wuart.c.