SmartSnippets DA1459x SDK
Files | Macros | Functions
Console

Files

file  console.h
 Definition of the API for the Console utilities service.
 

Macros

#define CONSOLE_TASK_PRIORITY   (OS_TASK_PRIORITY_NORMAL)
 Console task priority.
 

Functions

void console_init (const ad_uart_controller_conf_t *ad_uart_ctrl_conf)
 Initialize console to use with specified serial device. More...
 
int console_write (const char *buf, int len)
 Write to serial console. More...
 
int console_read (char *buf, int len)
 Read from serial console. More...
 
void console_wkup_handler (void)
 Wake up handler for serial console. More...
 

Detailed Description

Function Documentation

◆ console_init()

void console_init ( const ad_uart_controller_conf_t ad_uart_ctrl_conf)

Initialize console to use with specified serial device.

This function will allocate all necessary resources for serial console (RAM, task, synchronization primitives).

Parameters
[in]ad_uart_ctrl_confcontroller configuration

◆ console_read()

int console_read ( char *  buf,
int  len 
)

Read from serial console.

Call this function to read data from serial console.

Parameters
[out]bufpointer to buffer to fill with data from serial console
[in]lennumber of bytes to read

◆ console_wkup_handler()

void console_wkup_handler ( void  )

Wake up handler for serial console.

It shall be called when the UART CTS GPIO pin is asserted to signal this event for the console task. Imperative setup actions in order to use it:

  • Assure that the HW UART CTS line/pin of the USB/UART IC converter (e.g. FT2232HT in DA1469x ProDK) is properly connected to the relevant M33 GPIO pin.
  • As part of the application's HW initialization code, configure waking-up the system when the UART CTS GPIO pin is low and register a related callback that will be triggered in such a case.
  • The callback must check the status of the pin and if asserted it shall invoke the console_wkup_handler() and then clear again the pin before exiting.

Note: The UART CTS line/pin is of reverse logic, i.e. it is asserted when low (logic 0).

◆ console_write()

int console_write ( const char *  buf,
int  len 
)

Write to serial console.

This function can be called from normal task as well as interrupts. When called from interrupts this function will not block. If buffer can't hold all requested data some data will be dropped and will never leave UART. When called from a task, this function can block if there is no space in buffer to hold data.

Parameters
[in]bufpointer to data to send to serial console
[in]lennumber of bytes to print
Returns
number of bytes written