2016-04-25 14:27:51 -07:00
|
|
|
#include "ssd1351.hpp"
|
2017-08-30 15:00:29 -07:00
|
|
|
#include "upm_utilities.h"
|
2016-03-03 17:22:12 -08:00
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
#define BLACK 0x0000
|
|
|
|
#define WHITE 0xFFFF
|
|
|
|
#define INTEL_BLUE 0x0BF8
|
2016-03-03 17:22:12 -08:00
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
int
|
|
|
|
main(int argc, char** argv)
|
2016-03-03 17:22:12 -08:00
|
|
|
{
|
|
|
|
// Define colors (16-bit RGB on 5/6/5 bits)
|
2017-08-30 15:00:29 -07:00
|
|
|
int colors[] = { 0x0000, 0x000F, 0x03E0, 0x03EF, 0x7800, 0x780F, 0x7BE0, 0xC618,
|
|
|
|
0x7BEF, 0x001F, 0x07E0, 0x07FF, 0xF800, 0xF81F, 0xFFE0, 0xFFFF };
|
|
|
|
//! [Interesting]
|
2016-03-03 17:22:12 -08:00
|
|
|
// Initialize display with pins
|
|
|
|
// oc = 0, dc = 1, r = 2, si = 11, cl = 13
|
2017-08-30 15:00:29 -07:00
|
|
|
upm::SSD1351 display(0, 1, 2);
|
2016-03-03 17:22:12 -08:00
|
|
|
|
|
|
|
// Test lines pixel by pixel
|
2017-08-30 15:00:29 -07:00
|
|
|
for (int i = 0; i < SSD1351HEIGHT; i++) {
|
|
|
|
for (int j = 0; j < SSD1351WIDTH; j++) {
|
|
|
|
display.drawPixel(i, j, colors[i / 8]);
|
2016-03-03 17:22:12 -08:00
|
|
|
}
|
|
|
|
}
|
2017-08-30 15:00:29 -07:00
|
|
|
display.refresh();
|
|
|
|
upm_delay(5);
|
2016-03-03 17:22:12 -08:00
|
|
|
|
|
|
|
// Test rectangles
|
2017-08-30 15:00:29 -07:00
|
|
|
for (int i = 0; i < SSD1351HEIGHT / 32; i++) {
|
|
|
|
for (int j = 0; j < SSD1351WIDTH / 32; j++) {
|
|
|
|
display.fillRect(i * 32, j * 32, 32, 32, colors[i * 4 + j]);
|
2016-03-03 17:22:12 -08:00
|
|
|
}
|
|
|
|
}
|
2017-08-30 15:00:29 -07:00
|
|
|
display.refresh();
|
|
|
|
upm_delay(5);
|
2016-03-03 17:22:12 -08:00
|
|
|
|
|
|
|
// Test circles
|
2017-08-30 15:00:29 -07:00
|
|
|
display.fillScreen(0x2104);
|
|
|
|
for (int i = 0; i < SSD1351HEIGHT / 32; i++) {
|
|
|
|
for (int j = 0; j < SSD1351WIDTH / 32; j++) {
|
|
|
|
display.drawCircle(i * 32 + 15, j * 32 + 15, 15, colors[i * 4 + j]);
|
2016-03-03 17:22:12 -08:00
|
|
|
}
|
|
|
|
}
|
2017-08-30 15:00:29 -07:00
|
|
|
display.refresh();
|
|
|
|
upm_delay(5);
|
2016-03-03 17:22:12 -08:00
|
|
|
|
|
|
|
// Test Text
|
2017-08-30 15:00:29 -07:00
|
|
|
display.fillScreen(INTEL_BLUE);
|
|
|
|
display.setTextColor(WHITE, INTEL_BLUE);
|
|
|
|
display.setTextSize(4);
|
|
|
|
display.setCursor(7, 30);
|
|
|
|
display.print("Intel");
|
|
|
|
display.setCursor(5, 70);
|
|
|
|
display.print("IoTDK");
|
|
|
|
display.refresh();
|
|
|
|
//! [Interesting]
|
2016-03-03 17:22:12 -08:00
|
|
|
}
|