From 4f3e6935d20f2f2686d23b87af3226180d75600c Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sun, 11 Apr 2021 20:43:28 +0100 Subject: [PATCH] Simplify the OLED initialisation. --- I2C3.cpp | 4 +--- I2C3.h | 2 +- I2COLED.cpp | 8 ++------ I2COLED.h | 2 +- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/I2C3.cpp b/I2C3.cpp index 77979cc..0804e90 100644 --- a/I2C3.cpp +++ b/I2C3.cpp @@ -30,7 +30,7 @@ CI2C3::CI2C3() { } -bool CI2C3::init() +void CI2C3::init() { // Enable I2C3 RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C3, ENABLE); @@ -73,8 +73,6 @@ bool CI2C3::init() // I2C Peripheral Enable I2C_Cmd(I2C3, ENABLE); - - return true; } uint8_t CI2C3::write(uint8_t addr, const uint8_t* data, uint16_t length) diff --git a/I2C3.h b/I2C3.h index c130070..e496dfb 100644 --- a/I2C3.h +++ b/I2C3.h @@ -33,7 +33,7 @@ class CI2C3 { public: CI2C3(); - bool init(); + void init(); uint8_t write(uint8_t addr, const uint8_t* data, uint16_t length); diff --git a/I2COLED.cpp b/I2COLED.cpp index bc4ef34..6a5ce19 100644 --- a/I2COLED.cpp +++ b/I2COLED.cpp @@ -313,11 +313,9 @@ m_oledBuffer(NULL) clear(); } -bool CI2COLED::init() +void CI2COLED::init() { - bool ret = m_i2c.init(); - if (!ret) - return false; + m_i2c.init(); // Initialise the VG-6432TSWEG02 OLED display sendCommand(0xAEU); /*display off*/ @@ -352,8 +350,6 @@ bool CI2COLED::init() sendCommand(0x8DU, 0x10U); /*set charge pump enable*/ sendCommand(0xAFU); /*display ON*/ - - return true; } void CI2COLED::setMode(int state) diff --git a/I2COLED.h b/I2COLED.h index 21795c7..2703a62 100644 --- a/I2COLED.h +++ b/I2COLED.h @@ -29,7 +29,7 @@ class CI2COLED { public: CI2COLED(); - bool init(); + void init(); void setMode(int state);