39enum class State :
unsigned char {
58unsigned char constexpr MIN = 0;
59unsigned char constexpr MAX = 180;
60unsigned char constexpr DELAY = 1;
91 unsigned char const min;
92 unsigned char const max;
182 PServo(
unsigned long *
const timer) : _timer(timer) {}
197 PServo(
unsigned long *
const timer,
bool const is_resetable)
198 : _timer(timer), _is_resetable(is_resetable) {}
217 PServo(
unsigned long *
const timer,
unsigned char const min,
218 unsigned char const max)
219 : _timer(timer), _min(min), _max(max) {}
239 PServo(
unsigned long *
const timer,
unsigned char const min,
240 unsigned char const max,
bool const is_resetable)
241 : _timer(timer), _min(min), _max(max), _is_resetable(is_resetable) {}
325 PServo *
move(
unsigned char const next_pos,
unsigned short const delay);
364 unsigned char pos(
void)
const;
402 unsigned long _pc = 0;
403 unsigned long *
const _timer =
nullptr;
407 bool _is_resetable =
false;
409 unsigned char _curr_action = 0;
410 unsigned char _active_action = 0;
411 unsigned char _actions_count = 0;
412 unsigned char _pos = 0;
415 inline void _reset_active_action_to_start_again(
void);
416 inline void _reset_or_update_and_start_next_action(
void);
PServo(unsigned long *const timer, unsigned char const min, unsigned char const max, bool const is_resetable)
Definition PServo.h:239
Props const props(void) const
Definition PServo.cpp:122
void reset(void)
Definition PServo.cpp:140
unsigned char pos(void) const
Definition PServo.cpp:153
PServo(unsigned long *const timer)
Definition PServo.h:182
PServo * move(unsigned char const next_pos)
Definition PServo.cpp:116
bool is_state(State s) const
Definition PServo.cpp:151
PServo(unsigned long *const timer, bool const is_resetable)
Definition PServo.h:197
State const get_state(void) const
Definition PServo.cpp:149
PServo * begin(void)
Definition PServo.cpp:3
PServo(unsigned long *const timer, unsigned char const min, unsigned char const max)
Definition PServo.h:217
unsigned char constexpr MIN
Minimal default degree position.
Definition PServo.h:58
unsigned char constexpr MAX
Maximum default degree position.
Definition PServo.h:59
unsigned char constexpr DELAY
Default delay between movement updates.
Definition PServo.h:60
char const * state_text(State s)
Definition PServo.cpp:155
State
Definition PServo.h:39
@ ERROR_NOACTION
Any actions was registered since being() (NOOP).
@ ERROR_UNEXPECTED
An unexpected state appeard somewhere (NOOP).
@ ERROR_TIMERPTR
The timer pointer was not defined properly (NOOP).
@ IN_ACTION
Will keep updating the servo's position.
@ PAUSED
No operation, but keep updating the _pc var (NOOP).
@ HALT
No operation, the final action was completed (NOOP).
@ INITIALIZED
Measn that the actions was counted, so start it!
@ STANDBY
Will count each action on this state.
unsigned char active_action
Which action is, actually, performing.
Definition PServo.h:95
unsigned char const max
Maximum position that this machine can be.
Definition PServo.h:92
unsigned char const min
Minimal position that this machine can be.
Definition PServo.h:91
bool const is_resetable
Will the machine reset after it's halted?
Definition PServo.h:93
unsigned char curr_action
Says wich action it's trying to perform.
Definition PServo.h:94
unsigned long pc
Last registered process counter.
Definition PServo.h:89
unsigned char pos
Current servo position, will not be written.
Definition PServo.h:97
State state
Current state of the ps::PServo machine.
Definition PServo.h:88
unsigned char actions_count
How much actions was registred.
Definition PServo.h:96
unsigned long *const timer
Pointer to the timer variable in use.
Definition PServo.h:90
unsigned short delay
Delay stored for the current action move.
Definition PServo.h:98