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.
Diff: common.h
- Revision:
- 54:2551a3c781cf
- Parent:
- 52:917b3f31cad3
- Parent:
- 51:090149c4aa28
- Child:
- 56:065bd3a75d97
--- a/common.h Thu Jan 19 01:14:28 2017 +0100
+++ b/common.h Thu Jan 19 01:23:07 2017 +0100
@@ -3,20 +3,25 @@
#include <sstream>
#include <stdint.h>
+#include <vector>
#include <string>
#include "nRF24L01P.h"
#include "mbed.h"
-#define DATA_RATE NRF24L01P_DATARATE_250_KBPS
+#define DATA_RATE NRF24L01P_DATARATE_250_KBPS
#define POWER NRF24L01P_TX_PWR_ZERO_DB
#define CHANNEL 2
#define TRANSFER_SIZE 32
+// STUPID LEGACY, DON'T USE
const unsigned long long MASTER_ADDRESS = 0xBACDFF00;
const unsigned long long BOARD1_ADDRESS = 0xBACDFF01;
const unsigned long long BOARD2_ADDRESS = 0xBACDFF02;
const unsigned long long BOARD3_ADDRESS = 0xBACDFF03;
+extern const int pipes[];
+extern const unsigned long long addresses[];
+
enum SENSOR_TYPE {
PIR1 = 1,
PIR2 = 2,
@@ -38,10 +43,10 @@
{
value.i = 0;
}
-
+
std::string serialize();
bool deserialize(std::string str);
-
+
uint8_t type;
union {
int32_t i;
@@ -51,7 +56,7 @@
std::string str_hex(const char* text, int len);
-void radio_init(nRF24L01P* radio, unsigned long long rx_address,
- unsigned long long tx_address);
+void radio_init_sensor_board(nRF24L01P* radio, unsigned long long tx_address);
+void radio_init_master(nRF24L01P* radio, const std::vector<unsigned long long> &rx_addresses);
#endif /* JNP3_COMMON */