rcProtocol  V.0.3.0
A protocol for diy transmitters/receivers
rcDeviceProtocol.h
Go to the documentation of this file.
1 /*
2  rcDeviceProtocol.h - Library for Device for RCProtocol.
3  Created by Benjamin Jacobs, October 2, 2017
4 */
5 
6 #ifndef __RCDEVICEPROTOCOL_H__
7 #define __RCDEVICEPROTOCOL_H__
8 
9 #include <RF24.h>
10 
11 #include "rcSettings.h"
12 #include "rcGlobal.h"
13 
14 #ifndef __RF24_H__
15 #error "rcDeviceProtocol Requires the tmrh20 RF24 Library: https://github.com/nRF24/RF24"
16 #endif
17 
18 //Userdefined Constants
19 //Global constants can be found in rcGlobal.h
20 
21 //Error Constants
22 //Global constatns can be found in rcGlobal.h
23 
28 public:
38  typedef void (saveRemoteID)(const uint8_t* id);
46  typedef void (loadRemoteID)(uint8_t* id);
54  typedef bool (checkConnected)();
63  typedef void (setConnected)(bool connected);
64 
75  DeviceProtocol(RF24* tranceiver, const uint8_t deviceId[]);
76 
96 
110 
116  bool isConnected();
117 
136 
152  int8_t update(uint16_t channels[], uint8_t telemetry[],
154 
161 private:
162 
163  const uint8_t* _deviceId;
164  uint8_t _remoteId[5];
165  bool _isConnected;
166 
167 
181  int8_t check_packet(void* returnData, uint8_t dataSize, void* telemetry,
182  uint8_t telemetrySize);
183  int8_t check_packet(void* returnData, uint8_t dataSize);
184 
185 };
186 
187 #endif
DeviceProtocol(RF24 *tranceiver, const uint8_t deviceId[])
int8_t connect(loadRemoteID loadRemoteID, setConnected setConnected)
int8_t pair(saveRemoteID saveRemoteID)
void() setConnected(bool connected)
void() loadRemoteID(uint8_t *id)
RCSettings * getSettings()
int8_t update(uint16_t channels[], uint8_t telemetry[], setConnected setConnected)
void() saveRemoteID(const uint8_t *id)
bool() checkConnected()
int8_t begin(RCSettings *settings, checkConnected checkConnected, loadRemoteID loadRemoteID)