Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
common.h
- Committer:
- pannaannap
- Date:
- 2017-01-05
- Revision:
- 4:aa25f65395e3
- Parent:
- 2:6541a391bdbd
- Child:
- 5:fbd5b1e953e6
File content as of revision 4:aa25f65395e3:
#include <stdint.h> #include <string> #include "nRF24L01P.h" #define DATA_RATE NRF24L01P_DATARATE_250_KBPS #define POWER NRF24L01P_TX_PWR_ZERO_DB #define CHANNEL 2 #define TRANSFER_SIZE 32 const unsigned long long MASTER_ADDRESS = 0xABCDEF00; const unsigned long long PIR1_ADDRESS = 0xABCDEF01; const unsigned long long PIR2_ADDRESS = 0xABCDEF02; const unsigned long long DISTANCE_SENSOR_ADDRESS = 0xABCDEF02; const unsigned long long SOUND_SENSOR_ADDRESS = 0xABCDEF03; enum SENSOR_TYPE { PIR1 = 1, PIR2 = 2, DISTANCE = 3, SOUND = 4, }; struct Data { Data(uint8_t type_, uint8_t counter_) : type(type_), counter(counter_) {} // TODO correct? Data(std::string serialized) : type(serialized[0]), counter(serialized[1]) {} std::string serialize(); uint8_t type; uint8_t counter; }; void radio_init(nRF24L01P* radio, unsigned long long rx_address, unsigned long long tx_address);