MySensors Library & Examples  2.3.2-95-g0c695e3e
Classes | Macros | Typedefs | Enumerations
+ Collaboration diagram for CC1101:

Detailed Description

API declaration for CC1101.

CC1101 driver-related log messages, format: [!]SYSTEM:[SUB SYSTEM:]MESSAGE

E SYS SUB Message Comment
CC1101 INIT Initialise CC1101 radio
CC1101 INIT GD0PIN=%u GDO0 pin number
! CC1101 INIT SANCHK FAIL Sanity check failed, check wiring or replace module
CC1101 RECV DATA=%s,RSSI=%d (%d) Received data, RSSI and raw RSSI value
! CC1101 RECV OVERFLOW RX FIFO overflowed
! CC1101 CSN TMOUT=%d CSN to SO low timeout
CC1101 PTC LEVEL=%d Set TX power level
CC1101 SAC SEND ACK,TO=%d,SEQ=%u,RSSI=%d,LQI=%u Send ACK to node (TO), sequence number (SEQ), RSSI of received message (RSSI), LQI of message (LQI)
CC1101 ATC cR=%d, tR=%d, pL=%d, newPL=%d Adjust TX level, current RSSI (cR), target RSSI (tR), current power level (pL), new power level (newPL)
CC1101 SWR SEND,TO=%u,LEN=%d,SEQ=%u,RETRY=%u,NOACK=%d Send message to (TO), length (LEN), sequence number (SEQ), retry count (RETRY), noACK flag (NOACK)
CC1101 SWR ACK FROM=%u,SEQ=%u,RSSI=%d,LQI:%d ACK received from node (FROM), sequence number (SEQ), RSSI, LQI
! CC1101 SWR NACK No ACK received
! CC1101 CCA FAIL Could not send, channel active
! CC1101 TXTMOUT Transmit timeout
CC1101 SPP PCT=%u,TX LEVEL=%d Set TX level percent (PCT), TX level (LEVEL)
CC1101 FREQ 0x%%02x%%02x%%02x Frequency set to value

Options for modem config (MY_CC1101_MODEM_CONFIGURATION)

Config Bandwidth Baud Deviation Comment
CC1101_MODEM_S_BR4_8_FD20 135KHz 4800 19kHz Default, low speed, reliable
CC1101_MODEM_M_BR38_4_FD20 200KHz 38400 47kHz Higher speed, less reliable
CC1101_MODEM_F_BR100_FD50 200KHz 100k 47kHz Much faster, less reliable
CC1101_MODEM_XF_BR250_FD125 320KHz 250k 125kHz Fasest, least reliable

Classes

union  cc1101_controlFlags_t
 Control flag data type. More...
 
struct  __attribute__
 FW config structure, stored in eeprom. More...
 
struct  cc1101_internal_t
 CC1101 internal variables. More...
 

Macros

#define CC1101_SPI   hwSPI
 default SPI
 
#define DEFAULT_CC1101_GD0_PIN   (2)
 DEFAULT_CC1101_GD0_PIN.
 
#define DEFAULT_CC1101_CS_PIN   (SS)
 DEFAULT_CC1101_CS_PIN.
 
#define CC1101_CRYSTAL_HZ   26000000LL
 
#define CC1101_315MHZ   315000000LL
 
#define CC1101_433MHZ   433100000LL
 
#define CC1101_868MHZ   868100000LL
 
#define CC1101_915MHZ   915100000LL
 
#define CC1101_FREQ_VAL   (((MY_CC1101_FREQUENCY)*65536LL) / CC1101_CRYSTAL_HZ)
 
#define CC1101_FREQ_BYTE0   ((CC1101_FREQ_VAL >> 16) & 0xFF)
 
#define CC1101_FREQ_BYTE1   ((CC1101_FREQ_VAL >> 8) & 0xFF)
 
#define CC1101_FREQ_BYTE2   (CC1101_FREQ_VAL & 0xFF)
 
#define MY_CC1101_MIN_POWER_LEVEL   (0)
 Sets the minimum allowable output power level for AUTO. Default: -30dBm (0.001mW)
 
#define CC1101_ATC_TARGET_RANGE_DBM   (15)
 ATC target range +/- dBm.
 
#define CC1101_RSSI_OFFSET   (74u)
 RSSI offset.
 
#define CC1101_TARGET_RSSI   (-50)
 RSSI target.
 
#define CC1101_MODEM_S_BR4_8_FD20   0
 135KHz bandwidth, 4800 baud, 19kHz deviation
 
#define CC1101_MODEM_M_BR38_4_FD20   1
 200KHz bandwidth, 38400 baud, 47kHz deviation
 
#define CC1101_MODEM_F_BR100_FD50   2
 200KHz bandwidth, 100000 baud, 47kHz deviation
 
