Fixup Pimoroni trackball code (#17335)

This commit is contained in:
jack 2022-06-09 11:09:00 -06:00 committed by GitHub
parent 0ab51ee29d
commit d2abfaeacd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 14 deletions

View file

@ -95,16 +95,3 @@ int16_t pimoroni_trackball_get_offsets(uint8_t negative_dir, uint8_t positive_di
uint16_t magnitude = (scale * offset * offset * precision) >> 7; uint16_t magnitude = (scale * offset * offset * precision) >> 7;
return isnegative ? -(int16_t)(magnitude) : (int16_t)(magnitude); return isnegative ? -(int16_t)(magnitude) : (int16_t)(magnitude);
} }
void pimoroni_trackball_adapt_values(int8_t* mouse, int16_t* offset) {
if (*offset > 127) {
*mouse = 127;
*offset -= 127;
} else if (*offset < -127) {
*mouse = -127;
*offset += 127;
} else {
*mouse = *offset;
*offset = 0;
}
}

View file

@ -52,7 +52,6 @@ typedef struct {
void pimoroni_trackball_device_init(void); void pimoroni_trackball_device_init(void);
void pimoroni_trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white); void pimoroni_trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white);
int16_t pimoroni_trackball_get_offsets(uint8_t negative_dir, uint8_t positive_dir, uint8_t scale); int16_t pimoroni_trackball_get_offsets(uint8_t negative_dir, uint8_t positive_dir, uint8_t scale);
void pimoroni_trackball_adapt_values(int8_t* mouse, int16_t* offset);
uint16_t pimoroni_trackball_get_cpi(void); uint16_t pimoroni_trackball_get_cpi(void);
void pimoroni_trackball_set_cpi(uint16_t cpi); void pimoroni_trackball_set_cpi(uint16_t cpi);
i2c_status_t read_pimoroni_trackball(pimoroni_data_t* data); i2c_status_t read_pimoroni_trackball(pimoroni_data_t* data);