drivers/include/net/netdev/ble.h

BLE specific adaption for the Netdev API.

NETDEV_BLE_PDU_MAXLEN

Maximum payload length of a standard BLE packet.

1
(37U)
NETDEV_BLE_CRC_MASK

Mask for the actual (3 byte) CRC data in the context’s CRC field.

1
(0x00ffffff)
NETDEV_BLE_CRC_OK

Flag for marking a correct CRC on packet reception.

1
(0x80000000)
int netdev_ble_send(netdev.h::netdev_t * dev, netdev_ble_pkt_t * pkt)

Send the given packet on the next occasion.

If a transmission sequence is in progress, the given packet will be send after 150us after receptions of the last packet. If no sequence is currently active, the packet will be send immediately and a new transmission sequence is started.

Note

Call this function only to start a new transmission sequence (radio is currently idle), or right after a packet was received. If called at any other point in time, the behavior is undefined.

Parameters

dev:radio to use for sending
pkt:data to send

Return values

  • 0 on success
  • < 0 on error
int netdev_ble_recv(netdev.h::netdev_t * dev, netdev_ble_pkt_t * pkt)

Start listening for an incoming packet and write it into pkt.

If a transmission sequence is in progress, the radio will use the given buffer for reception when it goes in to RX mode 150us after sending the last packet. If no sequence is in progress, the radio will go into RX mode immediately (using the given RX buffer), and a new transmission sequence is started.

Note

Call this function only to start a new transmission sequence (radio is currently idle), or right after a packet was sent. If called at any other point in time, the behavior is undefined.

Parameters

dev:radio to use for receiving
pkt:buffer to write new packet to

Return values

  • 0 on success
  • < 0 on error
void netdev_ble_set_ctx(netdev.h::netdev_t * dev, netdev_ble_ctx_t * ctx)

Set the radio context for the given radio device.

Parameters

dev:target radio device
ctx:new radio context (CRC, channel, access address)

void netdev_ble_stop(netdev.h::netdev_t * dev)

Stop the ongoing RX/TX sequence.

Note

This function has not effect if the radio is in the middle of a data transfer

Parameters

dev:target radio device

struct netdev_ble_pkt_t

BLE packet structure (as defined by the BLE standard)

uint8_t flags

header flags

uint8_t len

actual length of PDU

uint8_t pdu()

protocol data unit (PDU)

struct netdev_ble_ctx_t

Radio context.

uint8_t raw()

byte-wise access

uint32_t u32

compact access

union netdev_ble_ctx_t::@142 aa

access address

uint32_t crc

CRC: 3 LSB for CRC, most significant bit for RX state.

uint8_t chan

channel to use/used