Skip to content

File baton_link.c

FileList > src > baton_link.c

Go to the source code of this file

  • #include <string.h>
  • #include "baton_link.h"

Public Static Functions

Type Name
bool rx_echo (struct baton_link * link, uint8_t byte, uint32_t now_ms)
Compare one byte with the echo of the own transmission.
int rx_parse (struct baton_link * link, uint8_t byte, uint32_t now_ms)
Feed one byte from another node to the parser.
int tx_finish (struct baton_link * link, uint32_t now_ms)
End the current transmission and report it.
int tx_start (struct baton_link * link, uint32_t now_ms)
Start the requested transmission once the bus has been silent long enough.

Macros

Type Name
define RX_MASK ([**BATON\_RX\_BUF\_SIZE**](group__baton__config.md#define-baton_rx_buf_size) - 1U)
Index mask of the receive ring (its size is a power of two).
define TX_BUSY 2U
define TX_IDLE 0U
Transmitter states.
define TX_TIMEOUT_MARGIN_MS 5U
Margin added to the expected duration of a transmission before it times out.
define TX_WAIT_GAP 1U

Public Static Functions Documentation

function rx_echo

Compare one byte with the echo of the own transmission.

static bool rx_echo (
    struct baton_link * link,
    uint8_t byte,
    uint32_t now_ms
) 

Returns:

true when the byte was an echo byte and the echo is now complete.


function rx_parse

Feed one byte from another node to the parser.

static int rx_parse (
    struct baton_link * link,
    uint8_t byte,
    uint32_t now_ms
) 


function tx_finish

End the current transmission and report it.

static int tx_finish (
    struct baton_link * link,
    uint32_t now_ms
) 


function tx_start

Start the requested transmission once the bus has been silent long enough.

static int tx_start (
    struct baton_link * link,
    uint32_t now_ms
) 


Macro Definition Documentation

define RX_MASK

Index mask of the receive ring (its size is a power of two).

#define RX_MASK `( BATON_RX_BUF_SIZE - 1U)`


define TX_BUSY

#define TX_BUSY `2U`

define TX_IDLE

Transmitter states.

#define TX_IDLE `0U`


define TX_TIMEOUT_MARGIN_MS

Margin added to the expected duration of a transmission before it times out.

#define TX_TIMEOUT_MARGIN_MS `5U`


define TX_WAIT_GAP

#define TX_WAIT_GAP `1U`


The documentation for this class was generated from the following file src/baton_link.c