i2cscanner.h 449 B

1234567891011121314151617181920212223
  1. #pragma once
  2. #include <furi.h>
  3. #include <furi_hal.h>
  4. // I2C BUS
  5. #define I2C_BUS &furi_hal_i2c_handle_external
  6. #define I2C_TIMEOUT 3
  7. // 7 bits addresses
  8. #define MAX_I2C_ADDR 0x7F
  9. typedef struct {
  10. uint8_t addresses[MAX_I2C_ADDR + 1];
  11. uint8_t nb_found;
  12. uint8_t menu_index;
  13. bool scanned;
  14. } i2cScanner;
  15. void scan_i2c_bus(i2cScanner* i2c_scanner);
  16. i2cScanner* i2c_scanner_alloc();
  17. void i2c_scanner_free(i2cScanner* i2c_scanner);