BayEOSArduino Library
BaySerialRF24.h
1 /*
2  * This is an alternativ for sending BayEOS-Frames over RF24 using the BaySerial protocol
3  *
4  * BaySerial layer is on top of RF24
5  * We have additional checksum and no limitation to 32 byte as for simple RF24
6  * The receiver sends a acknowlege to the sender via RF24. This is done by the
7  *
8  * The frames look like this:
9  * [NR][ --- DATA ----]
10  *
11  * NR incremented to avoid duplicated RF24-RX
12  * DATA of new frames are copied to the buffer
13  *
14  */
15 
16 
17 #ifndef BaySerialRF24_h
18 #define BaySerialRF24_h
19 
20 #include <BaySerial.h>
21 #include <RF24.h>
22 
24 private:
25  void stopListenMode();
26  void startListenMode();
27 protected:
28  RF24* _radio; //Pointer to existing radio!!
29  uint8_t buffer[32];
30  uint8_t read_pos;
31  uint8_t write_pos;
32  uint8_t length;
33  uint8_t _flush_size;
34  uint8_t _r_counter;
35  uint8_t _w_counter;
36  bool _send_timeout;
37 public:
41  BaySerialRF24(RF24& radio,int timeout=1000,uint8_t retries=1);
42 
43  int available(void);
44  int i_available(void);
45  void begin(long baud);
46  void init(uint8_t ch, uint8_t *adr, uint8_t flush_size=12);
47  void flush(void);
48  void end(void);
49  int read(void);
50  size_t write(uint8_t c);
51  unsigned long last_activity;
52  bool connected;
53  /*
54  * Send one byte to check if a receiver is present
55  * sets connected
56  */
57  void sendTestByte(uint8_t led=LED_BUILTIN);
58 
59 };
60 
61 
62 
63 
64 #endif
Definition: BaySerial.h:45
Definition: BaySerialRF24.h:23
int available(void)
Definition: BaySerialRF24.cpp:9
BaySerialRF24(RF24 &radio, int timeout=1000, uint8_t retries=1)
Definition: BaySerialRF24.cpp:3