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