Sample program for the UC1701 library, written for the mbed LPC1768

Dependencies:   UC1701 mbed

Committer:
Anaesthetix
Date:
Mon Dec 19 23:26:33 2016 +0000
Revision:
2:9abdd1b8a82a
Parent:
0:b43dc6434530
Updated sample program with drawing / buffering

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Anaesthetix 0:b43dc6434530 1 // -- Example program for the UC1701 library - written for LPC1768
Anaesthetix 0:b43dc6434530 2
Anaesthetix 0:b43dc6434530 3 #include "mbed.h"
Anaesthetix 0:b43dc6434530 4 #include "UC1701.h"
Anaesthetix 0:b43dc6434530 5
Anaesthetix 0:b43dc6434530 6 SPI lcd(p5, NC, p7); // mosi (PIN 9 on LCD), miso (nc), sclk (PIN 8 on LCD)
Anaesthetix 0:b43dc6434530 7 DigitalOut cs(p8); // chip select (active low)
Anaesthetix 0:b43dc6434530 8 DigitalOut cd(p10); // command/data (0=command, 1=data) PIN 10 on the LCD (named RS)
Anaesthetix 0:b43dc6434530 9
Anaesthetix 0:b43dc6434530 10 UC1701 uc1701(lcd, cs, cd); // Create UC1701 instance
Anaesthetix 0:b43dc6434530 11
Anaesthetix 0:b43dc6434530 12 int main()
Anaesthetix 0:b43dc6434530 13 {
Anaesthetix 0:b43dc6434530 14 uc1701.init();
Anaesthetix 0:b43dc6434530 15 wait(1);
Anaesthetix 0:b43dc6434530 16 uc1701.fill();
Anaesthetix 0:b43dc6434530 17 wait(1);
Anaesthetix 0:b43dc6434530 18 uc1701.clear();
Anaesthetix 0:b43dc6434530 19 wait(1);
Anaesthetix 0:b43dc6434530 20 char str[40];
Anaesthetix 0:b43dc6434530 21 int n = 6;
Anaesthetix 0:b43dc6434530 22 n = sprintf(str, "01234ABCdefghijk");
Anaesthetix 0:b43dc6434530 23 while(1) {
Anaesthetix 0:b43dc6434530 24 uc1701.drawBitmap(test);
Anaesthetix 0:b43dc6434530 25 wait(1);
Anaesthetix 0:b43dc6434530 26 uc1701.drawBitmap(einstein);
Anaesthetix 0:b43dc6434530 27 wait(1);
Anaesthetix 0:b43dc6434530 28 uc1701.drawBitmap(biohazard);
Anaesthetix 0:b43dc6434530 29 wait(1);
Anaesthetix 0:b43dc6434530 30 uc1701.drawBitmap(highvoltage);
Anaesthetix 0:b43dc6434530 31 wait(1);
Anaesthetix 0:b43dc6434530 32 uc1701.drawBitmap(copter);
Anaesthetix 0:b43dc6434530 33 wait(1);
Anaesthetix 0:b43dc6434530 34 uc1701.clear();
Anaesthetix 2:9abdd1b8a82a 35 uc1701.clearBuffer();
Anaesthetix 2:9abdd1b8a82a 36 uc1701.drawbufferLineHor(10, 7, 4, 108);
Anaesthetix 2:9abdd1b8a82a 37 uc1701.drawbufferLineVert(62, 7, 55, 4);
Anaesthetix 2:9abdd1b8a82a 38 uc1701.update();
Anaesthetix 2:9abdd1b8a82a 39 wait(1);
Anaesthetix 2:9abdd1b8a82a 40 //uc1701.drawLineVert(62, 10, 40, 4);
Anaesthetix 2:9abdd1b8a82a 41 //wait(5);
Anaesthetix 2:9abdd1b8a82a 42 uc1701.clear();
Anaesthetix 0:b43dc6434530 43 uc1701.writeText(0,0, font_6x6, str, n);
Anaesthetix 0:b43dc6434530 44 uc1701.writeText(0,1, font_7x7, str, n);
Anaesthetix 0:b43dc6434530 45 uc1701.writeText(0,2, bold_font, str, n);
Anaesthetix 0:b43dc6434530 46 uc1701.writeText(0,3, font_5x8, str, n);
Anaesthetix 0:b43dc6434530 47 uc1701.writeText2d(0,4, font2d_hunter, str, n);
Anaesthetix 0:b43dc6434530 48 uc1701.writeText(0,5, font_8x8_1, str, n);
Anaesthetix 0:b43dc6434530 49 uc1701.writeText2d(0,6, font2d_formplex12, str, n);
Anaesthetix 0:b43dc6434530 50 uc1701.writeText(0,7, font_4x5, str, n);
Anaesthetix 0:b43dc6434530 51 wait(5);
Anaesthetix 0:b43dc6434530 52 }
Anaesthetix 0:b43dc6434530 53 }