Bind
C++ UI toolkit for Arduino
 
Loading...
Searching...
No Matches
BindJoystick.hpp
1#ifndef __BINDJOYSTICK_HPP
2#define __BINDJOYSTICK_HPP
3#include "BindView.hpp"
4#include "BindUtils.hpp"
55class BindJoystick : public BindView
56{
57
58public:
59 int16_t x = 0;
60 int16_t y = 0;
61 uint8_t cmdId = 0;
62 int16_t dimSize = 200;
63 int16_t sX = 0;
64 int16_t sY = 0;
65 bool springed = true;
66
75 uint16_t getBytes(uint8_t *out) override
76 {
77 offset = 0;
78 copyAndOffset(out, &offset, &objID, sizeof(objID));
79 copyAndOffset(out, &offset, &x, sizeof(x));
80 copyAndOffset(out, &offset, &y, sizeof(y));
81 copyAndOffset(out, &offset, &tag, sizeof(tag));
82 copyAndOffset(out, &offset, &cmdId, sizeof(cmdId));
83 copyAndOffset(out, &offset, &dimSize, sizeof(dimSize));
84 copyAndOffset(out, &offset, &springed, sizeof(springed));
85 return offset;
86 }
87
88private:
89 uint8_t objID = BIND_ID_JOYSTICK;
90 uint16_t offset = 0;
91};
92
93#endif /* __BINDJOYSTICK_HPP */
BindJoystick Class.
Definition BindJoystick.hpp:56
int16_t sX
The joystick's current X-axis position (internal).
Definition BindJoystick.hpp:63
int16_t y
The y-coordinate position of the joystick on the screen.
Definition BindJoystick.hpp:60
int16_t x
The x-coordinate position of the joystick on the screen.
Definition BindJoystick.hpp:59
int16_t dimSize
The dimensions (size) of the joystick.
Definition BindJoystick.hpp:62
uint8_t cmdId
Command identifier to add or refresh the joystick. See the notes for possible cmdId values.
Definition BindJoystick.hpp:61
bool springed
Indicates whether the joystick returns to the center automatically when released.
Definition BindJoystick.hpp:65
uint16_t getBytes(uint8_t *out) override
Serialize the joystick object into bytes.
Definition BindJoystick.hpp:75
int16_t sY
The joystick's current Y-axis position (internal).
Definition BindJoystick.hpp:64
Definition BindView.hpp:22