CC2420 radio driver¶
-
CC2420_CHAN_MIN
¶ 1
(IEEE802154_CHANNEL_MIN)
-
CC2420_CHAN_MAX
¶ 1
(IEEE802154_CHANNEL_MAX)
-
CC2420_CHAN_DEFAULT
¶ 1
(IEEE802154_DEFAULT_CHANNEL)
-
CC2420_TXPOWER_MIN
¶ 1
(-25)
-
CC2420_TXPOWER_MAX
¶ 1
(0)
-
CC2420_TXPOWER_DEFAULT
¶ 1
(IEEE802154_DEFAULT_TXPOWER)
-
enum
@116
¶ - CC2420_RET_CHAN_OK
= 2
- CC2420_RET_CHAN_OK
-
struct cc2420_params
cc2420_params_t
¶ Struct holding all parameters needed for device initialization.
-
void
cc2420_setup
(cc2420_t * dev, constcc2420.h::cc2420_params_t
* params)¶ Setup the device descriptor for the given device.
Parameters
dev: device descriptor params: device parameters Return values
- 0 on success
- -1 on error
-
int
cc2420_init
(cc2420_t * dev)¶ Initialize a given CC2420 device.
Parameters
dev: device descriptor Return values
- 0 on success
- <0 on error
-
int
cc2420_reset
(cc2420_t * dev)¶ Trigger a hardware reset and configure radio with default values.
Parameters
dev: device to reset Return values
- TODO
-
bool
cc2420_cca
(cc2420_t * dev)¶ Trigger a clear channel assessment.
Parameters
dev: device to use Return values
- true if channel is clear
- false if channel is busy
-
void
cc2420_get_addr_short
(cc2420_t * dev, uint8_t * addr)¶ Get the short address of the given device.
Parameters
dev: device to read from addr: memory to write the 2 byte address into
-
void
cc2420_set_addr_short
(cc2420_t * dev, const uint8_t * addr)¶ Set the short address of the given device.
Parameters
dev: device to write to addr: (2-byte) short address to set
-
void
cc2420_get_addr_long
(cc2420_t * dev, uint8_t * addr_long)¶ Get the configured long address of the given device.
Parameters
dev: device to read from addr_long: buffer to save the read address Return values
- the currently set (8-byte) long address
-
void
cc2420_set_addr_long
(cc2420_t * dev, const uint8_t * addr_long)¶ Set the long address of the given device.
Parameters
dev: device to write to addr_long: (8-byte) long address to set
-
uint16_t
cc2420_get_pan
(cc2420_t * dev)¶ Get the configured PAN ID of the given device.
Parameters
dev: device to read from Return values
- the currently set PAN ID
-
void
cc2420_set_pan
(cc2420_t * dev, uint16_t pan)¶ Set the PAN ID of the given device.
Parameters
dev: device to write to pan: PAN ID to set
-
uint16_t
cc2420_get_chan
(cc2420_t * dev)¶ Get the configured channel of the given device.
Parameters
dev: device to read from Return values
- the currently set channel
-
int
cc2420_set_chan
(cc2420_t * dev, uint16_t chan)¶ Set the channel of the given device.
Parameters
dev: device to write to chan: channel to set
-
int16_t
cc2420_get_txpower
(cc2420_t * dev)¶ Get the configured transmission power of the given device [in dBm].
Parameters
dev: device to read from Return values
- configured transmission power in dBm
-
void
cc2420_set_txpower
(cc2420_t * dev, int16_t txpower)¶ Set the transmission power of the given device [in dBm].
If the device does not support the exact dBm value given, it will set a value as close as possible to the given value. If the given value is larger or lower then the maximal or minimal possible value, the min or max value is set, respectively.
Parameters
dev: device to write to txpower: transmission power in dBm
-
int
cc2420_set_option
(cc2420_t * dev, uint16_t option, bool state)¶ Enable or disable driver specific options.
Parameters
dev: device to set/clear option flag for option: option to enable/disable state: true for enable, false for disable
-
int
cc2420_set_state
(cc2420_t * dev,netopt.h::netopt_state_t
state)¶ Set the state of the given device (trigger a state change)
Parameters
dev: device to change state of state: the targeted new state
-
netopt.h::netopt_state_t
cc2420_get_state
(cc2420_t * dev)¶ Get the state of the given device.
Parameters
dev: device to change state of Return values
- the device’s current state
-
msp430_types.h::size_t
cc2420_send
(cc2420_t * dev, constiolist.h::iolist_t
* iolist)¶ Convenience function for simply sending data.
Note
This function ignores the PRELOADING option
Parameters
dev: device to use for sending iolist: data to send (must include IEEE802.15.4 header) Return values
- number of bytes that were actually send
- 0 on error
-
msp430_types.h::size_t
cc2420_tx_prepare
(cc2420_t * dev, constiolist.h::iolist_t
* iolist)¶ Prepare for sending of data.
This function puts the given device into the TX state, so no receiving of data is possible after it was called.
Parameters
dev: device to prepare for sending iolist: data to prepare (must include IEEE802.15.4 header)
-
void
cc2420_tx_exec
(cc2420_t * dev)¶ Trigger sending of data previously loaded into transmit buffer.
Parameters
dev: device to trigger
-
int
cc2420_rx
(cc2420_t * dev, uint8_t * buf,msp430_types.h::size_t
max_len, void * info)¶ Read a chunk of data from the receive buffer of the given device.
Parameters
dev: device to read from buf: buffer to write data to max_len: number of bytes to read from device info: to be removed Return values
- the number of bytes in the Rx FIFO
- the number of bytes written to
buf
if present
-
CC2420_PKT_MAXLEN
¶ Maximum possible packet size in byte.
1
(IEEE802154_FRAME_LEN_MAX)
-
CC2420_RSSI_OFFSET
¶ RSSI offset.
1
(-45)
-
struct
cc2420_params
¶ Struct holding all parameters needed for device initialization.
-
spi.h::spi_t
spi
¶ SPI bus the device is connected to.
-
atmega_common/include/periph_cpu_common.h::spi_clk_t
spi_clk
¶ SPI speed to use.
-
gpio.h::gpio_t
pin_cs
¶ pin connected to chip select
-
gpio.h::gpio_t
pin_fifo
¶ pin connected to the FIFO interrupt pin
-
gpio.h::gpio_t
pin_fifop
¶ pin connected to the FIFOP interrupt pin
-
gpio.h::gpio_t
pin_cca
¶ pin connected to CCA
-
gpio.h::gpio_t
pin_sfd
¶ pin connected to ‘start of frame delimiter’
-
gpio.h::gpio_t
pin_vrefen
¶ pin connected to the Vref enable pin
-
gpio.h::gpio_t
pin_reset
¶ pin connected to the reset pin
-
-
struct
cc2420_t
¶ Device descriptor for CC2420 radio devices.
-
netdev_ieee802154_t
netdev
¶ netdev parent struct
-
cc2420.h::cc2420_params_t
params
¶ hardware interface configuration
-
uint8_t
state
¶ current state of the radio
-
uint16_t
options
¶ state of used options
-
netdev_ieee802154_t