Demo UART Blaster

Custom commands and variables to blast test data from the UART.

API Features Demonstrated

Platforms

This app works on:

Requirements and Prerequisites

Requires a Gecko OS evaluation board, such as a WGM160P_eval.

Other Gecko OS hardware can also be used by changing the source of the logged data to suit your device.

Description

This app demonstrates setting up custom commands and variables.

It also demonstrates issuing events from the command context and the IRQ context, in order to perform more complex processing tasks in the event loop ZAP context.

Note that custom commands are also accessible from the REST API and remote terminal, as well as from the standard UART console, or Gecko OS terminal.

In commands.c, note that the uart_blaster_settings structure is defined as a static struct.

In commands.c, the custom command macros define custom blaster variables.

The setter and getter functions execute in the command context.

The GOS_DEFINE_COMMAND(uart_blast) definition specifies that issuing the blaster command results in the toggle_uart_blasting function (defined in main.c) executing in the command context. This issues the uart_blast_event which is handled by the uart_blast_event_handler in the event loop, or ZAP context.

Note also that the IRQ callback uart_rx_irq_callback (defined in main.c) is executed in the IRQ context. It issues an event, uart_rx_event_handler, to be executed in the event loop, or App Thread context, in order to minimize processing in the IRQ context. See Execution Context, Hardware IRQ.

Source

See: