RF24Network Send example program.

Dependencies:   xtoff RF24Network mbed

Fork of RF24Network_Send by Akash Vibhute

Verzender.h

Committer:
pietor
Date:
2018-03-12
Revision:
10:875812a04307
Parent:
9:6d8c0b946259
Child:
11:2aa84e063c49

File content as of revision 10:875812a04307:

#ifndef Verzender_h
#define Verzender_h
#include "mbed.h"
#include <RF24Network.h>
#include <RF24.h>

#define nrf_CE      p9
#define nrf_CSN     p8
#define spi_SCK     p7
#define spi_MOSI    p5
#define spi_MISO    p6

#ifdef PRINT_ENABLE
    #define IF_PRINT_ENABLE(x) ({x;})
    #else
    #define IF_PRINT_ENABLE(x)
    #endif


//Identificatie verzender/ontvanger
const uint16_t this_node = 01;
const uint16_t other_node = 00;

struct payload_t {
    bool reedsensor;
    float milligram;
};

enum State {State_init,
            State_tare,
            State_position,
            State_read,
            State_receive,
            State_calibrate
           };

struct state_Packet {
    State setstate;
};


class Verzender
{
private:


public:
    Verzender();
    
    /**
    Update to receive a message available for this node
    */
    void update();
    
    
    /**
        Send a message to the receiver
    
        @param message of type payload_t
    */
    bool write(payload_t message);
    
    
    /**
    Test whether there is a message available for this node
    */
    bool available();
    
    
    /**
    Read a message to the receiver

    @return message of type state_packet
    */
    state_Packet read();
};

#endif