diff --git a/lib/oled_ssd1306.c b/lib/oled_ssd1306.c index 36d45a9..7c4e68b 100644 --- a/lib/oled_ssd1306.c +++ b/lib/oled_ssd1306.c @@ -42,7 +42,7 @@ bool oled_ssd1306_setup(void) { - i2c_master_setup(OLED_SSD1306_I2C, true); + i2c_master_setup(OLED_SSD1306_I2C, 400); // setup I2C bus ( SSD1306 supports an I2C cleck up to 400 kHz) const uint8_t oled_init[] = { 0x00, // control byte: continuous (multiple byes), command 0xae, // Set Display ON/OFF: OFF @@ -65,7 +65,7 @@ bool oled_ssd1306_setup(void) // Addressing Setting 0x20, 0x00 // Set Memory Addressing Mode: Horizontal Addressing Mode }; // command to initialize the display - return i2c_master_slave_write(OLED_SSD1306_I2C, OLED_SSD1306_SLAVE, oled_init, LENGTH(oled_init)); // send command to initialize display + return i2c_master_slave_write(OLED_SSD1306_I2C, OLED_SSD1306_SLAVE, false, oled_init, LENGTH(oled_init)); // send command to initialize display } void oled_ssd1306_on(void) @@ -74,7 +74,7 @@ void oled_ssd1306_on(void) 0x80, // control byte: no continuation, command 0xaf, // Set Display ON/OFF: ON }; // command to switch on display - i2c_master_slave_write(OLED_SSD1306_I2C, OLED_SSD1306_SLAVE, oled_display_on, LENGTH(oled_display_on)); // sent command to switch on display + i2c_master_slave_write(OLED_SSD1306_I2C, OLED_SSD1306_SLAVE, false, oled_display_on, LENGTH(oled_display_on)); // sent command to switch on display } void oled_ssd1306_off(void) @@ -83,7 +83,7 @@ void oled_ssd1306_off(void) 0x80, // control byte: no continuation, command 0xae, // Set Display ON/OFF: OFF }; // command to switch off display - i2c_master_slave_write(OLED_SSD1306_I2C, OLED_SSD1306_SLAVE, oled_display_off, LENGTH(oled_display_off)); // sent command to switch onff display + i2c_master_slave_write(OLED_SSD1306_I2C, OLED_SSD1306_SLAVE, false, oled_display_off, LENGTH(oled_display_off)); // sent command to switch onff display } void oled_ssd1306_test(void) @@ -92,7 +92,7 @@ void oled_ssd1306_test(void) 0x80, // control byte: no continuation, command 0xa5 // Entire Display ON: Entire display ON Output ignores RAM content }; // command to set entire display on - i2c_master_slave_write(OLED_SSD1306_I2C, OLED_SSD1306_SLAVE, oled_entire_display_on, LENGTH(oled_entire_display_on)); // send command to switch entire display on + i2c_master_slave_write(OLED_SSD1306_I2C, OLED_SSD1306_SLAVE, false, oled_entire_display_on, LENGTH(oled_entire_display_on)); // send command to switch entire display on oled_ssd1306_on(); // set display on sleep_ms(200); // let is on for a bit (enough for the user to see it is completely on oled_ssd1306_off(); // set display off @@ -100,7 +100,7 @@ void oled_ssd1306_test(void) 0x80, // control byte: no continuation, command 0xa4 // Entire Display ON: Resume to RAM content display }; // command to display RAM - i2c_master_slave_write(OLED_SSD1306_I2C, OLED_SSD1306_SLAVE, oled_entire_display_ram, LENGTH(oled_entire_display_ram)); // send command to display RAM + i2c_master_slave_write(OLED_SSD1306_I2C, OLED_SSD1306_SLAVE, false, oled_entire_display_ram, LENGTH(oled_entire_display_ram)); // send command to display RAM } void oled_ssd1306_display(const uint8_t* display_data, uint16_t display_length) @@ -116,11 +116,11 @@ void oled_ssd1306_display(const uint8_t* display_data, uint16_t display_length) 0x00, // Set Lower Column Start Address for Page Addressing Mode: 0 0x10 // Set Higher Column Start Address for Page Addressing Mode: 0 }; // command to set addressing mode - i2c_master_slave_write(OLED_SSD1306_I2C, OLED_SSD1306_SLAVE, oled_start_page, LENGTH(oled_start_page)); // send command to set addressing mode + i2c_master_slave_write(OLED_SSD1306_I2C, OLED_SSD1306_SLAVE, false, oled_start_page, LENGTH(oled_start_page)); // send command to set addressing mode if (!i2c_master_start(OLED_SSD1306_I2C)) { // send start condition return; } - if (!i2c_master_select_slave(OLED_SSD1306_I2C, OLED_SSD1306_SLAVE, true)) { // select OLED display + if (!i2c_master_select_slave(OLED_SSD1306_I2C, OLED_SSD1306_SLAVE, false, true)) { // select OLED display return; } const uint8_t oled_data[] = {