mirror of
https://github.com/eclipse/upm.git
synced 2025-12-16 05:44:32 +03:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user