Seongbin Lim
/
sb_first_project
This is a very simple guide, reviewing the steps required to get Blinky working on an Mbed OS platform.
Diff: main.cpp
- Revision:
- 136:53a83b91854c
- Parent:
- 135:03997cc206a4
- Child:
- 137:81b5a1672c6a
--- a/main.cpp Tue May 19 09:19:38 2020 +0000 +++ b/main.cpp Fri May 22 08:05:14 2020 +0000 @@ -6,7 +6,7 @@ #define EVAL_ADT7420_ADDR (0x48) I2C i2c(I2C_SDA, I2C_SCL); -RawSerial pc(USBTX, USBRX, 115200); +RawSerial pc(PA_2, PA_3, 115200); Adafruit_SSD1306_SPI goled(D11, D13, D10, D4, D7, 64, 128); @@ -32,13 +32,21 @@ ThisThread::sleep_for(3000); goled.clearDisplay(); - goled.printf("%ux%u OLED Lab. \r\n", goled.width(), goled.height()); + goled.setTextSize(2); + goled.printf("OLED Lab.\r\n"); + goled.setTextSize(1); goled.printf("HGU in Pohang \r\n\r\n"); + int16_t cursor_x = goled.cursor_x; + int16_t cursor_y = goled.cursor_y; + while(1) { + + goled.setTextCursor(cursor_x,cursor_y); + data_write[0] = ADT7420_TEMP_REG; i2c.write((EVAL_ADT7420_ADDR<<1),data_write,1,0); - i2c.read((EAVL_ADT7420_ADDR<<1 | 0x01), data_read, 2, 0); + i2c.read((EVAL_ADT7420_ADDR<<1 | 0x01), data_read, 2, 0); int tempval = ((int) data_read[0]<<8 | data_read[1]); tempval >>= 3;