Add support for joystick adc reading for stm32 MCUs. Fix joystick hid report sending for chibios

This commit is contained in:
a-chol 2020-03-29 15:43:19 +02:00
parent 34bedc3787
commit def06b4976
4 changed files with 15 additions and 11 deletions

View file

@ -25,9 +25,9 @@
{ OUTPUT_PIN, INPUT_PIN, GROUND_PIN, LOW, REST, HIGH }
typedef struct {
uint8_t output_pin;
uint8_t input_pin;
uint8_t ground_pin;
uint32_t output_pin;
uint32_t input_pin;
uint32_t ground_pin;
// the AVR ADC offers 10 bit precision, with significant bits on the higher part
uint16_t min_digit;

View file

@ -1,9 +1,7 @@
#include "joystick.h"
#include "process_joystick.h"
#ifdef __AVR__
# include "analog.h"
#endif
#include "analog.h"
#include <string.h>
#include <math.h>
@ -107,7 +105,7 @@ bool process_joystick_analogread_quantum() {
wait_us(10);
# ifdef __AVR__
# if defined(__AVR__) || defined(PROTOCOL_CHIBIOS)
int16_t axis_val = analogReadPin(joystick_axes[axis_index].input_pin);
# else
// default to resting position