Simon Blandford
/
OLEDSeps525f
main.cpp@0:a136481b0662, 2010-01-12 (annotated)
- Committer:
- simonb
- Date:
- Tue Jan 12 11:12:13 2010 +0000
- Revision:
- 0:a136481b0662
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
simonb | 0:a136481b0662 | 1 | #include <string.h> |
simonb | 0:a136481b0662 | 2 | #include "mbed.h" |
simonb | 0:a136481b0662 | 3 | #include "OLEDSeps525f.h" |
simonb | 0:a136481b0662 | 4 | OLEDSeps525f lcd(p5, p6, p7, p8, p9, p10); |
simonb | 0:a136481b0662 | 5 | |
simonb | 0:a136481b0662 | 6 | int main() { |
simonb | 0:a136481b0662 | 7 | //Test background and clear screen |
simonb | 0:a136481b0662 | 8 | lcd.background(0x0000FF); |
simonb | 0:a136481b0662 | 9 | lcd.cls(); |
simonb | 0:a136481b0662 | 10 | //Test colour and fill |
simonb | 0:a136481b0662 | 11 | lcd.fill(0, 50, lcd.width(), 10, 0x00FF00); |
simonb | 0:a136481b0662 | 12 | lcd.fill(50, 0, 10, lcd.height(), 0xFF0000); |
simonb | 0:a136481b0662 | 13 | //Test pixel writing |
simonb | 0:a136481b0662 | 14 | for(int i=0; i<lcd.width(); i++) { |
simonb | 0:a136481b0662 | 15 | lcd.pixel(i, 80 + sin((float)i / 5.0)*10, 0x000000); |
simonb | 0:a136481b0662 | 16 | } |
simonb | 0:a136481b0662 | 17 | lcd.locate(0,1); |
simonb | 0:a136481b0662 | 18 | //Test text and newline |
simonb | 0:a136481b0662 | 19 | lcd.printf("OLED\ndriver\n"); |
simonb | 0:a136481b0662 | 20 | //Test tab |
simonb | 0:a136481b0662 | 21 | lcd.printf("\ttab\t2\t3\t4"); |
simonb | 0:a136481b0662 | 22 | lcd.locate(0,10); |
simonb | 0:a136481b0662 | 23 | //Test control codes |
simonb | 0:a136481b0662 | 24 | lcd.printf("\t*\v*\v\b\b*\r*"); |
simonb | 0:a136481b0662 | 25 | //Test orientation |
simonb | 0:a136481b0662 | 26 | lcd.locate(lcd.columns()/2-(strlen("Top ")/2),1); |
simonb | 0:a136481b0662 | 27 | lcd.printf("Top %u",lcd.orientation()); |
simonb | 0:a136481b0662 | 28 | lcd.orientation(1); |
simonb | 0:a136481b0662 | 29 | lcd.locate(lcd.columns()/2-(strlen("Right ")/2),1); |
simonb | 0:a136481b0662 | 30 | lcd.printf("Right %u",lcd.orientation()); |
simonb | 0:a136481b0662 | 31 | lcd.orientation(2); |
simonb | 0:a136481b0662 | 32 | lcd.locate(lcd.columns()/2-(strlen("Bottom ")/2),1); |
simonb | 0:a136481b0662 | 33 | lcd.printf("Bottom %u",lcd.orientation()); |
simonb | 0:a136481b0662 | 34 | lcd.orientation(3); |
simonb | 0:a136481b0662 | 35 | lcd.locate(lcd.columns()/2-(strlen("Left ")/2),1); |
simonb | 0:a136481b0662 | 36 | lcd.printf("Left %u",lcd.orientation()); |
simonb | 0:a136481b0662 | 37 | |
simonb | 0:a136481b0662 | 38 | } |