in d mix

Dependencies:   xtoff2 RF24Network mbed

Fork of RF24Network_Receive by Akash Vibhute

Committer:
pietor
Date:
Thu Mar 08 09:23:20 2018 +0000
Revision:
9:e14f65b8ffc2
Parent:
8:c43411433ce1
Child:
10:0a4c465f7838
8/03

Who changed what in which revision?

UserRevisionLine numberNew 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 9:e14f65b8ffc2 16
pietor 8:c43411433ce1 17
pietor 8:c43411433ce1 18
pietor 4:7ebc3b421306 19
pietor 7:8515f205483b 20 struct payload_t {
pietor 4:7ebc3b421306 21 bool reedsensor;
pietor 8:c43411433ce1 22 float milligram;
pietor 4:7ebc3b421306 23 };
pietor 4:7ebc3b421306 24
pietor 8:c43411433ce1 25 enum State2 {init_state,
pietor 8:c43411433ce1 26 send_state,
pietor 8:c43411433ce1 27 receive_state
pietor 8:c43411433ce1 28 };
pietor 8:c43411433ce1 29
pietor 7:8515f205483b 30 enum State {State_init,
pietor 7:8515f205483b 31 State_tare,
pietor 7:8515f205483b 32 State_position,
pietor 7:8515f205483b 33 State_read,
pietor 7:8515f205483b 34 State_send,
pietor 7:8515f205483b 35 State_receive
pietor 7:8515f205483b 36 };
pietor 7:8515f205483b 37
pietor 7:8515f205483b 38 struct state_Packet {
pietor 7:8515f205483b 39 State setState;
pietor 7:8515f205483b 40 };
pietor 4:7ebc3b421306 41
pietor 4:7ebc3b421306 42
pietor 4:7ebc3b421306 43 class Ontvanger
pietor 4:7ebc3b421306 44 {
pietor 4:7ebc3b421306 45 private:
pietor 4:7ebc3b421306 46
pietor 4:7ebc3b421306 47
pietor 4:7ebc3b421306 48 public:
pietor 4:7ebc3b421306 49 Ontvanger();
pietor 4:7ebc3b421306 50 void update();
pietor 4:7ebc3b421306 51 bool available();
pietor 7:8515f205483b 52 bool write(state_Packet message);
pietor 4:7ebc3b421306 53 payload_t read();
pietor 4:7ebc3b421306 54 };
pietor 4:7ebc3b421306 55
pietor 4:7ebc3b421306 56 #endif
pietor 4:7ebc3b421306 57
pietor 4:7ebc3b421306 58
pietor 4:7ebc3b421306 59
pietor 4:7ebc3b421306 60
pietor 4:7ebc3b421306 61