nrf24l01: added new feature BLE broadcasting with example and new methods to nrf24l01 (setChannel, setPower, etc... )

Signed-off-by: Kiveisha Yevgeniy <yevgeniy.kiveisha@intel.com>
This commit is contained in:
Kiveisha Yevgeniy
2014-09-10 18:55:16 +00:00
parent 4aa51c0edb
commit 81e1fd281c
6 changed files with 656 additions and 306 deletions

View File

@@ -29,7 +29,10 @@
#include <signal.h>
int running = 0;
upm::NRF24l01 *comm = NULL;
upm::NRF24L01 *comm = NULL;
uint8_t destAddress[5] = {0x01, 0x01, 0x01, 0x01, 0x02};
uint8_t srcAddress[5] = {0x01, 0x01, 0x01, 0x01, 0x01};
void
sig_handler(int signo)
@@ -49,18 +52,19 @@ main(int argc, char **argv)
{
//! [Interesting]
uint32_t dummyData = 0;
comm = new upm::NRF24l01(7);
comm->nrfSetRXaddr ((uint8_t *) "devi2");
comm->nrfSetTXaddr ((uint8_t *) "devi1");
comm->nrfSetPayload (MAX_BUFFER);
comm->nrfConfigModule ();
comm = new upm::NRF24L01(7, 8);
comm->setSourceAddress ((uint8_t *) srcAddress);
comm->setDestinationAddress ((uint8_t *) destAddress);
comm->setPayload (MAX_BUFFER);
// comm->setChannel (99);
comm->configure ();
comm->dataRecievedHandler = nrf_handler;
signal(SIGINT, sig_handler);
while (!running) {
memcpy (comm->m_txBuffer, &dummyData, sizeof (dummyData));
comm->nrfSend ();
comm->send ();
std::cout << "devi2 :: sending data ...." << dummyData << std::endl;
usleep (3000000);
dummyData += 3000;