-
Notifications
You must be signed in to change notification settings - Fork 4
/
RxCommandParser.hpp
71 lines (50 loc) · 1.28 KB
/
RxCommandParser.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef __RX_COMMAND_PARSER_HPP
#define __RX_COMMAND_PARSER_HPP
#include "mbed.h"
#include "rtos.h"
#include "EthernetInterface.h"
#include "ROBOT_CONFIG.hpp"
class RxCommandParser {
public:
RxCommandParser(EthernetInterface*);
void Start();
uint16_t auto_ch1 = 1024;
uint16_t auto_ch2 = 1024;
void setRelay(bool value);
bool timeout;
private:
UDPSocket *_rx_sock; // one, single thread for RX
Thread main_thread;
void main_worker();
// External servos/switches:
#ifdef USER_DIGITAL_OUT_0
DigitalOut *user_dout_0;
#endif // USER_DIGITAL_OUT_0
// USER_PWM_OUT assumes a pulse-width in percentages
#ifdef USER_PWM_OUT_0
PwmOut *user_pout_0;
#endif // USER_PWM_OUT_0
#ifdef USER_PWM_OUT_1
PwmOut *user_pout_1;
#endif // USER_PWM_OUT_1
#ifdef USER_PWM_OUT_2
PwmOut *user_pout_2;
#endif // USER_PWM_OUT_2
#ifdef USER_PWM_OUT_3
PwmOut *user_pout_3;
#endif // USER_PWM_OUT_3
// USER_SERVO_OUT assumes a Futaba-style pulse-width in micro-seconds
#ifdef USER_SERVO_OUT_0
PwmOut *user_servo_0;
#endif // USER_SERVO_OUT_0
#ifdef USER_SERVO_OUT_1
PwmOut *user_servo_1;
#endif // USER_SERVO_OUT_1
#ifdef USER_SERVO_OUT_2
PwmOut *user_servo_2;
#endif // USER_SERVO_OUT_2
#ifdef USER_SERVO_OUT_3
PwmOut *user_servo_3;
#endif // USER_SERVO_OUT_3
};
#endif // __RX_COMMAND_PARSER_HPP