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.
Revision 34:e67581c9b50d, committed 2017-01-17
- Comitter:
- sbarzowski
- Date:
- Tue Jan 17 11:44:16 2017 +0100
- Parent:
- 33:d3cc00e39e6a
- Child:
- 35:0f01042765d6
- Child:
- 37:1251e35fe43e
- Child:
- 40:40d4161fe1ad
- Commit message:
- More trailing whitespace
Changed in this revision
--- a/master.cpp Tue Jan 17 11:39:59 2017 +0100
+++ b/master.cpp Tue Jan 17 11:44:16 2017 +0100
@@ -8,7 +8,7 @@
Serial pc(USBTX, USBRX); // tx, rx
Serial wifi(PA_9, PA_10);
nRF24L01P radio(PB_15, PB_14, PB_13, PB_12, PB_1, PB_2); // mosi, miso, sck, csn, ce, irq
-
+
const unsigned long long RX_ADDRESS = MASTER_ADDRESS;
const unsigned long long TX_ADDRESS = BOARD1_ADDRESS;
@@ -16,9 +16,9 @@
pc.baud(115200);
wifi.baud(115200);
-
+
radio_init(&radio, RX_ADDRESS, TX_ADDRESS);
-
+
// Display the (default) setup of the nRF24L01+ chip
pc.printf( "nRF24L01+ Frequency : %d MHz\r\n", radio.getRfFrequency() );
pc.printf( "nRF24L01+ Output power : %d dBm\r\n", radio.getRfOutputPower() );
@@ -37,7 +37,7 @@
if(radio.readable(NRF24L01P_PIPE_P1)){
int rx_bytes = radio.read(NRF24L01P_PIPE_P1, rxData, sizeof(rxData));
std::stringstream ss;
-
+
for (int i = 0; i < rx_bytes; ++i) {
ss << std::hex << rxData[i] / 16 << rxData[i] % 16; // ugly!
}
--- a/sensor.h Tue Jan 17 11:39:59 2017 +0100
+++ b/sensor.h Tue Jan 17 11:44:16 2017 +0100
@@ -3,11 +3,11 @@
class Sensor {
public:
explicit Sensor(SENSOR_TYPE id);
-
+
virtual void updateState() = 0;
virtual Data dataToSend() = 0;
virtual void resetState() = 0;
-
+
protected:
SENSOR_TYPE sensor_id_;
};
@@ -15,11 +15,11 @@
class DigitalSensor: public Sensor {
public:
explicit DigitalSensor(SENSOR_TYPE id, PinName pin=PA_10);
-
+
virtual void updateState();
virtual Data dataToSend();
virtual void resetState();
-
+
static const float SEND_INTERVAL;
private:
DigitalIn sensor_;
@@ -30,12 +30,12 @@
class AnalogSensor: public Sensor {
public:
explicit AnalogSensor(SENSOR_TYPE id, PinName pin=PA_4);
-
+
virtual void updateState();
virtual Data dataToSend();
virtual void resetState();
-
+
static const float SEND_INTERVAL;
private:
AnalogIn sensor_;
-};
\ No newline at end of file
+};
--- a/sensor_board.h Tue Jan 17 11:39:59 2017 +0100
+++ b/sensor_board.h Tue Jan 17 11:44:16 2017 +0100
@@ -6,9 +6,9 @@
public:
explicit Board(unsigned long long rx_address, DigitalSensor* digital_sensor,
AnalogSensor* analog_sensor, unsigned long long tx_address=MASTER_ADDRESS);
-
+
void run();
-
+
static const int MAX_RETRY;
private:
int getRandomWaitMs();
@@ -16,11 +16,11 @@
void displayRadioSetup();
bool send(Data data_to_send);
void updateSensor(Sensor* sensor, bool* should_send_data);
-
+
Serial pc_;
nRF24L01P radio_;
AnalogSensor* analog_sensor_;
DigitalSensor* digital_sensor_;
Ticker analog_ticker_;
Ticker digital_ticker_;
-};
\ No newline at end of file
+};