summaryrefslogtreecommitdiffstats
path: root/keyboards/handwired/onekey/keymaps/i2c_scanner/keymap.c
diff options
context:
space:
mode:
authorlokher <lokher@gmail.com>2022-09-13 11:24:05 +0800
committerlokher <lokher@gmail.com>2022-09-13 11:24:05 +0800
commit9581289745736ce068a1040f44cec37a2ca8830d (patch)
tree24f644715a5fd6cc4d804d9604fb094307808b1b /keyboards/handwired/onekey/keymaps/i2c_scanner/keymap.c
parentfe13cedf8c09fa34d5cec4e4c624738095176625 (diff)
Remove non-Keychron keyboards
Diffstat (limited to 'keyboards/handwired/onekey/keymaps/i2c_scanner/keymap.c')
-rw-r--r--keyboards/handwired/onekey/keymaps/i2c_scanner/keymap.c66
1 files changed, 0 insertions, 66 deletions
diff --git a/keyboards/handwired/onekey/keymaps/i2c_scanner/keymap.c b/keyboards/handwired/onekey/keymaps/i2c_scanner/keymap.c
deleted file mode 100644
index ea8443709d..0000000000
--- a/keyboards/handwired/onekey/keymaps/i2c_scanner/keymap.c
+++ /dev/null
@@ -1,66 +0,0 @@
-#include QMK_KEYBOARD_H
-
-#include "i2c_master.h"
-#include "debug.h"
-
-#define TIMEOUT 50
-
-// 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_readReg(address, 0, &data, sizeof(data), TIMEOUT);
-}
-
-# define i2c_start i2c_start_bodge
-#endif
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- LAYOUT_ortho_1x1(KC_A)
-};
-
-void do_scan(void) {
- uint8_t nDevices = 0;
-
- dprintf("Scanning...\n");
-
- 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);
- if (error == I2C_STATUS_SUCCESS) {
- i2c_stop();
- dprintf(" I2C device found at address 0x%02X\n", address);
- nDevices++;
- } else {
- // dprintf(" Unknown error (%u) at address 0x%02X\n", error, address);
- }
- }
-
- if (nDevices == 0)
- dprintf("No I2C devices found\n");
- else
- dprintf("done\n");
-}
-
-uint16_t scan_timer = 0;
-
-void matrix_scan_user(void) {
- if (timer_elapsed(scan_timer) > 5000) {
- do_scan();
- scan_timer = timer_read();
- }
-}
-
-void keyboard_post_init_user(void) {
- debug_enable = true;
- debug_matrix = true;
-
- i2c_init();
- scan_timer = timer_read();
-}