Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.3 KiB

  1. /*
  2. I2C MODULE
  3. Copyright (C) 2017-2019 by Xose Pérez <xose dot perez at gmail dot com>
  4. */
  5. #pragma once
  6. #include "espurna.h"
  7. void i2c_wakeup(uint8_t address);
  8. uint8_t i2c_write_buffer(uint8_t address, uint8_t * buffer, size_t len);
  9. uint8_t i2c_write_uint8(uint8_t address, uint8_t value);
  10. uint8_t i2c_write_uint8(uint8_t address, uint8_t reg, uint8_t value);
  11. uint8_t i2c_write_uint8(uint8_t address, uint8_t reg, uint8_t value1, uint8_t value2);
  12. uint8_t i2c_write_uint16(uint8_t address, uint16_t value);
  13. uint8_t i2c_write_uint16(uint8_t address, uint8_t reg, uint16_t value);
  14. uint8_t i2c_read_uint8(uint8_t address);
  15. uint8_t i2c_read_uint8(uint8_t address, uint8_t reg);
  16. uint16_t i2c_read_uint16(uint8_t address);
  17. uint16_t i2c_read_uint16(uint8_t address, uint8_t reg);
  18. uint16_t i2c_read_uint16_le(uint8_t address, uint8_t reg);
  19. int16_t i2c_read_int16(uint8_t address, uint8_t reg);
  20. int16_t i2c_read_int16_le(uint8_t address, uint8_t reg);
  21. void i2c_read_buffer(uint8_t address, uint8_t * buffer, size_t len);
  22. void i2cScan();
  23. void i2cClearBus();
  24. bool i2cGetLock(unsigned char address);
  25. bool i2cReleaseLock(unsigned char address);
  26. unsigned char i2cFindAndLock(size_t size, unsigned char * addresses);
  27. unsigned char i2cFind(size_t size, unsigned char * addresses, unsigned char &start);
  28. unsigned char i2cFind(size_t size, unsigned char * addresses);
  29. void i2cSetup();