Defines | Typedefs | Enumerations | Functions | Variables

# wuart.c File Reference

Implementation of the Wireless UART Application. More...

## Defines
#define | CRC_SIZE (sizeof(crc_t))
#define | DEFAULT_RADIO_CHANNEL (17)
#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
node_config_t PROGMEM | nc_flash
node_config_t | NodeConfig
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.

## Define Documentation

#define CRC_SIZE (sizeof(crc_t))

Number of bytes for CRC16

#define DEFAULT_RADIO_CHANNEL (17)

radio channel

#define ESC_NONE (0)

escape state : none / normal data mode

#define ESC_PATTERN (2)

escape state : the +++ pattern was detected

#define ESC_TMO_1 (1)

escape state : the first timeout had occured

#define ESC_TMO_2 (3)

escape state : the second timeout had occured

#define NL "\n\r"

END of line delimitter

#define PAYLD_END (UART_FRAME_SIZE - CRC_SIZE)

Index of last payload byte

#define PAYLD_SIZE (PROT_WUART_PAYLD_SIZE)

Max. number of payload bytes per frame

#define PAYLD_START (PROT_WUART_HEADER_SIZE)

Index of first payload byte

#define UART_FRAME_SIZE

Value:

    (PROT_WUART_HEADER_SIZE +\
                               PAYLD_SIZE + CRC_SIZE )

Maximum frame size

## Typedef Documentation

typedef uint16_t crc_t

Data type for CRC16 values

## Enumeration Type Documentation

enum wuart_state_t

application states

Enumerator:

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

## Function Documentation

int main | ( | void |  | ) |

Main function of WUART application.

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

void wuart_init | ( |  | ) |

Initialize MCU ressources.

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

Process AT command

uint8_t* wuart_usr_radio_receive_frame | ( |  | ) |

Implementation of callback function usr_radio_receive_frame.

uint8_t* wuart_usr_radio_tx_done | ( |  | ) |

Implementation of callback function usr_radio_tx_done.

## Variable Documentation

node_config_t PROGMEM nc_flash

Initial value:

     { .short_addr = 0xBEEF,
                                       .pan_id = 0x2222,
                                       .channel = DEFAULT_RADIO_CHANNEL,
                                     }