CCxxxx Driver
0.0.1
|
Required MCU-to-CCxxxx functions. More...
Functions | |
uint8_t | ccxSpiInit (void) |
Initialise the SPI hardware. More... | |
uint8_t | ccxSpiShutdown (void) |
Shutdown the SPI hardware. More... | |
uint8_t | ccxSpiPinChipSelectSet (uint8_t setValue) |
Set the state of the Chip Select (CS) line. More... | |
uint8_t | ccxSpiPinSlaveOutRead (uint8_t *currentValue) |
Read the current state of the Slave Out (SO) line. More... | |
uint8_t | ccxSpiTransaction (uint8_t address, const uint8_t *writeBytes, uint8_t writeLength, uint8_t *readBytes, uint8_t readLength) |
Start a SPI transaction to the CC1101, either read or write. More... | |
uint8_t | ccxSpiDelay25us (void) |
Provide a reliable, 25 us delay. More... | |
Required MCU-to-CCxxxx functions.
If porting this driver to new hardware, the user must create the necessary function definitions and implement them as described.
uint8_t ccxSpiDelay25us | ( | void | ) |
Provide a reliable, 25 us delay.
Exact timing is not important, and assumed this will be implemented as a busy wait.
uint8_t ccxSpiInit | ( | void | ) |
Initialise the SPI hardware.
This function will be called when the CC1101 module is initialised. The implementation is expected to preform any necessary configuration, including:
uint8_t ccxSpiPinChipSelectSet | ( | uint8_t | setValue | ) |
Set the state of the Chip Select (CS) line.
[in] | setValue | The desired state of the CS line.
|
uint8_t ccxSpiPinSlaveOutRead | ( | uint8_t * | currentValue | ) |
Read the current state of the Slave Out (SO) line.
[out] | currentValue | The current state of the SO line:
|
The SO line is used to indicate the readiness of the CC1101 to receive commands after the Chip Select line has been used to indicate interaction is desired. It is assumed the hardware implementation can read the state of this line when not immediately transmitting data over SPI.
uint8_t ccxSpiShutdown | ( | void | ) |
Shutdown the SPI hardware.
This will be called when the CC1101 module is shutdown. Depending on the user implementation of the above driver it may never be called.
uint8_t ccxSpiTransaction | ( | uint8_t | address, |
const uint8_t * | writeBytes, | ||
uint8_t | writeLength, | ||
uint8_t * | readBytes, | ||
uint8_t | readLength | ||
) |
Start a SPI transaction to the CC1101, either read or write.
The transaction is expected to be blocking.
[in] | address | The register address. This should be always be sent to the device as the first byte. |
[in] | writeBytes | Array of bytes to write. Length of the array is provided as writeLength . This can be NULL . |
[in] | writeLength | The length of the writeBytes array. This can be 0. |
[out] | readBytes | Array to store read data into. Length of this array is provided as readLength . This can be NULL . |
[out] | readLength | Length of the array readBytes . This can be 0. |
The following depecits some example transfers: