MakeBlock Drive Updated Updated library for MakeBlock Ranger

Loading...
Searching...
No Matches
MeJoystick.h
Go to the documentation of this file.
1
44#ifndef MeJoystick_H
45#define MeJoystick_H
46
47#include <stdint.h>
48#include <stdbool.h>
49#include <Arduino.h>
50#include "MeConfig.h"
51
52#ifdef ME_PORT_DEFINED
53#include "MePort.h"
54#endif // ME_PORT_DEFINED
55
56#define CENTER_VALUE (490)
57
63#ifndef ME_PORT_DEFINED
64 class MeJoystick
65#else // !ME_PORT_DEFINED
66class MeJoystick : public MePort
67#endif
68{
69 public:
70#ifdef ME_PORT_DEFINED
77 MeJoystick(void);
78
84 MeJoystick(uint8_t port);
85#else // ME_PORT_DEFINED
94 MeJoystick(uint8_t x_port,uint8_t y_port);
95#endif // ME_PORT_DEFINED
96
113 void setpin(uint8_t x_port, uint8_t y_port);
114
127 int16_t readX(void);
128
141 int16_t readY(void);
142
157 int16_t read(uint8_t index);
158
176 void CalCenterValue(int16_t = 0, int16_t = 0);
177
190 float angle(void);
191
204 float OffCenter(void);
205 private:
206 static volatile int16_t _X_offset;
207 static volatile int16_t _Y_offset;
208 static volatile uint8_t _X_port;
209 static volatile uint8_t _Y_port;
210};
211#endif
MeConfig.h
Configuration file of library.
MePort.h
Header for MePort.cpp module.
MeJoystick
Driver for Me Joystick module.
Definition MeJoystick.h:68
MeJoystick::readX
int16_t readX(void)
Definition MeJoystick.cpp:125
MeJoystick::readY
int16_t readY(void)
Definition MeJoystick.cpp:149
MeJoystick::MeJoystick
MeJoystick(void)
Definition MeJoystick.cpp:59
MeJoystick::setpin
void setpin(uint8_t x_port, uint8_t y_port)
Definition MeJoystick.cpp:103
MeJoystick::read
int16_t read(uint8_t index)
Definition MeJoystick.cpp:175
MeJoystick::OffCenter
float OffCenter(void)
Definition MeJoystick.cpp:271
MeJoystick::CalCenterValue
void CalCenterValue(int16_t=0, int16_t=0)
Definition MeJoystick.cpp:216
MeJoystick::angle
float angle(void)
Definition MeJoystick.cpp:234
MePort
Port Mapping for RJ25.
Definition MePort.h:128