Display driver for the Vives city game
CostumCharacters.cpp@7:f2050f77de0b, 2017-05-15 (annotated)
- Committer:
- atomicLogic
- Date:
- Mon May 15 18:29:40 2017 +0000
- Revision:
- 7:f2050f77de0b
- Parent:
- 5:06eccc902247
bla
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
atomicLogic | 0:80ce68cdf568 | 1 | #include "CostumCharacters.h" |
atomicLogic | 0:80ce68cdf568 | 2 | #include "TextLCD.h" |
atomicLogic | 0:80ce68cdf568 | 3 | #include <string> |
atomicLogic | 0:80ce68cdf568 | 4 | |
atomicLogic | 5:06eccc902247 | 5 | |
atomicLogic | 0:80ce68cdf568 | 6 | CostumCharacters::CostumCharacters( TextLCD * lcd ) |
atomicLogic | 0:80ce68cdf568 | 7 | { |
atomicLogic | 0:80ce68cdf568 | 8 | this->lcd = lcd; |
atomicLogic | 0:80ce68cdf568 | 9 | } |
atomicLogic | 0:80ce68cdf568 | 10 | |
atomicLogic | 0:80ce68cdf568 | 11 | void CostumCharacters::setBatteryIcon( int lvl ) |
atomicLogic | 0:80ce68cdf568 | 12 | { |
atomicLogic | 0:80ce68cdf568 | 13 | switch( lvl ) { |
atomicLogic | 0:80ce68cdf568 | 14 | case 0: |
atomicLogic | 5:06eccc902247 | 15 | { |
atomicLogic | 0:80ce68cdf568 | 16 | char batteryIcon0[] = {0x0E, 0x1F, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1F}; |
atomicLogic | 0:80ce68cdf568 | 17 | lcd->defineChar( 1, batteryIcon0 ); |
atomicLogic | 5:06eccc902247 | 18 | } |
atomicLogic | 0:80ce68cdf568 | 19 | break; |
atomicLogic | 0:80ce68cdf568 | 20 | case 1: |
atomicLogic | 5:06eccc902247 | 21 | { |
atomicLogic | 0:80ce68cdf568 | 22 | char batteryIcon1[8] = {0x0E, 0x1F, 0x11, 0x11, 0x11, 0x11, 0x1F, 0x1F}; |
atomicLogic | 0:80ce68cdf568 | 23 | lcd->defineChar( 1, batteryIcon1 ); |
atomicLogic | 5:06eccc902247 | 24 | } |
atomicLogic | 0:80ce68cdf568 | 25 | break; |
atomicLogic | 0:80ce68cdf568 | 26 | case 2: |
atomicLogic | 5:06eccc902247 | 27 | { |
atomicLogic | 0:80ce68cdf568 | 28 | char batteryIcon2[8] = {0x0E, 0x1F, 0x11, 0x11, 0x11, 0x1F, 0x1F, 0x1F}; |
atomicLogic | 0:80ce68cdf568 | 29 | lcd->defineChar( 1, batteryIcon2 ); |
atomicLogic | 5:06eccc902247 | 30 | } |
atomicLogic | 0:80ce68cdf568 | 31 | break; |
atomicLogic | 0:80ce68cdf568 | 32 | case 3: |
atomicLogic | 5:06eccc902247 | 33 | { |
atomicLogic | 0:80ce68cdf568 | 34 | char batteryIcon3[8] = {0x0E, 0x1F, 0x11, 0x11, 0x1F, 0x1F, 0x1F, 0x1F}; |
atomicLogic | 0:80ce68cdf568 | 35 | lcd->defineChar( 1, batteryIcon3 ); |
atomicLogic | 5:06eccc902247 | 36 | } |
atomicLogic | 0:80ce68cdf568 | 37 | break; |
atomicLogic | 0:80ce68cdf568 | 38 | case 4: |
atomicLogic | 5:06eccc902247 | 39 | { |
atomicLogic | 0:80ce68cdf568 | 40 | char batteryIcon4[8] = {0x0E, 0x1F, 0x11, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F}; |
atomicLogic | 0:80ce68cdf568 | 41 | lcd->defineChar( 1, batteryIcon4 ); |
atomicLogic | 5:06eccc902247 | 42 | } |
atomicLogic | 0:80ce68cdf568 | 43 | break; |
atomicLogic | 0:80ce68cdf568 | 44 | case 5: |
atomicLogic | 5:06eccc902247 | 45 | { |
atomicLogic | 0:80ce68cdf568 | 46 | char batteryIcon5[8] = {0x0E, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F}; |
atomicLogic | 0:80ce68cdf568 | 47 | lcd->defineChar( 1, batteryIcon5 ); |
atomicLogic | 5:06eccc902247 | 48 | } |
atomicLogic | 0:80ce68cdf568 | 49 | break; |
atomicLogic | 0:80ce68cdf568 | 50 | } |
atomicLogic | 0:80ce68cdf568 | 51 | } |
atomicLogic | 0:80ce68cdf568 | 52 | |
atomicLogic | 5:06eccc902247 | 53 | void CostumCharacters::setGpsIcon( int gpsFix ) |
atomicLogic | 0:80ce68cdf568 | 54 | { |
atomicLogic | 0:80ce68cdf568 | 55 | switch( gpsFix ) { |
atomicLogic | 0:80ce68cdf568 | 56 | case 0: |
atomicLogic | 5:06eccc902247 | 57 | { |
atomicLogic | 0:80ce68cdf568 | 58 | char gpsIcon0[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
atomicLogic | 0:80ce68cdf568 | 59 | lcd->defineChar( 2, gpsIcon0 ); |
atomicLogic | 5:06eccc902247 | 60 | } |
atomicLogic | 0:80ce68cdf568 | 61 | break; |
atomicLogic | 0:80ce68cdf568 | 62 | case 1: |
atomicLogic | 5:06eccc902247 | 63 | { |
atomicLogic | 0:80ce68cdf568 | 64 | char gpsIcon1[8] = {0x00, 0x0E, 0x1B, 0x11, 0x1B, 0x0E, 0x0E, 0x04}; |
atomicLogic | 0:80ce68cdf568 | 65 | lcd->defineChar( 2, gpsIcon1 ); |
atomicLogic | 5:06eccc902247 | 66 | } |
atomicLogic | 0:80ce68cdf568 | 67 | break; |
atomicLogic | 0:80ce68cdf568 | 68 | } |
atomicLogic | 0:80ce68cdf568 | 69 | } |
atomicLogic | 0:80ce68cdf568 | 70 | |
atomicLogic | 5:06eccc902247 | 71 | void CostumCharacters::setLoraIcon( int lora ) |
atomicLogic | 0:80ce68cdf568 | 72 | { |
atomicLogic | 0:80ce68cdf568 | 73 | switch( lora ) { |
atomicLogic | 0:80ce68cdf568 | 74 | case 0: |
atomicLogic | 5:06eccc902247 | 75 | { |
atomicLogic | 0:80ce68cdf568 | 76 | char loraIcon0[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
atomicLogic | 0:80ce68cdf568 | 77 | lcd->defineChar( 3, loraIcon0 ); |
atomicLogic | 5:06eccc902247 | 78 | } |
atomicLogic | 0:80ce68cdf568 | 79 | break; |
atomicLogic | 0:80ce68cdf568 | 80 | case 1: |
atomicLogic | 5:06eccc902247 | 81 | { |
atomicLogic | 0:80ce68cdf568 | 82 | char loraIcon1[8] = {0x00, 0x1F, 0x0E, 0x04, 0x04, 0x04, 0x04, 0x04}; |
atomicLogic | 0:80ce68cdf568 | 83 | lcd->defineChar( 3, loraIcon1 ); |
atomicLogic | 5:06eccc902247 | 84 | } |
atomicLogic | 0:80ce68cdf568 | 85 | break; |
atomicLogic | 0:80ce68cdf568 | 86 | } |
atomicLogic | 0:80ce68cdf568 | 87 | } |
atomicLogic | 0:80ce68cdf568 | 88 | |
atomicLogic | 0:80ce68cdf568 | 89 | void CostumCharacters::setLoraStatusIcon( int loraStatus ) |
atomicLogic | 0:80ce68cdf568 | 90 | { |
atomicLogic | 0:80ce68cdf568 | 91 | switch( loraStatus ) { |
atomicLogic | 0:80ce68cdf568 | 92 | case 0: |
atomicLogic | 5:06eccc902247 | 93 | { |
atomicLogic | 0:80ce68cdf568 | 94 | char loraStatus0[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
atomicLogic | 0:80ce68cdf568 | 95 | lcd->defineChar( 4, loraStatus0 ); |
atomicLogic | 5:06eccc902247 | 96 | } |
atomicLogic | 0:80ce68cdf568 | 97 | break; |
atomicLogic | 0:80ce68cdf568 | 98 | case 1: |
atomicLogic | 5:06eccc902247 | 99 | { |
atomicLogic | 0:80ce68cdf568 | 100 | char loraStatus1[8] = {0x04, 0x0E, 0x1F, 0x04, 0x04, 0x04, 0x04, 0x04}; |
atomicLogic | 0:80ce68cdf568 | 101 | lcd->defineChar( 4, loraStatus1 ); |
atomicLogic | 5:06eccc902247 | 102 | } |
atomicLogic | 0:80ce68cdf568 | 103 | break; |
atomicLogic | 0:80ce68cdf568 | 104 | case 2: |
atomicLogic | 5:06eccc902247 | 105 | { |
atomicLogic | 0:80ce68cdf568 | 106 | char loraStatus2[8] = {0x04, 0x04, 0x04, 0x04, 0x04, 0x1F, 0x0E, 0x04}; |
atomicLogic | 0:80ce68cdf568 | 107 | lcd->defineChar( 4, loraStatus2 ); |
atomicLogic | 5:06eccc902247 | 108 | } |
atomicLogic | 0:80ce68cdf568 | 109 | break; |
atomicLogic | 0:80ce68cdf568 | 110 | } |
atomicLogic | 0:80ce68cdf568 | 111 | } |
atomicLogic | 0:80ce68cdf568 | 112 |