summaryrefslogtreecommitdiff
path: root/keyboards/handwired/onekey/keymaps/i2c_scanner
diff options
context:
space:
mode:
authorDavid Hoelscher <infinityis@users.noreply.github.com>2024-01-17 07:05:38 -0600
committerGitHub <noreply@github.com>2024-01-17 14:05:38 +0100
commite9bd7d7ad308f9c72c86863bf9f19382c7e2d892 (patch)
treec46ce87aaa57b8f49dc0a2b56527f0bc606038ab /keyboards/handwired/onekey/keymaps/i2c_scanner
parent2b0965944d9065daa65cd25540cf2dd007f23eda (diff)
I2C driver cleanup (#21273)
* remove i2c_start and i2c_stop from i2c drivers * remove static i2c_address variable from chibios i2c driver
Diffstat (limited to 'keyboards/handwired/onekey/keymaps/i2c_scanner')
-rw-r--r--keyboards/handwired/onekey/keymaps/i2c_scanner/keymap.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/keyboards/handwired/onekey/keymaps/i2c_scanner/keymap.c b/keyboards/handwired/onekey/keymaps/i2c_scanner/keymap.c
index 43e61c29d3..1d1a7c2b00 100644
--- a/keyboards/handwired/onekey/keymaps/i2c_scanner/keymap.c
+++ b/keyboards/handwired/onekey/keymaps/i2c_scanner/keymap.c
@@ -8,16 +8,6 @@
// TODO: remove patch
#ifdef PROTOCOL_CHIBIOS
# pragma message("ChibiOS is currently 'best effort' and might not report accurate results")
-
-i2c_status_t i2c_start_bodge(uint8_t address, uint16_t timeout) {
- i2c_start(address);
-
- // except on ChibiOS where the only way is do do "something"
- uint8_t data = 0;
- return i2c_read_register(address, 0, &data, sizeof(data), TIMEOUT);
-}
-
-# define i2c_start i2c_start_bodge
#endif
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -31,10 +21,9 @@ void do_scan(void) {
for (uint8_t address = 1; address < 127; address++) {
// The i2c_scanner uses the return value of
- // i2c_start to see if a device did acknowledge to the address.
- i2c_status_t error = i2c_start(address << 1, TIMEOUT);
+ // i2c_ping_address to see if a device did acknowledge to the address.
+ i2c_status_t error = i2c_ping_address(address << 1, TIMEOUT);
if (error == I2C_STATUS_SUCCESS) {
- i2c_stop();
dprintf(" I2C device found at address 0x%02X\n", address);
nDevices++;
} else {