nrfmin.h

Interface definition for the nrfmin NRF51822 radio driver.

NRFMIN_CHAN_MIN

nrfmin channel configuration

1
(0U)
NRFMIN_CHAN_DEFAULT
1
(0U)                /* 2400MHz */
NRFMIN_CHAN_MAX
1
(32)
NRFMIN_HDR_LEN

Export some information on header and packet lengths.

1
(sizeof(nrfmin_hdr_t))
NRFMIN_PKT_MAX
1
(NRFMIN_HDR_LEN + NRFMIN_PAYLOAD_MAX)
NRFMIN_TXPOWER_DEFAULT

Default transmission power used.

1
(0)                 /* 0dBm */
NRFMIN_ADDR_BCAST

Export the default nrfmin broadcast address.

1
(0xffff)
NRFMIN_PAYLOAD_MAX

Default maximum payload length (must be <= 250)

1
(200U)
netdev.h::netdev_t nrfmin_dev

Export the netdev device descriptor.

const netdev.h::netdev_driver_t nrfmin_netdev

Reference to the netdev driver interface.

void nrfmin_setup(void)

Setup the device driver’s data structures.

uint16_t nrfmin_get_addr(void)

Get the currently active address.

Return values

  • the 16-bit node address
void nrfmin_set_addr(uint16_t addr)

Set the 16-bit radio address.

Parameters

addr:address to set

void nrfmin_get_pseudo_long_addr(uint16_t * addr)

Get a pseudo 64-bit long address (needed by IPv6 and 6LoWPAN)

As we do not support 64-bit addresses, we just make one up, for this we simply return 4 times concatenated the 16-bit address.

Parameters

addr:64-bit pseudo long address, as array of 4 * 16-bit

void nrfmin_get_iid(uint16_t * iid)

Get the IID build from the 16-bit node address.

Parameters

iid:the 64-bit IID, as array of 4 * 16-bit

uint16_t nrfmin_get_channel(void)

Get the current channel.

Return values

  • currently active channel
int nrfmin_set_channel(uint16_t chan)

Set the active channel.

Parameters

chan:targeted channel [0-31]

Return values

  • sizeof(uint16_t) on success
  • -EOVERFLOW if channel is not applicable
netopt.h::netopt_state_t nrfmin_get_state(void)

Get the current radio state.

Return values

  • state the radio is currently in
int nrfmin_set_state(netopt.h::netopt_state_t val)

Put the device into the given state.

Parameters

val:target state

Return values

  • sizeof(netopt_state_t) on success
  • -ENOTSUP if target state is not applicable
int16_t nrfmin_get_txpower(void)

Get the current transmit power.

Return values

  • transmission power in [dBm]
void nrfmin_set_txpower(int16_t power)

Set the used transmission power.

Parameters

power:targeted power, in [dBm]

struct nrfmin_hdr_t

Header format used for our custom nrfmin link layer.

uint8_t len

packet length, including this header

uint16_t src_addr

source address of the packet

uint16_t dst_addr

destination address

uint8_t proto

protocol of payload

union nrfmin_pkt_t

In-memory structure of a nrfmin radio packet.