diff --git a/lib/oled_ssd1306.c b/lib/oled_ssd1306.c index cf57871..2d2aa6b 100644 --- a/lib/oled_ssd1306.c +++ b/lib/oled_ssd1306.c @@ -68,7 +68,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_RC_NONE==i2c_master_slave_write(OLED_SSD1306_I2C, OLED_SSD1306_SLAVE, false, oled_init, LENGTH(oled_init)); // send command to initialize display + return I2C_MASTER_RC_NONE == 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) @@ -109,7 +109,7 @@ void oled_ssd1306_test(void) void oled_ssd1306_display(const uint8_t* display_data, uint16_t display_length) { // verify input - if (0==display_length || NULL==display_data) { + if (0 == display_length || NULL == display_data) { return; } @@ -120,19 +120,19 @@ void oled_ssd1306_display(const uint8_t* display_data, uint16_t display_length) 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, false, oled_start_page, LENGTH(oled_start_page)); // send command to set addressing mode - if (I2C_MASTER_RC_NONE!=i2c_master_start(OLED_SSD1306_I2C)) { // send start condition + if (I2C_MASTER_RC_NONE != i2c_master_start(OLED_SSD1306_I2C)) { // send start condition return; } - if (I2C_MASTER_RC_NONE!=i2c_master_select_slave(OLED_SSD1306_I2C, OLED_SSD1306_SLAVE, false, true)) { // select OLED display + if (I2C_MASTER_RC_NONE != i2c_master_select_slave(OLED_SSD1306_I2C, OLED_SSD1306_SLAVE, false, true)) { // select OLED display return; } const uint8_t oled_data[] = { 0x40, // control byte: continuous (multiple byes), data }; - if (I2C_MASTER_RC_NONE!=i2c_master_write(OLED_SSD1306_I2C, oled_data, LENGTH(oled_data))) { // send data header + if (I2C_MASTER_RC_NONE != i2c_master_write(OLED_SSD1306_I2C, oled_data, LENGTH(oled_data))) { // send data header return; } - if (I2C_MASTER_RC_NONE!=i2c_master_write(OLED_SSD1306_I2C, display_data, display_length)) { // send template picture to display + if (I2C_MASTER_RC_NONE != i2c_master_write(OLED_SSD1306_I2C, display_data, display_length)) { // send template picture to display return; } i2c_master_stop(OLED_SSD1306_I2C); // send stop condition