1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/cc110x: Replaced some magic numbers

This commit is contained in:
Marian Buschsieweke 2020-01-23 14:10:03 +01:00
parent 88f9d5870d
commit f7eb9233da
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F
2 changed files with 56 additions and 2 deletions

View File

@ -84,7 +84,7 @@ const char cc110x_conf[CC110X_CONF_SIZE] = {
* (e.g. a huge frame is dropped before it fully received) which reduces
* the system's load. Thus, it is enabled.
*/
0x02,
CC110X_PKTCTRL1_VALUE | CC110X_PKTCTRL1_ADDR_MATCH,
/*
* PKTCTRL0; default: 0x45
* Data whitening enabled, use RX/TX FIFOs, CRC enabled,
@ -291,7 +291,7 @@ const char cc110x_conf[CC110X_CONF_SIZE] = {
* Why not default:
* Use a reasonable TX power level instead of the lowest.
*/
0x14,
0x10 | CC110X_TX_POWER_0_DBM,
/*
* FSCAL3, FSCAL2, FSCAL1, FSCAL0; defaults: 0xA9, 0x0A, 0x20, 0x0d
* These values store calibration date of the CC1100/CC1101 transceiver.

View File

@ -206,6 +206,27 @@ extern "C" {
*/
#define CC110X_REG_IOCFG0 0x02
/**
* @brief PKTCTRL1 configuration register
*
* This register contains multiple configuration settings.
*
* Layout:
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+
* | PQT |U|C|S|ADR|
* +-+-+-+-+-+-+-+-+
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* - PQT (bits 7-5): Preabmle quality estimator threshold
* - U (bit 4): unused, always 0
* - C (bit 3): Auto-clear RX FIFO on CRC mismatch (if frame fits in FIFO)
* - S (bit 2): Append status
* - ADR (bits 1-0): Address check setting
*/
#define CC110X_REG_PKTCTRL1 0x07
/**
* @brief Device address
*/
@ -516,6 +537,39 @@ extern "C" {
*/
#define CC110X_FIFO_SIZE 64
/**
* @brief Value of the bits 7-2 of the PKTCTRL1 configuration register used
* in this driver
*/
#define CC110X_PKTCTRL1_VALUE 0x00
/**
* @name Possible address matching policies
*
* See page 73 in the data sheet. The policy should be combined with
* @ref CC110X_PKTCTRL1_VALUE via bitwise or. (Only modes compatible with the
* driver are defined.)
*
* @{
*/
/**
* @brief Accept incoming frames regardless of address
*/
#define CC110X_PKTCTRL1_ADDR_ALL 0x00
/**
* @brief Accept frames with matching address or broadcast address
*/
#define CC110X_PKTCTRL1_ADDR_MATCH 0x02
/**
* @brief Bitmask to access address matching mode of the CC110x from the
* PKTCTRL1 register
*
* Apply this using bitwise and to the value of the PKTCTRL1 register to get the
* address matching mode currently used.
*/
#define CC110X_PKTCTRL1_GET_ADDR_MODE 0x03
/** @} */
#ifdef __cplusplus
}
#endif