![](/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:
- 1:de95c9ab922e
- Parent:
- 0:9f57fa937a86
- Child:
- 2:29bb1ef0d6cd
diff -r 9f57fa937a86 -r de95c9ab922e main.cpp --- a/main.cpp Sat Aug 29 12:22:13 2020 +0000 +++ b/main.cpp Sun Aug 30 09:39:15 2020 +0000 @@ -6,7 +6,7 @@ * Commissioning test for the L432KC and the Pmod small OLED display * ************************************************************************* -* Description: McLab10_OLEDrgb_L432KC +* Description: McLab10_OLEDrgb_L432KC_OS60_tk2 * "Test module Pmod Digilent Lextronic" will be displayed on OLEDrgb module * with different size and colors..... and later the variable values. * @@ -31,23 +31,23 @@ ************************************************************************* * Compiles OK, works with hardware with operating system revision 6691:cf4f12a * Compiles OK, DOESN'T WORK with hardware with op sys revision 7088:3ab72c7 -* Timo Karppinen 28.08.2020 +* Updated for OS6, Compiles OK, works with hardware with os revision OS 7864:890f056 +* Timo Karppinen 29.08.2020 SPDX-License-Identifier: Apache-2.0 **************************************************************/ #include "mbed.h" -#include "Stream.h" // testing #include "Adafruit_SSD1331.h" // By using the Adafruit SSD1331 library and Adafruit GFX library -#include "Adafruit_GFX.h" // we will get similar code than in Arduino-boards working. +#include "Adafruit_GFX.h" // we will get similar code working than in Arduino-boards. // There are other SSD1331 libraries, too. // https://os.mbed.com/search/?q=ssd1331 // The tested are: - // Adafruit_SSD1331_Mbed by Marijn Romeijn - // Adafruit_GFX by Team_EIC + // Adafruit_SSD1331_MbedOS6 by Timo Karppinen + // Adafruit-GFX-MbedOS6 by Timo Karppinen // PmodOLEDrgb Adafruit_SSD1331 OLED(D9, D6, D10, D11, NC, D13); // cs, res, dc, mosi, (nc), sck //DigitalOut LED(LED1); // LED1, LED2, LED3 and LED4 are the D13 PB_3 pin in this board and - //can not be used because of the SPI + //can not be used as a LED because of the SPI DigitalOut VCCEN(D3); DigitalOut PMODEN(D5); @@ -78,7 +78,8 @@ // LED = 1; ThisThread::sleep_for(2000ms); // LED = 0; - // Initalize the PmodOLEDrgb + // Initalize the PmodOLEDrgb, the library includes SPI and there is + // no need to initialize the SPI in the main.cpp OLED.begin(); // initialization of display object OLED.clearScreen(); @@ -127,7 +128,7 @@ OLED.printf("Be aware of reaching the limit"); OLED.fillRoundRect(10, 35, 50, 3 , 1, Yellow); } - OLED.setCursor(0,40); // cursor is in x=0 and y=0 + OLED.setCursor(0,40); // cursor is in x=0 and y=40 OLED.printf("Wait a moment !"); OLED.drawFastHLine(1, 60, OLED.width()-1, Blue); // blue line x=1 to screen width-1 and y=60 printf("printed on OLED");