1
0

I2C driver cleanup (#21273)

* remove i2c_start and i2c_stop from i2c drivers

* remove static i2c_address variable from chibios i2c driver
This commit is contained in:
David Hoelscher
2024-01-17 07:05:38 -06:00
committed by GitHub
parent 2b0965944d
commit e9bd7d7ad3
49 changed files with 280 additions and 603 deletions

View File

@@ -38,7 +38,7 @@ static uint16_t i2c_timeout_timer;
void trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white) {
uint8_t data[] = {0x00, red, green, blue, white};
i2c_transmit(TRACKBALL_WRITE, data, sizeof(data), I2C_TIMEOUT);
i2c_transmit(TRACKBALL_ADDRESS, data, sizeof(data), I2C_TIMEOUT);
}
int16_t mouse_offset(uint8_t positive, uint8_t negative, int16_t scale) {
@@ -120,7 +120,7 @@ bool pointing_device_task(void) {
static uint16_t debounce_timer;
uint8_t state[5] = {};
if (timer_elapsed(i2c_timeout_timer) > I2C_WAITCHECK) {
if (i2c_read_register(TRACKBALL_WRITE, 0x04, state, 5, I2C_TIMEOUT) == I2C_STATUS_SUCCESS) {
if (i2c_read_register(TRACKBALL_ADDRESS, 0x04, state, 5, I2C_TIMEOUT) == I2C_STATUS_SUCCESS) {
if (!state[4] && !debounce) {
if (scrolling) {
#ifdef PIMORONI_TRACKBALL_INVERT_X

View File

@@ -20,10 +20,8 @@
#include "pointing_device.h"
#ifndef TRACKBALL_ADDRESS
# define TRACKBALL_ADDRESS 0x0A
# define TRACKBALL_ADDRESS (0x0A << 1)
#endif
#define TRACKBALL_WRITE ((TRACKBALL_ADDRESS << 1) | I2C_WRITE)
#define TRACKBALL_READ ((TRACKBALL_ADDRESS << 1) | I2C_READ)
void trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white);
void trackball_check_click(bool pressed, report_mouse_t *mouse);