Ares LoRa Firmware
Loading...
Searching...
No Matches
ares_serial_transport_api Struct Reference

Unified serial transport interface. More...

#include <serial.h>

Data Fields

int(* init )(const struct ares_serial_transport *transport, const void *config, serial_transport_handler_t evt_handler, void *context)
 Function for initializing the serial transport interface.
int(* uninit )(const struct ares_serial_transport *transport)
 Function for uninitializing the serial transport interface.
int(* enable )(const struct ares_serial_transport *transport, bool blocking_tx)
 Function for enabling transport in given TX mode.
int(* write )(const struct ares_serial_transport *transport, const void *data, size_t length, size_t *cnt)
 Function for writing data to the transfer interface.
int(* read )(const struct ares_serial_transport *transport, void *data, size_t length, size_t *cnt)
 Function for reading data from the transfer interface.
void(* wait_dtr )(const struct ares_serial_transport *transport)
 Function that blocks execution of the thread until the DTR control line is asserted.
bool(* rx_error )(const struct ares_serial_transport *transport)
 Function that checks if there is a reception error.
void(* block_no_usb_host )(const struct ares_serial_transport *transport, bool block)
 Function that configures the transport to operate in blocking/non-blocking mode while waiting for a host connection.

Detailed Description

Unified serial transport interface.

Field Documentation

◆ block_no_usb_host

void(* ares_serial_transport_api::block_no_usb_host) (const struct ares_serial_transport *transport, bool block)

Function that configures the transport to operate in blocking/non-blocking mode while waiting for a host connection.

Parameters
[in]transportPointer ot the transfer instance.
[in]blockIf true, transport will block until a host connection is established.

◆ enable

int(* ares_serial_transport_api::enable) (const struct ares_serial_transport *transport, bool blocking_tx)

Function for enabling transport in given TX mode.

Function can be used to reconfigure TX to work in blocking mode.

Parameters
[in]transportPointer ot the transfer instance.
[in]blocking_txIf true, the transport TX is enabled in blocking mode.
Returns
0 on success.
negative error code otherwise.

◆ init

int(* ares_serial_transport_api::init) (const struct ares_serial_transport *transport, const void *config, serial_transport_handler_t evt_handler, void *context)

Function for initializing the serial transport interface.

Parameters
[in]transportPointer to the transfer instance.
[in]configPointer to the instance configuration.
[in]evt_handlerEvent handler.
[in]contextPointer to the context passed to the event handler.
Returns
0 onsuccess.
negative error code otherwise.

◆ read

int(* ares_serial_transport_api::read) (const struct ares_serial_transport *transport, void *data, size_t length, size_t *cnt)

Function for reading data from the transfer interface.

Parameters
[in]transportPointer ot the transfer instance.
[in]dataPointer to the destination buffer.
[in]lengthDestination buffer length.
[out]cntPointer to the received bytes counter.
Returns
0 on success.
negative error code otherwise.

◆ rx_error

bool(* ares_serial_transport_api::rx_error) (const struct ares_serial_transport *transport)

Function that checks if there is a reception error.

Parameters
[in]transportPointer ot the transfer instance.
Returns
true if there was a reception error.
false if there was no reception error.

◆ uninit

int(* ares_serial_transport_api::uninit) (const struct ares_serial_transport *transport)

Function for uninitializing the serial transport interface.

Parameters
[in]transportPointer ot the transfer instance.
Returns
0 on success.
negative error code otherwise.

◆ wait_dtr

void(* ares_serial_transport_api::wait_dtr) (const struct ares_serial_transport *transport)

Function that blocks execution of the thread until the DTR control line is asserted.

Parameters
[in]transportPointer ot the transfer instance.

◆ write

int(* ares_serial_transport_api::write) (const struct ares_serial_transport *transport, const void *data, size_t length, size_t *cnt)

Function for writing data to the transfer interface.

Parameters
[in]transportPointer ot the transfer instance.
[in]dataPointer to the source buffer.
[in]lengthSource buffer length.
[out]cntPointer to the sent bytes counter.
Returns
0 on success.
negative error code otherwise.

The documentation for this struct was generated from the following file: