STM32-X360-xinput
STM32-X360-xinput copied to clipboard
adc value
if( adcValueReady == 1 ){
rightTriggerValue = (uint8_t)map( rightTriggerValue_ADC, 0, 4096, 0, UINT8_MAX );
leftTriggerValue = (uint8_t)map( leftTriggerValue_ADC, 0, 4096, 0, UINT8_MAX );
xRightStickValue = (int16_t)map( xRightStickValue_ADC, 0, 4096, INT16_MIN, INT16_MAX );
yRightStickValue = (int16_t)map( yRightStickValue_ADC, 0, 4096, INT16_MIN, INT16_MAX ); // 4040 is the max value that my adc presents with potentiometers
xLeftStickValue = (int16_t)map( xLeftStickValue_ADC, 0, 4096, INT16_MIN, INT16_MAX );
yLeftStickValue = (int16_t)map( yLeftStickValue_ADC, 0, 4096, INT16_MIN, INT16_MAX );
adcValueReady = 0;
the ADC Value reports as 4096 on my setup, 4040 causes rolls