123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #pragma once
- #include <stdbool.h>
- #include <stdint.h>
- #ifndef ANALOG_JOYSTICK_X_AXIS_PIN
- # error No pin specified for X Axis
- #endif
- #ifndef ANALOG_JOYSTICK_Y_AXIS_PIN
- # error No pin specified for Y Axis
- #endif
- #ifndef ANALOG_JOYSTICK_AXIS_MIN
- # define ANALOG_JOYSTICK_AXIS_MIN 0
- #endif
- #ifndef ANALOG_JOYSTICK_AXIS_MAX
- # define ANALOG_JOYSTICK_AXIS_MAX 1023
- #endif
- #ifndef ANALOG_JOYSTICK_SPEED_REGULATOR
- # define ANALOG_JOYSTICK_SPEED_REGULATOR 20
- #endif
- #ifndef ANALOG_JOYSTICK_READ_INTERVAL
- # define ANALOG_JOYSTICK_READ_INTERVAL 10
- #endif
- #ifndef ANALOG_JOYSTICK_SPEED_MAX
- # define ANALOG_JOYSTICK_SPEED_MAX 2
- #endif
- typedef struct {
- int8_t x;
- int8_t y;
- bool button;
- } report_analog_joystick_t;
- report_analog_joystick_t analog_joystick_read(void);
- void analog_joystick_init(void);
|