Skip to content

Commit

Permalink
drivers/cc110x: replace binary constants and use unsigned char
Browse files Browse the repository at this point in the history
binary constants are a GCC extension
  • Loading branch information
benpicco committed Jul 31, 2020
1 parent 1106091 commit aa0e5e7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions drivers/cc110x/cc110x_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "cc110x.h"
#include "cc110x_internal.h"

const char cc110x_conf[CC110X_CONF_SIZE] = {
const uint8_t cc110x_conf[CC110X_CONF_SIZE] = {
/*
* IOCFG2; default: 0x29 (CHIP_RDYn)
* Invert GDO2: off,
Expand Down Expand Up @@ -327,4 +327,4 @@ const char cc110x_conf[CC110X_CONF_SIZE] = {
0x00, /*< RCCTRL0 */
};

const char cc110x_magic_registers[3] = { 0x88, 0x31, 0x09 };
const uint8_t cc110x_magic_registers[3] = { 0x88, 0x31, 0x09 };
4 changes: 2 additions & 2 deletions drivers/cc110x/include/cc110x_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extern "C" {
/**
* @brief Configuration register values for CC1100/CC1101 transceivers
*/
extern const char cc110x_conf[CC110X_CONF_SIZE];
extern const uint8_t cc110x_conf[CC110X_CONF_SIZE];

/**
* @brief Magic numbers to write to the TEST2, TEST1 and TEST0 configuration
Expand All @@ -51,7 +51,7 @@ extern const char cc110x_conf[CC110X_CONF_SIZE];
* transceiver configuration, those numbers should be checked again with the
* SmartRF Studio
*/
extern const char cc110x_magic_registers[3];
extern const uint8_t cc110x_magic_registers[3];

/**
* @name Configuration data that specify the 8 available output power levels
Expand Down
24 changes: 12 additions & 12 deletions drivers/include/cc110x.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@ extern "C" {
* page 31 in the data sheet for the possible states in the status byte.
*/
typedef enum {
CC110X_STATE_IDLE = 0b00000000, /**< IDLE state */
CC110X_STATE_IDLE = 0x00, /**< IDLE state */
/**
* @brief Frame received, waiting for upper layer to retrieve it
*
* Transceiver is in IDLE state.
*/
CC110X_STATE_FRAME_READY = 0b00001000,
CC110X_STATE_FRAME_READY = 0x08,
/**
* @brief Frame received, waiting for upper layer to retrieve it
*
Expand All @@ -276,26 +276,26 @@ typedef enum {
* bring it in the IDLE state. Thus, we set the three least significant bits
* to the IDLE state
*/
CC110X_STATE_OFF = 0b00010000,
CC110X_STATE_RX_MODE = 0b00000001, /**< Listening for frames */
CC110X_STATE_OFF = 0x10,
CC110X_STATE_RX_MODE = 0x01, /**< Listening for frames */
/**
* @brief Receiving a frame just now
*
* Transceiver is in RX state.
*/
CC110X_STATE_RECEIVING = 0b00001001,
CC110X_STATE_TX_MODE = 0b00000010, /**< Transmit mode */
CC110X_STATE_RECEIVING = 0x09,
CC110X_STATE_TX_MODE = 0x02, /**< Transmit mode */
/**
* @brief Waiting for transceiver to complete outgoing transmission
*
* Transceiver is in TX state
*/
CC110X_STATE_TX_COMPLETING = 0b00001010,
CC110X_STATE_FSTXON = 0b00000011, /**< Fast TX ready */
CC110X_STATE_CALIBRATE = 0b00000100, /**< Device is calibrating */
CC110X_STATE_SETTLING = 0b00000101, /**< PLL is settling */
CC110X_STATE_RXFIFO_OVERFLOW = 0b00000110, /**< RX FIFO overflown */
CC110X_STATE_TXFIFO_UNDERFLOW = 0b00000111, /**< TX FIFO underflown */
CC110X_STATE_TX_COMPLETING = 0x0A,
CC110X_STATE_FSTXON = 0x03, /**< Fast TX ready */
CC110X_STATE_CALIBRATE = 0x04, /**< Device is calibrating */
CC110X_STATE_SETTLING = 0x05, /**< PLL is settling */
CC110X_STATE_RXFIFO_OVERFLOW = 0x06, /**< RX FIFO overflown */
CC110X_STATE_TXFIFO_UNDERFLOW = 0x07, /**< TX FIFO underflown */
} cc110x_state_t;

/**
Expand Down

0 comments on commit aa0e5e7

Please sign in to comment.