Adafruit Library
Public Member Functions | List of all members
ws_uart Class Reference

Class that provides an interface between WipperSnapper's app and the device's UART bus. More...

#include <ws_uart.h>

Public Member Functions

 ~ws_uart (void)
 UART class destructor.
 
void initUARTBus (wippersnapper_uart_v1_UARTDeviceAttachRequest *msgUARTRequest)
 Initializes the UART bus, called once. More...
 
bool initUARTDevice (wippersnapper_uart_v1_UARTDeviceAttachRequest *msgUARTRequest)
 Initializes a UART driver. More...
 
bool isUARTBusInitialized ()
 Returns true if the UART bus is initialized. More...
 
void detachUARTDevice (wippersnapper_uart_v1_UARTDeviceDetachRequest *msgUARTDetachReq)
 Detaches a UART device from the UART bus. More...
 
void deinitUARTDevice (const char *device_id)
 Deinitializes a device from the UART bus and frees its memory. More...
 
void update ()
 Polls the UART driver for new data and sends it to IO. More...
 
bool initUARTDevicePM25AQI (HardwareSerial *hwSerial, int32_t pollingInterval, const char *device_id)
 Initializes the pms5003 device driver using HardwareSerial. More...
 

Detailed Description

Class that provides an interface between WipperSnapper's app and the device's UART bus.

Member Function Documentation

◆ initUARTBus()

void ws_uart::initUARTBus ( wippersnapper_uart_v1_UARTDeviceAttachRequest *  msgUARTRequest)

Initializes the UART bus, called once.

Initializes a UART bus.

Parameters
msgUARTRequestPointer to a UARTDeviceAttachRequest message.

◆ initUARTDevice()

bool ws_uart::initUARTDevice ( wippersnapper_uart_v1_UARTDeviceAttachRequest *  msgUARTRequest)

Initializes a UART driver.

Initializes a device on the UART bus.

Parameters
msgUARTRequestPointer to a UARTDeviceAttachRequest message.
Returns
True if UART driver was successfully initialized.

◆ isUARTBusInitialized()

bool ws_uart::isUARTBusInitialized ( )

Returns true if the UART bus is initialized.

Checks if the UART bus has been initialized.

Returns
True if the UART bus is initialized, False otherwise.

◆ detachUARTDevice()

void ws_uart::detachUARTDevice ( wippersnapper_uart_v1_UARTDeviceDetachRequest *  msgUARTDetachReq)

Detaches a UART device from the UART bus.

Detaches a UART device from the bus and frees its memory.

Parameters
msgUARTDetachReqPointer to a UARTDeviceDetachRequest message.

◆ deinitUARTDevice()

void ws_uart::deinitUARTDevice ( const char *  device_id)

Deinitializes a device from the UART bus and frees its memory.

Parameters
device_idDevice identifier of the UART device to deinitialize.

◆ update()

void ws_uart::update ( )

Polls the UART driver for new data and sends it to IO.

Updates the UART device at every polling interval, must be called by main app.

◆ initUARTDevicePM25AQI()

bool ws_uart::initUARTDevicePM25AQI ( HardwareSerial *  hwSerial,
int32_t  pollingInterval,
const char *  device_id 
)

Initializes the pms5003 device driver using HardwareSerial.

Parameters
hwSerialPointer to a HardwareSerial instance.
pollingIntervalPolling interval for the pms5003 device.
device_idWhich PM25 device are we communicating with?
Returns
True if pms5003 driver was successfully initialized, False otherwise.

The documentation for this class was generated from the following files: