I2C bus upgrade (#432)
This commit is contained in:
parent
d100f42b1f
commit
b83c2629b9
56 changed files with 909 additions and 804 deletions
|
|
@ -11,9 +11,6 @@
|
|||
*/
|
||||
#include "ssd1306.h"
|
||||
#include <stdio.h>
|
||||
#if (SSD1306_I2C_SUPPORT)
|
||||
#include <i2c/i2c.h>
|
||||
#endif
|
||||
#if (SSD1306_SPI4_SUPPORT) || (SSD1306_SPI3_SUPPORT)
|
||||
#include <esp/spi.h>
|
||||
#endif
|
||||
|
|
@ -92,7 +89,7 @@
|
|||
#if (SSD1306_I2C_SUPPORT)
|
||||
static int inline i2c_send(const ssd1306_t *dev, uint8_t reg, uint8_t* data, uint8_t len)
|
||||
{
|
||||
return i2c_slave_write(dev->addr, ®, data, len);
|
||||
return i2c_slave_write(dev->i2c_dev.bus, dev->i2c_dev.addr , ®, data, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
// shifted
|
||||
#if (SSD1306_I2C_SUPPORT)
|
||||
#include <i2c/i2c.h>
|
||||
#define SSD1306_I2C_ADDR_0 (0x3C)
|
||||
#define SSD1306_I2C_ADDR_1 (0x3D)
|
||||
#endif
|
||||
|
|
@ -67,7 +68,7 @@ typedef struct
|
|||
ssd1306_screen_t screen ;
|
||||
union {
|
||||
#if (SSD1306_I2C_SUPPORT)
|
||||
uint8_t addr ; //!< I2C address, used by SSD1306_PROTO_I2C
|
||||
i2c_dev_t i2c_dev; //!< I2C devuce descriptor, used by SSD1306_PROTO_I2C
|
||||
#endif
|
||||
uint8_t cs_pin ; //!< Chip Select GPIO pin, used by SSD1306_PROTO_SPI3, SSD1306_PROTO_SPI4
|
||||
} ;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue