Some time ago I did the first implementation of this component: Component-made-from-nrf24 PSoC but it had a lot of improvement opportunities so I started this new version!.
OverviewThe new component provide the API to control the nRF24 radio, the user should provide the SPI Master and a couple of digital output pins to control the radio on the project schematic. This have two advantages over to the first implementation of the component:
- The possibility to use the same nRF24 component with all PSoC families, with SPI Masters based on UDB and SCB blocks.
- Use the same SPI Master to control other SPI Slaves.
It also provides a basic customizer, for those not familiar with the PSoC IDE the customizer is a configuration window, which allow you to configure most of the radio registers with help of a graphic interface.
Below you can see the nRF24 customizer, in the nRF Configuration tab you set the configuration of (most) the radio registers.
The customizer also warn you when a feature need other options to be enabled. In the image below the customizer warns the user who wants to use the Dynamic Payload on the nRF24 pipe 0 without enabling the Dynamic Payload on the Feature register.
The SPI Interface (looking for a better name) tab is to set the name of the SPI Master which will transfer data to/from the radio and also the name of the /SS (nRF24 Slave Select) and CE pins needed to interface the PSoC and the nRF24.
Once you generate the project API you can use it in your main function, below a little example:
#include "project.h"
#include <stdbool.h>
int main(void)
{
CyGlobalIntEnable;
// nRF24 TX Address
const uint8_t TX_ADDR[5]= {0xBA, 0xAD, 0xC0, 0xFF, 0xEE};
// Data to send
const uint8_t data[4] = {0xDE, 0xAD, 0xBE, 0xEF};
// nRF24_start write the configuration from the customizer to the nRF24 registers
nRF24_start();
// Set the address of the TX pipe
nRF24_setTxAddress(TX_ADDR, 5);
// Transmit the data buffer
nRF24_txTransmit(&data, 4);
while (1) {
}
}
Where can I get the component?The component have it's own GitHub repository: nRF24_Component.
Clone it, add it to your project dependencies and it's ready to use!
You can also contribute to the component, report bugs, asking for missing features, adding features, improving the API and documentation, etc.
How do I use it?Few example projects are available on the following GitHub repository: nRF24_Example_Projects.
You can also help adding examples to the repo.
TODO- Datasheet
- Adding a proper customizer is one of the improvements I want to add but I can't build it yet, there's not a lot of examples on how to add a customizer to custom components using Visual Studio.
Comments