oled_ssd1306: minor, put spaces around comparators

This commit is contained in:
King Kévin 2019-12-03 23:00:58 +01:00
parent 05b5167d0d
commit 0f8b9e34b0
1 changed files with 6 additions and 6 deletions

View File

@ -68,7 +68,7 @@ bool oled_ssd1306_setup(void)
// Addressing Setting // Addressing Setting
0x20, 0x00 // Set Memory Addressing Mode: Horizontal Addressing Mode 0x20, 0x00 // Set Memory Addressing Mode: Horizontal Addressing Mode
}; // command to initialize the display }; // 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) 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) void oled_ssd1306_display(const uint8_t* display_data, uint16_t display_length)
{ {
// verify input // verify input
if (0==display_length || NULL==display_data) { if (0 == display_length || NULL == display_data) {
return; 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 0x10 // Set Higher Column Start Address for Page Addressing Mode: 0
}; // command to set addressing mode }; // 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 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; 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; return;
} }
const uint8_t oled_data[] = { const uint8_t oled_data[] = {
0x40, // control byte: continuous (multiple byes), 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; 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; return;
} }
i2c_master_stop(OLED_SSD1306_I2C); // send stop condition i2c_master_stop(OLED_SSD1306_I2C); // send stop condition