Loading...
Searching...
No Matches

Interface definition for the CC2420 driver. More...

Detailed Description

Interface definition for the CC2420 driver.

Author
Thomas Eichinger thoma.nosp@m.s.ei.nosp@m.ching.nosp@m.er@f.nosp@m.u-ber.nosp@m.lin..nosp@m.de
Hauke Petersen hauke.nosp@m..pet.nosp@m.ersen.nosp@m.@fu-.nosp@m.berli.nosp@m.n.de

Definition in file cc2420.h.

#include <stdint.h>
#include "periph/spi.h"
#include "periph/gpio.h"
#include "net/netdev.h"
#include "net/netdev/ieee802154.h"
+ Include dependency graph for cc2420.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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. More...
 

Functions

void cc2420_setup (cc2420_t *dev, const cc2420_params_t *params, uint8_t index)
 Setup the device descriptor for the given device.
 
int cc2420_init (cc2420_t *dev)
 Initialize a given CC2420 device.
 
int cc2420_reset (cc2420_t *dev)
 Trigger a hardware reset and configure radio with default values.
 
bool cc2420_cca (cc2420_t *dev)
 Trigger a clear channel assessment.
 
void cc2420_get_addr_short (cc2420_t *dev, uint8_t *addr)
 Get the short address of the given device.
 
void cc2420_set_addr_short (cc2420_t *dev, const uint8_t *addr)
 Set the short address of the given device.
 
void cc2420_get_addr_long (cc2420_t *dev, uint8_t *addr_long)
 Get the configured long address of the given device.
 
void cc2420_set_addr_long (cc2420_t *dev, const uint8_t *addr_long)
 Set the long address of the given device.
 
uint16_t cc2420_get_pan (cc2420_t *dev)
 Get the configured PAN ID of the given device.
 
void cc2420_set_pan (cc2420_t *dev, uint16_t pan)
 Set the PAN ID of the given device.
 
uint16_t cc2420_get_chan (cc2420_t *dev)
 Get the configured channel of the given device.
 
int cc2420_set_chan (cc2420_t *dev, uint16_t chan)
 Set the channel of the given device.
 
int16_t cc2420_get_txpower (cc2420_t *dev)
 Get the configured transmission power of the given device [in dBm].
 
void cc2420_set_txpower (cc2420_t *dev, int16_t txpower)
 Set the transmission power of the given device [in dBm].
 
int cc2420_set_option (cc2420_t *dev, uint16_t option, bool state)
 Enable or disable driver specific options.
 
int cc2420_set_state (cc2420_t *dev, netopt_state_t state)
 Set the state of the given device (trigger a state change)
 
netopt_state_t cc2420_get_state (cc2420_t *dev)
 Get the state of the given device.
 
size_t cc2420_send (cc2420_t *dev, const iolist_t *iolist)
 Convenience function for simply sending data.
 
size_t cc2420_tx_prepare (cc2420_t *dev, const iolist_t *iolist)
 Prepare for sending of data.
 
void cc2420_tx_exec (cc2420_t *dev)
 Trigger sending of data previously loaded into transmit buffer.
 
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.
 

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)