#define CC1101_MODEM_XF_BR250_FD125   3
 320KHz bandwidth, 250000 baud, 125kHz deviation
 
#define CC1101_MAX_PACKET_LEN   (0x40u)
 Maximum packet size that can be carried by the modem.
 
#define CC1101_PREAMBLE_LENGTH   (8u)
 Preamble length, default=8.
 
#define CC1101_BROADCAST_ADDRESS   0xFF
 
#define CC1101_TX_RETRIES   (5u)
 Retries in case of fail to transmit (eg CCA)
 
#define MY_CC1101_TX_TIMEOUT_MS   (50ul)
 Timeout before TX is considered failed.
 
#define MY_CC1101_TX_RETRY_DELAY_MS   (50l)
 Delay before reattempting transmit.
 
#define CC1101_SEND_RETRIES   (4u)
 Retries in case ACK is not received.
 
#define MY_CC1101_SEND_TIMEOUT_MS   (500ul)
 How long to wait for an ACK.
 
#define MY_CC1101_ACK_SEND_DELAY_MS   5
 
#define MY_CC1101_CSN_TIMEOUT_MS   (2ul)
 CSN to SO low timeout.
 
#define CC1101_RETRY_TIMEOUT_MS   (1000ul)
 
#define CC1101_WRITE_SINGLE   0x00
 
#define CC1101_WRITE_BURST   0x40
 
#define CC1101_READ_SINGLE   0x80
 
#define CC1101_READ_BURST   0xC0
 
#define CC1101_HEADER_LEN   sizeof(cc1101_header_t)
 Size header inside payload.
 
#define CC1101_MAX_PAYLOAD_LEN   (CC1101_MAX_PACKET_LEN - CC1101_HEADER_LEN)
 Max payload length.
 
#define CC1101_PACKET_HEADER_VERSION   (1u)
 CC1101 packet header version.
 
#define CC1101_MIN_PACKET_HEADER_VERSION   (1u)
 Minimal CC1101 packet header version.
 

Typedefs

typedef enum cc1101PowerLevel_e cc1101_powerLevel_t
 
typedef uint16_t cc1101_sequenceNumber_t
 Sequence number data type.
 
typedef int8_t cc1101_RSSI_t
 RSSI data type.
 
typedef uint8_t cc1101_LQI_t
 LQI data type.
 
typedef uint8_t cc1101_status_t
 Chip status byte.
 

Enumerations

enum  cc1101PowerLevel_e {
  CC1101_POWER_0 = 0x0, CC1101_POWER_1 = 0x1, CC1101_POWER_2 = 0x2, CC1101_POWER_3 = 0x3,
  CC1101_POWER_4 = 0x4, CC1101_POWER_5 = 0x5, CC1101_POWER_6 = 0x6, CC1101_POWER_7 = 0x7,
  CC1101_POWER_AUTO = 0xff
}
 
enum  cc1101_radioModes_t {
  CC1101_MODE_SLEEP = 0x00, CC1101_MODE_IDLE, CC1101_MODE_FS, CC1101_MODE_TX,
  CC1101_MODE_RX, CC1101_MODE_CCA
}
 CC1101 operation Modes. More...
 

Macro Definition Documentation

◆ CC1101_RETRY_TIMEOUT_MS

#define CC1101_RETRY_TIMEOUT_MS   (1000ul)

Timeout for ACK, adjustments needed if modem configuration changed (air time different)

Definition at line 217 of file CC1101.h.

◆ MY_CC1101_ACK_SEND_DELAY_MS

#define MY_CC1101_ACK_SEND_DELAY_MS   5

Delay before sending ACK packet, to give slow nodes a chance to flip to RX.

Definition at line 201 of file CC1101.h.

Enumeration Type Documentation

◆ cc1101_radioModes_t

CC1101 operation Modes.

Enumerator
CC1101_MODE_SLEEP 

CC1101 is in sleep mode.

CC1101_MODE_IDLE 

CC1101 is in idle mode.

CC1101_MODE_FS 

CC1101 is in frequency synthesis mode.

CC1101_MODE_TX 

CC1101 is in transmit mode.

CC1101_MODE_RX 

CC1101 is in receive mode.

CC1101_MODE_CCA 

CC1101 is in clear channel assessment mode.

Definition at line 313 of file CC1101.h.

◆ cc1101PowerLevel_e

Enumerator
CC1101_POWER_0 

-30dBm

CC1101_POWER_1 

-20dBm

CC1101_POWER_2 

-15dBm

CC1101_POWER_3 

-10dBm

CC1101_POWER_4 

0dBm

CC1101_POWER_5 

5dBm

CC1101_POWER_6 

7dBm

CC1101_POWER_7 

10dBm

CC1101_POWER_AUTO 

Enable ATC.

Definition at line 109 of file CC1101.h.