in d mix

Dependencies:   xtoff2 RF24Network mbed

Fork of RF24Network_Receive by Akash Vibhute

Committer:
pietor
Date:
Thu Feb 22 14:08:11 2018 +0000
Revision:
8:c43411433ce1
Parent:
7:8515f205483b
Child:
9:e14f65b8ffc2
Werken 22.02;

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