Files | |
file | cc2420_internal.h |
Definitions and settings for the cc2420. | |
file | cc2420_netdev.h |
Netdev interface for the CC2420. | |
file | cc2420_params.h |
Default configuration for the CC2420 driver. | |
file | cc2420_registers.h |
Register and command definitions for CC2420. | |
file | cc2420.h |
Interface definition for the CC2420 driver. | |
Data Structures | |
struct | cc2420_params |
Struct holding all parameters needed for device initialization. More... | |
struct | cc2420_t |
Device descriptor for CC2420 radio devices. More... | |
Macros | |
#define | CC2420_PKT_MAXLEN (IEEE802154_FRAME_LEN_MAX) |
Maximum possible packet size in byte. | |
#define | CC2420_RSSI_OFFSET (-45) |
RSSI offset. | |
Typedefs | |
typedef struct cc2420_params | cc2420_params_t |
Struct holding all parameters needed for device initialization. | |
Enumerations | |
enum | { CC2420_RET_CHAN_OK = 2 } |
A couple of return values used in this driver. | |
Functions | |
void | cc2420_setup (cc2420_t *dev, const cc2420_params_t *params) |
Setup the device descriptor for the given device. More... | |
int | cc2420_init (cc2420_t *dev) |
Initialize a given CC2420 device. More... | |
int | cc2420_reset (cc2420_t *dev) |
Trigger a hardware reset and configure radio with default values. More... | |
bool | cc2420_cca (cc2420_t *dev) |
Trigger a clear channel assessment. More... | |
void | cc2420_get_addr_short (cc2420_t *dev, uint8_t *addr) |
Get the short address of the given device. More... | |
void | cc2420_set_addr_short (cc2420_t *dev, const uint8_t *addr) |
Set the short address of the given device. More... | |
void | cc2420_get_addr_long (cc2420_t *dev, uint8_t *addr_long) |
Get the configured long address of the given device. More... | |
void | cc2420_set_addr_long (cc2420_t *dev, const uint8_t *addr_long) |
Set the long address of the given device. More... | |
uint16_t | cc2420_get_pan (cc2420_t *dev) |
Get the configured PAN ID of the given device. More... | |
void | cc2420_set_pan (cc2420_t *dev, uint16_t pan) |
Set the PAN ID of the given device. More... | |
uint16_t | cc2420_get_chan (cc2420_t *dev) |
Get the configured channel of the given device. More... | |
int | cc2420_set_chan (cc2420_t *dev, uint16_t chan) |
Set the channel of the given device. More... | |
int16_t | cc2420_get_txpower (cc2420_t *dev) |
Get the configured transmission power of the given device [in dBm]. More... | |
void | cc2420_set_txpower (cc2420_t *dev, int16_t txpower) |
Set the transmission power of the given device [in dBm]. More... | |
int | cc2420_set_option (cc2420_t *dev, uint16_t option, bool state) |
Enable or disable driver specific options. More... | |
int | cc2420_set_state (cc2420_t *dev, netopt_state_t state) |
Set the state of the given device (trigger a state change) More... | |
netopt_state_t | cc2420_get_state (cc2420_t *dev) |
Get the state of the given device. More... | |
size_t | cc2420_send (cc2420_t *dev, const iolist_t *iolist) |
Convenience function for simply sending data. More... | |
size_t | cc2420_tx_prepare (cc2420_t *dev, const iolist_t *iolist) |
Prepare for sending of data. More... | |
void | cc2420_tx_exec (cc2420_t *dev) |
Trigger sending of data previously loaded into transmit buffer. More... | |
int | cc2420_rx (cc2420_t *dev, uint8_t *buf, size_t max_len, void *info) |
Read a chunk of data from the receive buffer of the given device. More... | |
Channel configuration | |
#define | CC2420_CHAN_MIN (IEEE802154_CHANNEL_MIN) |
#define | CC2420_CHAN_MAX (IEEE802154_CHANNEL_MAX) |
#define | CC2420_CHAN_DEFAULT (CONFIG_IEEE802154_DEFAULT_CHANNEL) |
Default TX power configuration [in dBm] | |
#define | CC2420_TXPOWER_MIN (-25) |
#define | CC2420_TXPOWER_MAX (0) |
#define | CC2420_TXPOWER_DEFAULT (CONFIG_IEEE802154_DEFAULT_TXPOWER) |
bool cc2420_cca | ( | cc2420_t * | dev | ) |
Trigger a clear channel assessment.
[in] | dev | device to use |
void cc2420_get_addr_long | ( | cc2420_t * | dev, |
uint8_t * | addr_long | ||
) |
Get the configured long address of the given device.
[in] | dev | device to read from |
[out] | addr_long | buffer to save the read address |
void cc2420_get_addr_short | ( | cc2420_t * | dev, |
uint8_t * | addr | ||
) |
Get the short address of the given device.
[in] | dev | device to read from |
[out] | addr | memory to write the 2 byte address into |
uint16_t cc2420_get_chan | ( | cc2420_t * | dev | ) |
Get the configured channel of the given device.
[in] | dev | device to read from |
uint16_t cc2420_get_pan | ( | cc2420_t * | dev | ) |
Get the configured PAN ID of the given device.
[in] | dev | device to read from |
netopt_state_t cc2420_get_state | ( | cc2420_t * | dev | ) |
Get the state of the given device.
[in] | dev | device to change state of |
int16_t cc2420_get_txpower | ( | cc2420_t * | dev | ) |
Get the configured transmission power of the given device [in dBm].
[in] | dev | device to read from |
int cc2420_init | ( | cc2420_t * | dev | ) |
Initialize a given CC2420 device.
[out] | dev | device descriptor |
int cc2420_reset | ( | cc2420_t * | dev | ) |
Trigger a hardware reset and configure radio with default values.
[in] | dev | device to reset |
int cc2420_rx | ( | cc2420_t * | dev, |
uint8_t * | buf, | ||
size_t | max_len, | ||
void * | info | ||
) |
Read a chunk of data from the receive buffer of the given device.
[in] | dev | device to read from |
[out] | buf | buffer to write data to |
[in] | max_len | number of bytes to read from device |
[in] | info | to be removed |
buf
if present Convenience function for simply sending data.
[in] | dev | device to use for sending |
[in] | iolist | data to send (must include IEEE802.15.4 header) |
void cc2420_set_addr_long | ( | cc2420_t * | dev, |
const uint8_t * | addr_long | ||
) |
Set the long address of the given device.
[in] | dev | device to write to |
[in] | addr_long | (8-byte) long address to set |
void cc2420_set_addr_short | ( | cc2420_t * | dev, |
const uint8_t * | addr | ||
) |
Set the short address of the given device.
[in] | dev | device to write to |
[in] | addr | (2-byte) short address to set |
int cc2420_set_chan | ( | cc2420_t * | dev, |
uint16_t | chan | ||
) |
Set the channel of the given device.
[in] | dev | device to write to |
[in] | chan | channel to set |
int cc2420_set_option | ( | cc2420_t * | dev, |
uint16_t | option, | ||
bool | state | ||
) |
Enable or disable driver specific options.
[in] | dev | device to set/clear option flag for |
[in] | option | option to enable/disable |
[in] | state | true for enable, false for disable |
void cc2420_set_pan | ( | cc2420_t * | dev, |
uint16_t | pan | ||
) |
Set the PAN ID of the given device.
[in] | dev | device to write to |
[in] | pan | PAN ID to set |
int cc2420_set_state | ( | cc2420_t * | dev, |
netopt_state_t | state | ||
) |
Set the state of the given device (trigger a state change)
[in] | dev | device to change state of |
[in] | state | the targeted new state |
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.
[in] | dev | device to write to |
[in] | txpower | transmission power in dBm |
void cc2420_setup | ( | cc2420_t * | dev, |
const cc2420_params_t * | params | ||
) |
Setup the device descriptor for the given device.
[out] | dev | device descriptor |
[in] | params | device parameters |
void cc2420_tx_exec | ( | cc2420_t * | dev | ) |
Trigger sending of data previously loaded into transmit buffer.
[in] | dev | device to trigger |
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.
[in] | dev | device to prepare for sending |
[in] | iolist | data to prepare (must include IEEE802.15.4 header) |