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.
Dependencies: xtoff RF24Network mbed
Fork of RF24Network_Send by
Verzender.h@6:03ba3e18ced2, 2018-02-21 (annotated)
- Committer:
- pietor
- Date:
- Wed Feb 21 12:09:12 2018 +0000
- Revision:
- 6:03ba3e18ced2
- Parent:
- 5:e6067799a414
- Child:
- 7:cbdbaf825b4a
Case;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| pietor | 5:e6067799a414 | 1 | #ifndef Verzender_h |
| pietor | 5:e6067799a414 | 2 | #define Verzender_h |
| pietor | 5:e6067799a414 | 3 | #include "mbed.h" |
| pietor | 5:e6067799a414 | 4 | #include <RF24Network.h> |
| pietor | 5:e6067799a414 | 5 | #include <RF24.h> |
| pietor | 5:e6067799a414 | 6 | |
| pietor | 5:e6067799a414 | 7 | #define nrf_CE p9 |
| pietor | 5:e6067799a414 | 8 | #define nrf_CSN p8 |
| pietor | 5:e6067799a414 | 9 | #define spi_SCK p7 |
| pietor | 5:e6067799a414 | 10 | #define spi_MOSI p5 |
| pietor | 5:e6067799a414 | 11 | #define spi_MISO p6 |
| pietor | 5:e6067799a414 | 12 | |
| pietor | 5:e6067799a414 | 13 | const uint16_t this_node = 01; |
| pietor | 5:e6067799a414 | 14 | const uint16_t other_node = 00; |
| pietor | 5:e6067799a414 | 15 | const unsigned long interval = 100; //ms |
| pietor | 5:e6067799a414 | 16 | |
| pietor | 5:e6067799a414 | 17 | |
| pietor | 5:e6067799a414 | 18 | struct payload_t { |
| pietor | 5:e6067799a414 | 19 | bool reedsensor; |
| pietor | 5:e6067799a414 | 20 | int milligram; |
| pietor | 5:e6067799a414 | 21 | }; |
| pietor | 5:e6067799a414 | 22 | |
| pietor | 6:03ba3e18ced2 | 23 | enum State {State_init, |
| pietor | 6:03ba3e18ced2 | 24 | State_tare, |
| pietor | 6:03ba3e18ced2 | 25 | State_position, |
| pietor | 6:03ba3e18ced2 | 26 | State_read, |
| pietor | 6:03ba3e18ced2 | 27 | State_send, |
| pietor | 6:03ba3e18ced2 | 28 | State_receive |
| pietor | 6:03ba3e18ced2 | 29 | }; |
| pietor | 6:03ba3e18ced2 | 30 | |
| pietor | 6:03ba3e18ced2 | 31 | struct state_Packet { |
| pietor | 6:03ba3e18ced2 | 32 | State setstate; |
| pietor | 6:03ba3e18ced2 | 33 | }; |
| pietor | 6:03ba3e18ced2 | 34 | |
| pietor | 6:03ba3e18ced2 | 35 | |
| pietor | 5:e6067799a414 | 36 | class Verzender |
| pietor | 5:e6067799a414 | 37 | { |
| pietor | 5:e6067799a414 | 38 | private: |
| pietor | 5:e6067799a414 | 39 | |
| pietor | 5:e6067799a414 | 40 | |
| pietor | 5:e6067799a414 | 41 | public: |
| pietor | 5:e6067799a414 | 42 | Verzender(); |
| pietor | 5:e6067799a414 | 43 | void update(); |
| pietor | 5:e6067799a414 | 44 | bool write(payload_t message); |
| pietor | 6:03ba3e18ced2 | 45 | bool available(); |
| pietor | 6:03ba3e18ced2 | 46 | state_Packet read(); |
| pietor | 5:e6067799a414 | 47 | }; |
| pietor | 5:e6067799a414 | 48 | |
| pietor | 5:e6067799a414 | 49 | #endif |
| pietor | 5:e6067799a414 | 50 | |
| pietor | 5:e6067799a414 | 51 | |
| pietor | 5:e6067799a414 | 52 | |
| pietor | 5:e6067799a414 | 53 | |
| pietor | 5:e6067799a414 | 54 |
