CCxxxx Driver  0.0.1
Macros | Enumerations
Register Utilities

Helper macros to extract bits from registers. More...

Macros

#define CCX_MASK(_WIDTH, _OFFSET)   (((2<<(_WIDTH - 1)) - 1) << (_OFFSET))
 Create a bit nask. More...
 
#define CCX_GET_BITS_VALUE(_BITFIELD, _WIDTH, _OFFSET)   (((_BITFIELD) & (CCX_MASK(_WIDTH, _OFFSET))) >> _OFFSET)
 Retrive a bit mask from a variable. The value will be shifted so that it occupies the least significant bytes. More...
 
#define CCX_HEADER_READ   CCX_MASK(1,7)
 Mask of the Read bit within the header byte.
 
#define CCX_HEADER_BURST   CCX_MASK(1,6)
 Mask of the Burst bit within the header byte.
 
#define CCX_HEADER_ADDRESS   CCX_MASK(6,0)
 Mask of the Address bits within the header byte.
 
#define CCX_SB_GET_STATE(_SB)   CCX_GET_BITS_VALUE(_SB, 3, 4)
 Retrieves the current main state machine mode from the Chip Status byte.
 
#define CCX_SB_GET_FIFO_BYTES_AVAILABLE(_SB)   CCX_GET_BITS_VALUE(_SB, 4, 0)
 Retrieves the current bytes available in the RX FIFO / TX FIFO depending on if the Chip Status byte was retrieved during a Read/Write operation.
 
#define CCX_APD_B0_GET_RSSI(_BYTE0)   (_BYTE0)
 Retrieves the RSSI value which is present within the first optional status byte, appended to received data. More...
 
#define CCX_APD_B1_IS_CRC_OK(_BYTE1)   ((_BYTE1) & CCX_MASK(1,7))
 Retrieves CRC check value which is present within the second optional status byte, appended to received data. More...
 
#define CCX_APD_B1_GET_LQI(_BYTE1)   (CCX_GET_BITS_VALUE((_BYTE1),7,0))
 Retrieves Link Quality Indication value, which is present within the second optional status byte, appended to received data. More...
 

Enumerations

enum  Cc1101ChipStatusState {
  CCX_STATE_IDLE = 0X0, CCX_STATE_RX = 0X1, CCX_STATE_TX = 0X2, CCX_STATE_FSTXON = 0X3,
  CCX_STATE_CALIBRATE = 0X4, CCX_STATE_SETTLING = 0X5, CCX_STATE_RXFIFO_OVERFLOW = 0X6, CCX_STATE_TXFIFO_UNDERFLOW = 0X7
}
 Possible states reported in the Chip Status byte. See CCX_SB_GET_STATE. More...
 

Detailed Description

Helper macros to extract bits from registers.

Macro Definition Documentation

◆ CCX_APD_B0_GET_RSSI

#define CCX_APD_B0_GET_RSSI (   _BYTE0)    (_BYTE0)

Retrieves the RSSI value which is present within the first optional status byte, appended to received data.

Parameters
_BYTE0The first appended status byte.
Returns
RSSI value.

◆ CCX_APD_B1_GET_LQI

#define CCX_APD_B1_GET_LQI (   _BYTE1)    (CCX_GET_BITS_VALUE((_BYTE1),7,0))

Retrieves Link Quality Indication value, which is present within the second optional status byte, appended to received data.

Parameters
_BYTE1The second appended status byte.
Returns
LQI value

◆ CCX_APD_B1_IS_CRC_OK

#define CCX_APD_B1_IS_CRC_OK (   _BYTE1)    ((_BYTE1) & CCX_MASK(1,7))

Retrieves CRC check value which is present within the second optional status byte, appended to received data.

Parameters
_BYTE1The second appended status byte.
Returns
Single bit value of CRC_OK. If CRC for received data is OK, or CRC check was disabled this will be 1

◆ CCX_GET_BITS_VALUE

#define CCX_GET_BITS_VALUE (   _BITFIELD,
  _WIDTH,
  _OFFSET 
)    (((_BITFIELD) & (CCX_MASK(_WIDTH, _OFFSET))) >> _OFFSET)

Retrive a bit mask from a variable. The value will be shifted so that it occupies the least significant bytes.

Parameters
_BITFIELDThe value containing a bitmask/bitfield to extract.
_WIDTHThe width of the bitmask.
_OFFSETThe offset of the lowest bit of the mask. 0 or greater. Once extracted the bitmask is shifted by this value to occupy the lowest bits.

◆ CCX_MASK

#define CCX_MASK (   _WIDTH,
  _OFFSET 
)    (((2<<(_WIDTH - 1)) - 1) << (_OFFSET))

Create a bit nask.

Parameters
_WIDTHThe width of the bitmask.
_OFFSETThe offset of the lowest bit of the mask. 0 or greater.

Enumeration Type Documentation

◆ Cc1101ChipStatusState

Possible states reported in the Chip Status byte. See CCX_SB_GET_STATE.

Enumerator
CCX_STATE_IDLE 

IDLE state

CCX_STATE_RX 

Receive mode

CCX_STATE_TX 

Transmit mode

CCX_STATE_FSTXON 

Fast TX ready

CCX_STATE_CALIBRATE 

Frequency synthesizer calibration is running

CCX_STATE_SETTLING 

PLL is settling

CCX_STATE_RXFIFO_OVERFLOW 

RX FIFO has overflowed

CCX_STATE_TXFIFO_UNDERFLOW 

TX FIFO has overflowed