oled_ssd1306: fix doc and comments

This commit is contained in:
King Kévin 2019-12-05 13:28:07 +01:00
parent de66829811
commit dd9f10c406
2 changed files with 11 additions and 10 deletions

View File

@ -29,24 +29,24 @@
/* own libraries */
#include "global.h" // global utilities
#include "oled_ssd1306.h" // OLED definitions
#include "i2c_master.h" // I2C header and definitions
#include "i2c_master.h" // I²C header and definitions
/** SSD1306 OLED display I2C slave address */
/** SSD1306 OLED display I²C slave address */
static uint8_t oled_ssd1306_slave_addr = 0x3c;
/** @defgroup oled_ssd1306_i2c I2C peripheral to communicate with the SSD1306 OLED
/** @defgroup oled_ssd1306_i2c I²C peripheral to communicate with the SSD1306 OLED
* @{
*/
#define OLED_SSD1306_I2C I2C1 /**< I2C peripheral */
#define OLED_SSD1306_I2C I2C1 /**< I²C peripheral */
/** @} */
bool oled_ssd1306_setup(uint8_t slave_addr)
{
if (!i2c_master_check_signals(OLED_SSD1306_I2C)) { // check if there are pull-ups to operator I2C
if (!i2c_master_check_signals(OLED_SSD1306_I2C)) { // check if there are pull-ups to operator I²C
return false;
}
oled_ssd1306_slave_addr = slave_addr; // save I2C slave address of SSD1306
i2c_master_setup(OLED_SSD1306_I2C, 400); // setup I2C bus ( SSD1306 supports an I2C cleck up to 400 kHz)
oled_ssd1306_slave_addr = slave_addr; // save I²C slave address of SSD1306
i2c_master_setup(OLED_SSD1306_I2C, 400); // setup I²C bus (SSD1306 supports an I²C clock up to 400 kHz)
const uint8_t oled_init[] = {
0x00, // control byte: continuous (multiple byes), command
0xae, // Set Display ON/OFF: OFF
@ -87,7 +87,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_addr, false, oled_display_off, LENGTH(oled_display_off)); // sent command to switch onff display
i2c_master_slave_write(OLED_SSD1306_I2C, oled_ssd1306_slave_addr, false, oled_display_off, LENGTH(oled_display_off)); // sent command to switch font display
}
void oled_ssd1306_test(void)

View File

@ -20,8 +20,9 @@
*/
/** setup OLED display
* @param[in] slave_addr I2C slave address of SSD1306 device (least significant 7-bit)
* @return if the display setup is successful, else the display is probably not on the I2C bus
* @param[in] slave_addr I²C slave address of SSD1306 device (least significant 7-bit)
* @return if the display setup is successful, else the display is probably not on the I²C bus
* @warning only one display on the I²C bus is currently supported
*/
bool oled_ssd1306_setup(uint8_t slave_addr);
/** switch OLED display on */