![](/media/cache/profiles/Timo_01_DSC_4754_533x533.jpg.50x50_q85.jpg)
The code is developed for the hardware NUCLEO-L432KC and Digilent Pmod OLEDrgb. The purpose is to make students learn the development process and test that the hardware works fine. For converting this to Mbed OS 6 Adafruit_GFX.h needed to add #include "Stream.h" in beginning of the Adafruit_GFX.h Adafruit_SSD1331.cpp wait_ms(200) replaced with ThisThread::sleep_for(200ms); for all the similar wait_ms lines.
Dependencies: Adafruit-GFX-MbedOS6
Diff: main.cpp
- Revision:
- 6:a5886100eeeb
- Parent:
- 5:58208433fe78
- Child:
- 7:0b422690f413
--- a/main.cpp Tue Feb 23 09:01:05 2021 +0000 +++ b/main.cpp Tue Oct 04 08:21:19 2022 +0000 @@ -13,8 +13,8 @@ * Material * 1. ST L432KC ( or some other micro controller board with SPI communication ) * 2. Digilent Pmod OLEDrgb and the libraries -* Adafruit_SSD1331_Mbed -* Adafruit-GFX +* Adafruit_SSD1331_Mbed, select the version "Timo Karppine" which is modified for OS6.nn +* Adafruit-GFX, select the version "Timo Karppine" which is modified for OS6.nn * These libraries can be found with search on the page * https://www.mbed.com/en/platform/mbed-os/ * Please connect L432KC - Pmod_OLEDrgb with lines: @@ -23,16 +23,16 @@ * L432KC A7 - OLED 1 CS or any other free * L432KC D10 - OLED 7 DC or any other free * L432KC D6 - OLED 8 RES or any other free -* VCC - OLED 9 VCCEN Enable - VCC -* VCC - OLED10 PMODEN Pmod Enable - VCC +* L432KC D2 - OLED 9 VCCEN Enable, or connect to VCC +* L432KC D3 - OLED10 PMODEN Pmod Enable, or connect to VCC * GND - OLED 5 Ground * VCC - OLED 6 Power supply 3.3 V * L432KC 3V3 - VCC L432 supplying 3.3 V * L432KC GND - GND Ground * ************************************************************************* -* Updated for OS67, OS68 -* Timo Karppinen 23.02.2021 SPDX-License-Identifier: Apache-2.0 +* Updated for OS67, ... OS6.15 compiles OK. +* Timo Karppinen 3.10.2022 SPDX-License-Identifier: Apache-2.0 **************************************************************/ #include "mbed.h" @@ -44,13 +44,13 @@ // Adafruit_SSD1331_MbedOS6 by Timo Karppinen // Adafruit-GFX-MbedOS6 by Timo Karppinen // PmodOLEDrgb -Adafruit_SSD1331 OLED(A7, D6, D10, D11, NC, D13); // cs, res, dc, mosi, (nc), sck +Adafruit_SSD1331 OLED(A7, A6, D10, D11, NC, D13); // cs, res, dc, mosi, (nc), sck DigitalOut LED(D1); // LED1, LED2, LED3 and LED4 are the D13 PB_3 pin in this board and //can not be used as a LED because of the SPI -DigitalOut VCCEN(D3); -DigitalOut PMODEN(D5); +DigitalOut VCCEN(D2); +DigitalOut PMODEN(D3); // Definition of colours on the OLED display #define Black 0x0000 @@ -138,7 +138,7 @@ OLED.printf("Wait a moment !"); OLED.drawFastHLine(1, OLED.height()-1, OLED.width()-1, Red); //RED line x=1 to screen width-1 and // y=screen height-1 - //printf("printed on OLED\n\n"); + //printf("printed on OLED\n\n"); // OLED.printf() is using the same resource!! ThisThread::sleep_for(1000ms); }