Nintendo R.O.B. Control Library  v1.1.2
Library to control the Nintendo Robotic Operating Buddy
NesRob.h
Go to the documentation of this file.
1 #ifndef NES_ROB_H
2 #define NES_ROB_H
3 
4 #include <stdint.h>
5 
6 namespace nes { namespace rob {
7 
8 class PulseDriver;
9 class SignalGenerator;
10 class HardwareAbstractionLayer;
11 
12 }} // namespace nes::rob
13 
19 class NesRob {
20  public:
24  enum class Command : uint8_t {
25  LEFT = 0xBA,
26  RIGHT = 0xEA,
27  DOWN = 0xAE,
28  DOWN_2 = 0xFB,
29  UP = 0xFA,
30  UP_2 = 0xBB,
31  CLOSE = 0xBE,
32  OPEN = 0xEE,
33  LED_DISABLE = 0xAA,
34  LED_ENABLE = 0xEB,
35  RECALIBRATE = 0xAB,
36 #if __cplusplus > 201103L
37  CALIBRATE_MOTORS [[deprecated("Use RECALIBRATE instead.")]] = 0xAB,
38  ARMS_LEFT [[deprecated("Use LEFT instead.")]] = 0xBA,
39  ARMS_RIGHT [[deprecated("Use RIGHT instead.")]] = 0xEA,
40  ARMS_LOWER [[deprecated("Use DOWN instead.")]] = 0xAE,
41  ARMS_LOWER_2 [[deprecated("Use DOWN_2 instead.")]] = 0xFB,
42  ARMS_RAISE [[deprecated("Use UP instead.")]] = 0xFA,
43  ARMS_RAISE_2 [[deprecated("Use UP_2 instead.")]] = 0xBB,
44  HANDS_CLOSE [[deprecated("Use CLOSE instead.")]] = 0xBE,
45  HANDS_OPEN [[deprecated("Use OPEN instead.")]] = 0xEE,
46  TEST_LED [[deprecated("Use LED_ENABLE instead.")]] = 0xEB,
47 #else
48  CALIBRATE_MOTORS = 0xAB,
49  ARMS_LEFT = 0xBA,
50  ARMS_RIGHT = 0xEA,
51  ARMS_LOWER = 0xAE,
52  ARMS_LOWER_2 = 0xFB,
53  ARMS_RAISE = 0xFA,
54  ARMS_RAISE_2 = 0xBB,
55  HANDS_CLOSE = 0xBE,
56  HANDS_OPEN = 0xEE,
57  TEST_LED = 0xEB,
58 #endif
59  };
60 
70  enum class CommandTarget {
71  PHOTOSENSOR,
72  MAIN_CPU,
73  };
74 
78  enum class ErrorCode : int {
79  SUCCESS = 0,
80  E_SIGGEN,
81  };
82 
95  NesRob (unsigned int pin, CommandTarget target = CommandTarget::PHOTOSENSOR);
96 
100  ~NesRob (void);
101 
124 #if __cplusplus > 201103L
125  [[deprecated("Use sendCommand() instead.")]]
126 #endif
127  void blinkCommand(Command command) const;
128 
154  int sendCommand(Command command) const;
155 
156  private:
158  nes::rob::PulseDriver * const _pulse_driver;
159  nes::rob::SignalGenerator * const _signal_generator;
160 };
161 
162 #endif // NES_ROB_H
Nintendo R.O.B. Control Library.
Definition: NesRob.h:19
int sendCommand(Command command) const
Send command to R.O.B.
Definition: NesRob_Arduino.cpp:40
void blinkCommand(Command command) const
Blink command to R.O.B.
Definition: NesRob_Arduino.cpp:33
CommandTarget
Valid targets for commands.
Definition: NesRob.h:70
Command
Available R.O.B. Commands.
Definition: NesRob.h:24
ErrorCode
Error codes.
Definition: NesRob.h:78
NesRob(unsigned int pin, CommandTarget target=CommandTarget::PHOTOSENSOR)
Allocate required resources.
Definition: NesRob_Arduino.cpp:10
~NesRob(void)
Destroy allocated resources.
Definition: NesRob_Arduino.cpp:24
The hardware abstraction layer interface.
Definition: hardware_abstraction_layer.hpp:14
The pulse driver interface.
Definition: pulse_driver.hpp:14
Generate signals for the R.O.B. protocol.
Definition: signal_generator.hpp:16
Definition: arduino_debug_driver.hpp:6