blfwk::BusPalUartPeripheral Class Reference

Peripheral that talks to the target device over BusPal UART hardware. More...

`#include <BusPalPeripheral.h>`

Inheritance diagram for blfwk::BusPalUartPeripheral:
[legend]
Collaboration diagram for blfwk::BusPalUartPeripheral:
[legend]

## Public Member Functions

| BusPalUartPeripheral (const char *port, long speed, const BusPal::BusPalConfigData &config)
| Parameterized constructor that opens the serial port. More...
virtual | ~BusPalUartPeripheral ()
| Destructor.
void | configure (const BusPal::BusPalConfigData &config)
| configure the bus pal with the passed in options
virtual status_t | read (uint8_t *buffer, uint32_t requestedBytes, uint32_t *actualBytes, uint32_t timeoutMs)
| Read bytes. More...
virtual status_t | write (const uint8_t *buffer, uint32_t byteCount)
| Write bytes. More...
Public Member Functions inherited from blfwk::UartPeripheral
| UartPeripheral (const char *port, long speed=kUartPeripheral_DefaultBaudRate)
| Parameterized constructor that opens the serial port. More...
virtual | ~UartPeripheral ()
| Destructor.
void | flushRX ()
| Flush. More...

## Protected Attributes

BusPal * | m_busPal
| Represents Bus Pal hardware.
Protected Attributes inherited from blfwk::UartPeripheral
int | m_fileDescriptor
| Port file descriptor.
uint8_t | m_buffer [kDefaultMaxPacketSize]
| Buffer for bytes used to build read packet.

## Additional Inherited Members

Public Types inherited from blfwk::UartPeripheral
enum | _uart_peripheral_constants { kUartPeripheral_UnusedTimeout = 0, kUartPeripheral_DefaultReadTimeoutMs = 1000, kUartPeripheral_DefaultBaudRate = 9600 }
| Constants.
Public Types inherited from blfwk::Peripheral
enum | _host_peripheral_types { kHostPeripheralType_None, kHostPeripheralType_UART, kHostPeripheralType_BUSPAL_UART, kHostPeripheralType_USB_HID, kHostPeripheralType_SIM }
Protected Member Functions inherited from blfwk::UartPeripheral
bool | init (const char *port, long speed)
| Initialize. More...

## Detailed Description

Peripheral that talks to the target device over BusPal UART hardware.

## Constructor & Destructor Documentation

BusPalUartPeripheral::BusPalUartPeripheral | ( | const char * | port,
|  | long | speed,
|  | const BusPal::BusPalConfigData & | config
| ) |  |

Parameterized constructor that opens the serial port.

Opens and configures the port. Throws exception if port configuration fails.

Note: following COM port configuration is assumed: 8 bits, 1 stop bit, no parity.

Parameters

  port | OS file path for COM port. For example "COM1" on Windows.
  speed | Port speed, e.g. 9600.

## Member Function Documentation

status_t BusPalUartPeripheral::read | ( | uint8_t * | buffer,
|  | uint32_t | requestedBytes,
|  | uint32_t * | actualBytes,
|  | uint32_t | timeoutMs
| ) |  |

virtual

Read bytes.

Parameters

  buffer | Pointer to buffer
  requestedBytes | Number of bytes to read

Reimplemented from blfwk::UartPeripheral.

status_t BusPalUartPeripheral::write | ( | const uint8_t * | buffer,
|  | uint32_t | byteCount
| ) |  |

virtual

Write bytes.

Parameters

  buffer | Pointer to buffer to write
  byteCount | Number of bytes to write

Reimplemented from blfwk::UartPeripheral.

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

- BusPalPeripheral.h
- BusPalPeripheral.cpp