├── LICENSE
├── README.md
├── images
├── 2017-04-17 21.56.12.jpg
├── 2017-04-17 21.56.24.jpg
└── 2017-04-21 16.57.11.jpg
├── karadioNokia5110
├── Defines.h
├── ScrnFuncts.ino
├── karadioNokia5110.ino
└── karadioNokia5110.zip
├── karadioU8STM32
├── KaradioUCSTM32l.jpg
├── Thumbs.db
├── karadioU8STM32.ino
├── karadioU8STM32.ino.generic_stm32f103c.bin
├── logo.xbm
├── readme.txt
└── u8glibConf.h
├── karadioU8glib
├── .vs
│ └── karadioU8glib
│ │ └── v14
│ │ └── .atsuo
├── Debug
│ ├── board.buildinfo
│ ├── core.a
│ ├── karadioU8glib.elf
│ ├── karadioU8glib.hex
│ ├── karadioU8glib.ino.elf
│ └── karadioU8glib.ino.hex
├── __vm
│ ├── .karadioU8glib.vsarduino.h
│ ├── Compile.vmps.xml
│ └── Configuration.Debug.vmps.xml
├── karadioU8glib.atsln
├── karadioU8glib.componentinfo.xml
├── karadioU8glib.cppproj
├── karadioU8glib.ino
├── karadioU8glib.ino.eightanaloginputs.hex
├── karadioU8glib.ino.old
├── karadioU8glib.ino.with_bootloader.eightanaloginputs.hex
├── karadioU8glib.zip
├── readme.txt
└── u8glibConf.h
├── karadioUCSTM32
├── 2017-04-17 21.56.12.jpg
├── 2017-04-17 21.56.24.jpg
├── KaradioUCSTM32l.jpg
├── Thumbs.db
├── karadioUCSTM32.ino
├── readme.txt
└── ucglibConf.h
├── karadioUCglib
├── karadioUCglib.ino
├── readme.txt
└── ucglibConf.h
├── karadio_IIC_lcd16x2
├── karadio_IIC_lcd16x2.ino
└── karadioutils.ino
└── karadiolcd16x2
├── karadiolcd16x2.ino
├── karadiolcd16x2.ino.eightanaloginputs.hex
├── karadiolcd16x2.ino.with_bootloader.eightanaloginputs.hex
├── karadiolcd16x2.zip
├── karadiolcd16x2old.ino
└── karadioutils.ino
/README.md:
--------------------------------------------------------------------------------
1 | # Karadio-addons
2 | Collection of addons for the KaraDio project.
3 |
4 | See the Karadio project at https://github.com/karawin/Ka-Radio
5 |
6 | KaradioNokia5110 :(Deprecated): A lcd nokia5110 only interface.
7 | karadiolcd16x2: : same for a 16*2 lcd. Added Four switches by Paul Sijben
8 | karadio_IIC_lcd16x2 : another versio for IIC 16x2 by Puiu Alexandru
9 | karadioU8glib: For monochrome lcd or oled with an arduino pro mini. Optionnal: an IR decoder for the remote control.
10 | karadioUCglib: Same as karadioU8glib but for color lcd.
11 | karadioUCSTM32: A complete interface with a color lcd, IR sensor, encoder knob. Based on a low cost STM32 board.
12 | karadioU8STM32: A complete interface with an oled B/W lcd, IR sensor, encoder knob. Based on a low cost STM32 board.
13 |
14 | To add your own addon, please send me a zip with all files in a directory and a readme.txt.
15 |
16 | #### A nextion touchscreen display for KaraDio from yo2ldk : Here
17 |
18 | #### Some images from these goodies:
19 | 
20 | 
21 | 
22 |
--------------------------------------------------------------------------------
/images/2017-04-17 21.56.12.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karawin/karadio-addons/77df51cf2f692d93382e3dfd87fe8d6e600b0ce8/images/2017-04-17 21.56.12.jpg
--------------------------------------------------------------------------------
/images/2017-04-17 21.56.24.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karawin/karadio-addons/77df51cf2f692d93382e3dfd87fe8d6e600b0ce8/images/2017-04-17 21.56.24.jpg
--------------------------------------------------------------------------------
/images/2017-04-21 16.57.11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karawin/karadio-addons/77df51cf2f692d93382e3dfd87fe8d6e600b0ce8/images/2017-04-21 16.57.11.jpg
--------------------------------------------------------------------------------
/karadioNokia5110/Defines.h:
--------------------------------------------------------------------------------
1 | // defines associated specifically with Nokia 5110 LCD ScrnFuncts
2 | #define PIN_SCE 7
3 | #define PIN_RESET 6
4 | #define PIN_DC 5
5 | #define PIN_SDIN 4
6 | #define PIN_SCLK 3
7 |
8 | #define LCD_C LOW
9 | #define LCD_D HIGH
10 | #define LCD_X 84
11 | #define LCD_Y 48
12 | #define LCD_NLINE 6
13 | #define LCD_NCOL 12
14 |
15 | /* ************************************************ Notes & Changes*********************************************
16 | NOTES:
17 | MiniPRO Pins:
18 | #__ Function_________________________________
19 |
20 | RESET Reset (not used)
21 | Tx 0 n/a (dedicated Serial Input)
22 | Rx 1 Diag Output RS232-TTL 9600 BAUD
23 | PIN 2 n/a
24 | PIN 3-7 Nokia Display (specifics below)
25 | PIN 8 Activate changes to NOKIA contrast B0 --> BF GND and press RESET
26 |
27 | Raw: 3.3 to 16 VDC Max
28 |
29 | Nokia 5110 Graphic LCD Pinout:
30 | _______ Mini Pro____ _______ Nokia GLCD___
31 | #define PIN_SCE 7 LCD CE .... Pin 2
32 | #define PIN_RESET 6 LCD RST .... Pin 1
33 | #define PIN_DC 5 LCD Dat/Com. Pin 3 (DC)
34 | #define PIN_SDIN 4 LCD SPIDat . Pin 4 (DIN)
35 | #define PIN_SCLK 3 LCD SPIClk . Pin 5
36 |
37 | // LCD Gnd .... Pin 8
38 | // LCD Vcc .... Pin 6 3.3 volts from the minipro VCC
39 | // LCD Vled ... Pin 7 (100 to 300 Ohms to Gnd)
40 |
41 | Cable wiring between nodeMcu and Mini Pro
42 | -----------------------------------------
43 | --NodeMcu-- --Mini Pro--
44 | Rx Tx (not used here but useful for touch screen)
45 | Tx Rx
46 | Gnd Gnd
47 | VU Raw
48 |
49 | Extra features:
50 | ---------------
51 | A Jumper between Nokia GLCD pin 7 and 100 ohm + Gnd to switch on or off the lcd light
52 | A7 ---| |--- 100 ohms --- GND
53 | A push button between PIN8 of mini pro and GND to ajust the contrast after a reset.
54 | - Press the switch, reset and wait for the right contrast (16 steps) .
55 | - Release the switch. Done.
56 | The contrast is saved in eprom.
57 |
58 | Warning:
59 | The webradio serial must be set at 28800 b/s
60 |
61 |
62 |
63 | */
64 |
65 |
66 |
--------------------------------------------------------------------------------
/karadioNokia5110/ScrnFuncts.ino:
--------------------------------------------------------------------------------
1 | // Nokia 5110 LCD support functions and font mapping
2 | static const byte ASCII[][5] =
3 | {{0x00, 0x00, 0x00, 0x00, 0x00} // 20
4 | ,{0x00, 0x00, 0x5f, 0x00, 0x00} // 21 !
5 | ,{0x00, 0x07, 0x00, 0x07, 0x00} // 22 "
6 | ,{0x14, 0x7f, 0x14, 0x7f, 0x14} // 23 #
7 | ,{0x24, 0x2a, 0x7f, 0x2a, 0x12} // 24 $
8 | ,{0x23, 0x13, 0x08, 0x64, 0x62} // 25 %
9 | ,{0x36, 0x49, 0x55, 0x22, 0x50} // 26 &
10 | ,{0x00, 0x05, 0x03, 0x00, 0x00} // 27 '
11 | ,{0x00, 0x1c, 0x22, 0x41, 0x00} // 28 (
12 | ,{0x00, 0x41, 0x22, 0x1c, 0x00} // 29 )
13 | ,{0x14, 0x08, 0x3e, 0x08, 0x14} // 2a *
14 | ,{0x08, 0x08, 0x3e, 0x08, 0x08} // 2b +
15 | ,{0x00, 0x50, 0x30, 0x00, 0x00} // 2c ,
16 | ,{0x08, 0x08, 0x08, 0x08, 0x08} // 2d -
17 | ,{0x00, 0x60, 0x60, 0x00, 0x00} // 2e .
18 | ,{0x20, 0x10, 0x08, 0x04, 0x02} // 2f /
19 | ,{0x3e, 0x51, 0x49, 0x45, 0x3e} // 30 0
20 | ,{0x00, 0x42, 0x7f, 0x40, 0x00} // 31 1
21 | ,{0x42, 0x61, 0x51, 0x49, 0x46} // 32 2
22 | ,{0x21, 0x41, 0x45, 0x4b, 0x31} // 33 3
23 | ,{0x18, 0x14, 0x12, 0x7f, 0x10} // 34 4
24 | ,{0x27, 0x45, 0x45, 0x45, 0x39} // 35 5
25 | ,{0x3c, 0x4a, 0x49, 0x49, 0x30} // 36 6
26 | ,{0x01, 0x71, 0x09, 0x05, 0x03} // 37 7
27 | ,{0x36, 0x49, 0x49, 0x49, 0x36} // 38 8
28 | ,{0x06, 0x49, 0x49, 0x29, 0x1e} // 39 9
29 | ,{0x00, 0x36, 0x36, 0x00, 0x00} // 3a :
30 | ,{0x00, 0x56, 0x36, 0x00, 0x00} // 3b ;
31 | ,{0x08, 0x14, 0x22, 0x41, 0x00} // 3c <
32 | ,{0x14, 0x14, 0x14, 0x14, 0x14} // 3d =
33 | ,{0x00, 0x41, 0x22, 0x14, 0x08} // 3e >
34 | ,{0x02, 0x01, 0x51, 0x09, 0x06} // 3f ?
35 | ,{0x32, 0x49, 0x79, 0x41, 0x3e} // 40 @
36 | ,{0x7e, 0x11, 0x11, 0x11, 0x7e} // 41 A
37 | ,{0x7f, 0x49, 0x49, 0x49, 0x36} // 42 B
38 | ,{0x3e, 0x41, 0x41, 0x41, 0x22} // 43 C
39 | ,{0x7f, 0x41, 0x41, 0x22, 0x1c} // 44 D
40 | ,{0x7f, 0x49, 0x49, 0x49, 0x41} // 45 E
41 | ,{0x7f, 0x09, 0x09, 0x09, 0x01} // 46 F
42 | ,{0x3e, 0x41, 0x49, 0x49, 0x7a} // 47 G
43 | ,{0x7f, 0x08, 0x08, 0x08, 0x7f} // 48 H
44 | ,{0x00, 0x41, 0x7f, 0x41, 0x00} // 49 I
45 | ,{0x20, 0x40, 0x41, 0x3f, 0x01} // 4a J
46 | ,{0x7f, 0x08, 0x14, 0x22, 0x41} // 4b K
47 | ,{0x7f, 0x40, 0x40, 0x40, 0x40} // 4c L
48 | ,{0x7f, 0x02, 0x0c, 0x02, 0x7f} // 4d M
49 | ,{0x7f, 0x04, 0x08, 0x10, 0x7f} // 4e N
50 | ,{0x3e, 0x41, 0x41, 0x41, 0x3e} // 4f O
51 | ,{0x7f, 0x09, 0x09, 0x09, 0x06} // 50 P
52 | ,{0x3e, 0x41, 0x51, 0x21, 0x5e} // 51 Q
53 | ,{0x7f, 0x09, 0x19, 0x29, 0x46} // 52 R
54 | ,{0x46, 0x49, 0x49, 0x49, 0x31} // 53 S
55 | ,{0x01, 0x01, 0x7f, 0x01, 0x01} // 54 T
56 | ,{0x3f, 0x40, 0x40, 0x40, 0x3f} // 55 U
57 | ,{0x1f, 0x20, 0x40, 0x20, 0x1f} // 56 V
58 | ,{0x3f, 0x40, 0x38, 0x40, 0x3f} // 57 W
59 | ,{0x63, 0x14, 0x08, 0x14, 0x63} // 58 X
60 | ,{0x07, 0x08, 0x70, 0x08, 0x07} // 59 Y
61 | ,{0x61, 0x51, 0x49, 0x45, 0x43} // 5a Z
62 | ,{0x00, 0x7f, 0x41, 0x41, 0x00} // 5b [
63 | ,{0x02, 0x04, 0x08, 0x10, 0x20} // 5c £¤
64 | ,{0x00, 0x41, 0x41, 0x7f, 0x00} // 5d ]
65 | ,{0x04, 0x02, 0x01, 0x02, 0x04} // 5e ^
66 | ,{0x40, 0x40, 0x40, 0x40, 0x40} // 5f _
67 | ,{0x00, 0x01, 0x02, 0x04, 0x00} // 60 `
68 | ,{0x20, 0x54, 0x54, 0x54, 0x78} // 61 a
69 | ,{0x7f, 0x48, 0x44, 0x44, 0x38} // 62 b
70 | ,{0x38, 0x44, 0x44, 0x44, 0x20} // 63 c
71 | ,{0x38, 0x44, 0x44, 0x48, 0x7f} // 64 d
72 | ,{0x38, 0x54, 0x54, 0x54, 0x18} // 65 e
73 | ,{0x08, 0x7e, 0x09, 0x01, 0x02} // 66 f
74 | ,{0x0c, 0x52, 0x52, 0x52, 0x3e} // 67 g
75 | ,{0x7f, 0x08, 0x04, 0x04, 0x78} // 68 h
76 | ,{0x00, 0x44, 0x7d, 0x40, 0x00} // 69 i
77 | ,{0x20, 0x40, 0x44, 0x3d, 0x00} // 6a j
78 | ,{0x7f, 0x10, 0x28, 0x44, 0x00} // 6b k
79 | ,{0x00, 0x41, 0x7f, 0x40, 0x00} // 6c l
80 | ,{0x7c, 0x04, 0x18, 0x04, 0x78} // 6d m
81 | ,{0x7c, 0x08, 0x04, 0x04, 0x78} // 6e n
82 | ,{0x38, 0x44, 0x44, 0x44, 0x38} // 6f o
83 | ,{0x7c, 0x14, 0x14, 0x14, 0x08} // 70 p
84 | ,{0x08, 0x14, 0x14, 0x18, 0x7c} // 71 q
85 | ,{0x7c, 0x08, 0x04, 0x04, 0x08} // 72 r
86 | ,{0x48, 0x54, 0x54, 0x54, 0x20} // 73 s
87 | ,{0x04, 0x3f, 0x44, 0x40, 0x20} // 74 t
88 | ,{0x3c, 0x40, 0x40, 0x20, 0x7c} // 75 u
89 | ,{0x1c, 0x20, 0x40, 0x20, 0x1c} // 76 v
90 | ,{0x3c, 0x40, 0x30, 0x40, 0x3c} // 77 w
91 | ,{0x44, 0x28, 0x10, 0x28, 0x44} // 78 x
92 | ,{0x0c, 0x50, 0x50, 0x50, 0x3c} // 79 y
93 | ,{0x44, 0x64, 0x54, 0x4c, 0x44} // 7a z
94 | ,{0x00, 0x08, 0x36, 0x41, 0x00} // 7b {
95 | ,{0x00, 0x00, 0x7f, 0x00, 0x00} // 7c |
96 | ,{0x00, 0x41, 0x36, 0x08, 0x00} // 7d }
97 | ,{0x08, 0x08, 0x2A, 0x1C, 0x08} // 7e ->
98 | ,{0x08, 0x1C, 0x2A, 0x08, 0x08} // 7f <-
99 | };
100 |
101 | char disp_tab[]={'0','1','2','3','4','5','6','7','8','9'};
102 |
103 |
104 | void LcdInitialise(void)
105 | { pinMode(PIN_SCE, OUTPUT);
106 | pinMode(PIN_RESET, OUTPUT);
107 | pinMode(PIN_DC, OUTPUT);
108 | pinMode(PIN_SDIN, OUTPUT);
109 | pinMode(PIN_SCLK, OUTPUT);
110 | digitalWrite(PIN_RESET, LOW);
111 | digitalWrite(PIN_RESET, HIGH);
112 | LcdWrite(LCD_C, 0x21 ); // LCD Extended Commands.
113 | // LcdWrite(LCD_C, 0xB3 ); // Set LCD Vop (Contrast). Change for individual display variance, B1, BA, BB, etc. - BF
114 | LcdWrite(LCD_C, NOKIAcontrast );
115 | LcdWrite(LCD_C, 0x04 ); // Set Temp coefficent. //0x04
116 | LcdWrite(LCD_C, 0x14 ); // LCD bias mode 1:48. //0x13
117 | LcdWrite(LCD_C, 0x0C ); // LCD in normal mode.
118 | LcdWrite(LCD_C, 0x20 );
119 | LcdWrite(LCD_C, 0x0C ); }
120 |
121 |
122 | void LcdCharacter(char character)
123 | {
124 | if ((character > 0x7F)||(character < 0x20)) character = 0x20;
125 | LcdWrite(LCD_D, 0x00);
126 | for (int index = 0; index < 5; index++) {
127 | LcdWrite(LCD_D, ASCII[character - 0x20][index]); }
128 | LcdWrite(LCD_D, 0x00); }
129 |
130 |
131 | void LcdClear(void) //20130504 Added nColumn/nRow reset and goto(0, 0)
132 | { for (int index = 0; index < LCD_X * LCD_Y / 8; index++)
133 | { LcdWrite(LCD_D, 0x00); }
134 | nColumn = 0; nRow = 0;
135 | // LcdCurrentLine(2);
136 | gotoXY(0, 0);}
137 |
138 | void removeUtf8(byte *characters)
139 | {
140 | int index = 0;
141 | while (characters[index])
142 | {
143 | if ((characters[index]) == 195)
144 | {
145 | characters[index] = 'x';
146 | // Serial.println((characters[index]));
147 | characters[index+1] +=64;
148 | int sind = index+1;
149 | switch(characters[sind])
150 | {
151 | case 0xFF: case 0xFD:
152 | characters[sind] = 'y'; break;
153 | case 0xDF:
154 | characters[sind] = 'Y'; break;
155 | case 0xE7:
156 | characters[sind] = 'c'; break;
157 | case 0xC7:
158 | characters[sind] = 'C'; break;
159 | case 0xF2: case 0XF3: case 0xF4: case 0xF5: case 0xF6:
160 | characters[sind] = 'o'; break;
161 | case 0xD2: case 0XD3: case 0xD4: case 0xD5: case 0xD6:
162 | characters[sind] = 'O'; break;
163 | case 0xEC: case 0XED: case 0xEE: case 0xEF:
164 | characters[sind] = 'i'; break;
165 | case 0xCC: case 0XCD: case 0xCE: case 0xCF:
166 | characters[sind] = 'I'; break;
167 | case 0xF9: case 0XFA: case 0xFB: case 0xFC:
168 | characters[sind] = 'u'; break;
169 | case 0xD9: case 0XDA: case 0xDB: case 0xDC:
170 | characters[sind] = 'U'; break;
171 | case 0xE8: case 0XE9: case 0xEA: case 0xEB:
172 | characters[sind] = 'e'; break;
173 | case 0xC8: case 0XC9: case 0xCA: case 0xCB:
174 | characters[sind] = 'E'; break;
175 | case 0xE3: case 0XE0: case 0xE1: case 0xE2: case 0xE4: case 0XE5: case 0xE6:
176 | characters[sind] = 'a'; break;
177 | case 0xC3: case 0XC0: case 0xC1: case 0xC2: case 0xC4: case 0XC5: case 0xC6:
178 | characters[sind] = 'A'; break;
179 | default: ;
180 | }
181 | while (characters[sind]) { characters[sind-1] = characters[sind];sind++;}
182 | characters[sind-1] = 0;
183 |
184 | }
185 | index++;
186 | }
187 | }
188 |
189 | void LcdString(char *characters)
190 | { while (*characters)
191 | {LcdCharacter(*characters++); }
192 | }
193 | void LcdnString(char *characters, byte len)
194 | {
195 | int i = 0;
196 | while ((*characters)&& (i++= 12) { // lines fill to 12 characters and increase through line 6 then line 1 is cleared
247 | nColumn = 0;
248 | nRow = ++nRow % 6;
249 | gotoXY(nColumn, nRow);
250 | }
251 | }
252 |
253 | int freeRam () {
254 | extern int __heap_start, *__brkval;
255 | int v;
256 | return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
257 | }
258 |
259 |
260 |
261 |
--------------------------------------------------------------------------------
/karadioNokia5110/karadioNokia5110.ino:
--------------------------------------------------------------------------------
1 | /*
2 | This implementation specific to Arduino Mini-Pro 328 running at 3.3V
3 | and used with a NOKIA 5110 Craphic LCD.
4 |
5 | Built under Arduino 1.6.10
6 | Derived from https://create.arduino.cc/projecthub/rayburne/tiny-serial-terminal-151988
7 | */
8 | #define version 1.0
9 | #include
10 | #include "Defines.h" // Nokia 5110 LCD pin usage as controlled by "ScrnFuncts.ino"
11 |
12 | // constants
13 | const int BAUD = 28800; // any standard serial value: 300 - 115200
14 | const int EEaddr = 0; // EEPROM address for storing WPM
15 | const int EEaddr1 = 2; // EEPROM address for LCD address
16 | const int EEaddrIp = 10; // EEPROM address for the IP
17 | // Arduino 328P pins (not physical)
18 |
19 | const byte ContrastPin = 8; // D8 low activates the Contrast adjustment
20 |
21 | // global prog variables
22 |
23 | byte nRow; // line count (0-5 for NOKIA LCD)
24 | byte nColumn; // character count (0-11 for NOKIA LCD)
25 | byte NOKIAcontrast; // LCD initialization contrast values B0 thru BF
26 | char temp;
27 |
28 | // Character array pointers
29 | char msg[] = {"Karadio for nokia 84*48 (c) KaraWin "}; //
30 | char BlankLine[] = {" "}; // Nokia 12 x 6 (84 * 48)
31 | // char anim = {"-\\|/"};
32 |
33 |
34 | // Karadio specific data
35 | #define BUFLEN 200
36 | char line[BUFLEN]; // receive budder
37 | char station[BUFLEN];
38 | char title[BUFLEN];
39 | char nameset[BUFLEN];
40 | char* ici;
41 | unsigned index = 0;
42 | unsigned iStation = 0;
43 | unsigned iTitle = 0;
44 | unsigned loopcount = 0;
45 | unsigned loopcount1 = 0;
46 | byte loopflip = 0;
47 | char arrow[] = {0x7e};
48 |
49 | void setup(void)
50 | {
51 | char oip[20];
52 | pinMode(13, OUTPUT);
53 | pinMode(ContrastPin, INPUT);
54 | digitalWrite(ContrastPin, HIGH); // activate internal pullup resistor
55 |
56 | Serial.begin(BAUD);
57 | // Serial.println(F("Karadio display nokia 84 * 48"));
58 | Serial.println(F("Free RAM available:")) ;
59 | Serial.print(freeRam());
60 |
61 | ReStart: // Come back here if LCD contract is changed
62 | // Read the EEPROM to determine if display is using a custom contrast value
63 | NOKIAcontrast = EEPROM.read(EEaddr1);
64 | // Set the Nokia LCD Contrast to default or reset if EEPROM is corrupt or set to new value
65 | if (NOKIAcontrast < 0xB0 || NOKIAcontrast > 0xBF) NOKIAcontrast = 0xB2;
66 | // LCD
67 | LcdInitialise();
68 | LcdClear();
69 | LcdString(msg);
70 | eepromReadStr(EEaddrIp, oip);
71 | displayStr(oip,4,2);
72 | delay(2000);
73 | if (!digitalRead(ContrastPin)) {
74 | NOKIAcontrast++;
75 | if (NOKIAcontrast > 0xBF) NOKIAcontrast = 0xB0;
76 | EEPROM.write(EEaddr1, NOKIAcontrast);
77 | goto ReStart;
78 | }
79 |
80 | nRow = 0; nColumn = 0;
81 | gotoXY(nColumn, nRow);
82 | // LcdClear(); // nRow = 0; nColumn = 0 done by function LcdClear()
83 |
84 | }
85 |
86 | //scroll this at index istr at row on nline line
87 | void scroll(char* ici,unsigned* istr, byte row, byte nline)
88 | {
89 | unsigned len = strlen(ici+*istr);
90 |
91 | if ( len > ((nline)*LCD_NCOL)) // somethink to scroll
92 | {
93 | for (int i = 0;i 0))// &&(*istr >0))
103 | {
104 | if (*istr >0)
105 | for (int i = 0;i at)
154 | {
155 | int i = 0;
156 | while (( from[at -i] != ' ')&& ( i< LCD_NCOL))
157 | {i++; }
158 | if ((i < LCD_NCOL)&&(i!=1))
159 | {
160 | char tmp[256];
161 | strcpy(tmp,from+at-i+1);
162 | strcpy(from+at,tmp);
163 | for (i;i>0;i--)
164 | from[at-i] = ' ';
165 | }
166 | }
167 | }
168 |
169 | int separator(char* from)
170 | {
171 | byte len;
172 | char tmp[256];
173 | char* interp;
174 | int ret = 1;
175 | len = strlen(from);
176 | while (from[strlen(from)-1] == ' ') from[strlen(from)-1] = 0; // avoid blank at end
177 | while ((from[0] == arrow[0])&& (from[1] == ' ') ){ strcpy( from+1,from+2); }
178 | interp=strstr(from," - ");
179 | while( (interp != NULL)&&((interp-from) > LCD_NCOL*ret)) {cesure(from,LCD_NCOL*ret);interp=strstr(from," - ");ret++;}
180 | // Serial.println(from);
181 | if (interp != NULL)
182 | {
183 | len = strlen(from);
184 | if (from != station)
185 | {
186 | strcpy(tmp,arrow);
187 | strcpy(tmp+1,interp+3);
188 | } else
189 | strcpy(tmp,interp+3);
190 | interp[0]=0;
191 | // Serial.println(tmp);
192 | len -= strlen(tmp)+3;
193 | len %= LCD_NCOL;
194 | len = LCD_NCOL -len ;
195 | /*if (len != 12)*/for (byte i = 0; i mul*LCD_NCOL)
214 | cesure(title,mul++*LCD_NCOL);
215 | scroll(title,&iTitle,3,3) ;
216 | } else
217 | ////// ICY0
218 | if ((ici=strstr(line,"Y0#: ")) != NULL)
219 | {
220 | int len;
221 | clearAll();
222 | LcdCurrentLine(2);
223 | strcpy(station,arrow);
224 | station[1] = 0;
225 | for (int i = 0;i<2;i++) // clear lines
226 | {
227 | gotoXY(0,i);
228 | LcdString(BlankLine);
229 | }
230 | strcat(station,ici+5);
231 | if (strlen(station) < 2) strcpy(station,nameset);
232 | mul = separator(station);
233 | while (strlen(station) > mul*LCD_NCOL)
234 | cesure(station,mul++*LCD_NCOL);
235 |
236 | scroll(station,&iStation,0,2);
237 | // displayStr(station,0,2);
238 | } else
239 | ////// STOPPED
240 | if ((ici=strstr(line,"STOPPED")) != NULL)
241 | {
242 | cleartitle();
243 | displayStr((char*)" STOPPED ",4, 1);
244 | }
245 | /////// Station Ip
246 | else
247 | if ((ici=strstr(line,"Station Ip: ")) != NULL)
248 | {
249 | char sip[20];
250 | char oip[20];
251 | eepromReadStr(EEaddrIp, oip);
252 | if ( strcmp(oip,ici+12) != 0)
253 | eepromWriteStr(EEaddrIp,ici+12 );
254 | displayStr(ici+12,4,2);
255 | } else
256 | //////Nameset
257 | if ((ici=strstr(line,"ESET#: ")) != NULL)
258 | {
259 | int len;
260 | strcpy(nameset,arrow);
261 | nameset[1] = 0;
262 | for (int i = 0;i<2;i++) // clear lines
263 | {
264 | gotoXY(0,i);
265 | LcdString(BlankLine);
266 | }
267 | strcat(nameset,ici+7);
268 | /* mul = separator(nameset);
269 | while (strlen(nameset) > mul*LCD_NCOL)
270 | cesure(nameset,mul++*LCD_NCOL);
271 | scroll(nameset,&iStation,0,2);
272 | */
273 | } else
274 | //////Playing
275 | if ((ici=strstr(line,"YING#")) != NULL)
276 | {
277 | if (strlen(station) == 0)
278 | {
279 | mul = separator(nameset);
280 | while (strlen(nameset) > mul*LCD_NCOL)
281 | cesure(nameset,mul++*LCD_NCOL);
282 | scroll(nameset,&iStation,0,2);
283 | }
284 | }
285 | for (int i = 0; i< BUFLEN;i++) line[i] = 0; // clear buffer line
286 | }
287 | void eepromReadStr(int addr, char* str)
288 | {
289 | byte rd;
290 | do {
291 | rd = EEPROM.read(addr++);
292 | *str = rd;
293 | // Serial.println(str[0],16);
294 | str++;
295 | } while (( rd != 0)&&( rd != 0xFF));
296 | }
297 | void eepromWriteStr(int addr, char* str)
298 | {
299 | byte rd;
300 | do {
301 | EEPROM.write( addr++,*str);
302 | rd = *str;
303 | str++;
304 | } while (( rd != 0)&&( rd != 0xFF));
305 | }
306 | void loop(void)
307 | {
308 | char temp;
309 | if ((temp=Serial.read()) != -1)
310 | {
311 | // char temp = Serial.read();
312 | // Serial << temp; // for diagnostic and Arduino term echo
313 | switch (temp)
314 | {
315 | case '\n' : break;
316 | case '\r' :
317 | line[index] = 0; // end of string
318 | index = 0;
319 | parse(line);
320 | break;
321 | default : // put the received char in line
322 | if (index>BUFLEN) break; // small memory so small buffer
323 | line[index++] = temp;
324 | }
325 | }
326 |
327 | if (loopcount++ == -1)
328 | {
329 | if (loopcount1++ == 2)
330 | {
331 | digitalWrite(13, HIGH);
332 | if ((loopflip++%2) == 0)
333 | scroll(station,&iStation,0,2);
334 | else
335 | scroll(title,&iTitle,3,3) ;
336 | loopcount1 = 0; loopcount = 0;
337 | digitalWrite(13, LOW);
338 | }
339 | }
340 | }
341 |
342 |
--------------------------------------------------------------------------------
/karadioNokia5110/karadioNokia5110.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karawin/karadio-addons/77df51cf2f692d93382e3dfd87fe8d6e600b0ce8/karadioNokia5110/karadioNokia5110.zip
--------------------------------------------------------------------------------
/karadioU8STM32/KaradioUCSTM32l.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karawin/karadio-addons/77df51cf2f692d93382e3dfd87fe8d6e600b0ce8/karadioU8STM32/KaradioUCSTM32l.jpg
--------------------------------------------------------------------------------
/karadioU8STM32/Thumbs.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karawin/karadio-addons/77df51cf2f692d93382e3dfd87fe8d6e600b0ce8/karadioU8STM32/Thumbs.db
--------------------------------------------------------------------------------
/karadioU8STM32/karadioU8STM32.ino.generic_stm32f103c.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karawin/karadio-addons/77df51cf2f692d93382e3dfd87fe8d6e600b0ce8/karadioU8STM32/karadioU8STM32.ino.generic_stm32f103c.bin
--------------------------------------------------------------------------------
/karadioU8STM32/logo.xbm:
--------------------------------------------------------------------------------
1 | #define logo_width 60
2 | #define logo_height 51
3 | static char logo_bits[] = {
4 | 0xFF, 0xFF, 0x3F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0xFF, 0xFF, 0x07, 0x00,
5 | 0x00, 0xFE, 0xFF, 0x0F, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0xF8, 0xFF, 0x0F,
6 | 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0xFF, 0x3F, 0x00, 0x00,
7 | 0x00, 0xC0, 0xFF, 0x0F, 0xFF, 0x1D, 0x20, 0x00, 0x40, 0x80, 0xFF, 0x0F,
8 | 0x7F, 0x0E, 0x90, 0x00, 0x80, 0x00, 0xFF, 0x0F, 0x3F, 0x07, 0x40, 0x00,
9 | 0x20, 0x00, 0xFE, 0x0F, 0xBF, 0x03, 0x48, 0x00, 0x20, 0x01, 0xFC, 0x0F,
10 | 0xDF, 0x03, 0x08, 0x61, 0x48, 0x00, 0xF8, 0x0F, 0xCF, 0x01, 0x20, 0xF9,
11 | 0x49, 0x02, 0xF8, 0x0F, 0xE7, 0x00, 0xA4, 0xF8, 0x41, 0x02, 0xF0, 0x0F,
12 | 0xF7, 0x00, 0x24, 0xFC, 0x53, 0x00, 0xE0, 0x0F, 0x73, 0x00, 0x84, 0xFC,
13 | 0x03, 0x02, 0xE0, 0x0F, 0x7B, 0x00, 0x20, 0xF8, 0x51, 0x02, 0xC0, 0x0F,
14 | 0x39, 0x00, 0x24, 0xF9, 0x48, 0x00, 0xC0, 0x0F, 0x3D, 0x00, 0x28, 0x60,
15 | 0x00, 0x01, 0xC0, 0x0F, 0x1D, 0x00, 0x40, 0x72, 0x24, 0x01, 0x80, 0x0F,
16 | 0x1C, 0x00, 0x48, 0xF0, 0x90, 0x00, 0x80, 0x0F, 0x1E, 0x00, 0x90, 0xF0,
17 | 0x80, 0x00, 0x80, 0x0F, 0x1E, 0x00, 0x20, 0xF0, 0x40, 0x00, 0x80, 0x0F,
18 | 0x1E, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x0F, 0x0E, 0x00, 0x00, 0xF0,
19 | 0xC0, 0x1F, 0x00, 0x0F, 0x0E, 0x60, 0x30, 0xB8, 0xC1, 0x3F, 0x00, 0x0F,
20 | 0x0E, 0x60, 0x18, 0xD8, 0xC1, 0x70, 0x00, 0x0F, 0x0E, 0x70, 0x1C, 0xF8,
21 | 0xC1, 0x60, 0x00, 0x0F, 0x0F, 0x60, 0x0C, 0x98, 0xE1, 0x60, 0x00, 0x0F,
22 | 0x0E, 0x30, 0x06, 0x98, 0xC1, 0x60, 0x00, 0x0F, 0x0E, 0x70, 0x03, 0xBC,
23 | 0xC1, 0x60, 0x00, 0x0F, 0x0F, 0xA0, 0x03, 0x9C, 0xC3, 0x70, 0x00, 0x0F,
24 | 0x1F, 0xF0, 0x01, 0x0C, 0xC3, 0x3F, 0x80, 0x0F, 0x1F, 0xE0, 0x01, 0xDC,
25 | 0xC3, 0x0F, 0x80, 0x0F, 0x1F, 0x60, 0x03, 0x0C, 0xE3, 0x0C, 0x80, 0x0F,
26 | 0x1F, 0x70, 0x07, 0x0C, 0xC3, 0x1C, 0x80, 0x0F, 0x3F, 0x60, 0x06, 0x0C,
27 | 0xC7, 0x18, 0xC0, 0x0F, 0x3F, 0x70, 0x0C, 0xDE, 0xC7, 0x30, 0xC0, 0x0F,
28 | 0x3F, 0x60, 0x18, 0x06, 0xC6, 0x70, 0xC0, 0x0F, 0x7F, 0x70, 0x38, 0x06,
29 | 0xC6, 0x60, 0xE0, 0x0F, 0x7F, 0x20, 0x30, 0xFE, 0x47, 0x20, 0xF0, 0x0F,
30 | 0xFF, 0x00, 0x00, 0x07, 0x06, 0x00, 0xF0, 0x0F, 0xFF, 0x01, 0x00, 0x03,
31 | 0x0C, 0x00, 0xF8, 0x0F, 0xFF, 0x01, 0x00, 0xDF, 0x0F, 0x00, 0xF8, 0x0F,
32 | 0xFF, 0x03, 0x00, 0x03, 0x0C, 0x00, 0xFC, 0x0F, 0xFF, 0x07, 0x00, 0x03,
33 | 0x0C, 0x00, 0xFE, 0x0F, 0xFF, 0x0F, 0x00, 0x03, 0x1C, 0x00, 0xFF, 0x0F,
34 | 0xFF, 0x1F, 0x80, 0x01, 0x08, 0x80, 0xFF, 0x0F, 0xFF, 0x3F, 0x00, 0x00,
35 | 0x00, 0xC0, 0xFF, 0x0F, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x0F,
36 | 0xFF, 0xFF, 0x03, 0x00, 0x00, 0xFC, 0xFF, 0x0F, 0xFF, 0xFF, 0x0F, 0x00,
37 | 0x00, 0xFF, 0xFF, 0x0F, 0xFF, 0xFF, 0x3F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F,
38 | };
39 |
--------------------------------------------------------------------------------
/karadioU8STM32/readme.txt:
--------------------------------------------------------------------------------
1 | This product is the software needed to connect a lcd display and IR remote receiver to the karadio project.
2 | It will be improved to connect a KY040 rotary encoder.
3 | https://github.com/karawin/Ka-Radio
4 | https://hackaday.io/project/11570-wifi-webradio-with-esp8266-and-vs1053
5 |
6 | It run on a stm32 bluePill board.
7 |
8 | The wiring and other important infos and warnings are at the end of the ucglibConf.h file.
9 |
10 | If you use an IR remote control, please uncomment the #define IR at the beginning of the ino file.
11 |
--------------------------------------------------------------------------------
/karadioU8STM32/u8glibConf.h:
--------------------------------------------------------------------------------
1 | // u8glibConf.h
2 |
3 | #ifndef _U8GLIBCONF_h
4 | #define _U8GLIBCONF_h
5 | #define logo_width 60
6 | #define logo_height 51
7 |
8 | #include "U8glib.h"
9 | static unsigned char logo_bits[] PROGMEM = {
10 | 0xFF, 0xFF, 0x3F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0xFF, 0xFF, 0x07, 0x00,
11 | 0x00, 0xFE, 0xFF, 0x0F, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0xF8, 0xFF, 0x0F,
12 | 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0xFF, 0x3F, 0x00, 0x00,
13 | 0x00, 0xC0, 0xFF, 0x0F, 0xFF, 0x1D, 0x20, 0x00, 0x40, 0x80, 0xFF, 0x0F,
14 | 0x7F, 0x0E, 0x90, 0x00, 0x80, 0x00, 0xFF, 0x0F, 0x3F, 0x07, 0x40, 0x00,
15 | 0x20, 0x00, 0xFE, 0x0F, 0xBF, 0x03, 0x48, 0x00, 0x20, 0x01, 0xFC, 0x0F,
16 | 0xDF, 0x03, 0x08, 0x61, 0x48, 0x00, 0xF8, 0x0F, 0xCF, 0x01, 0x20, 0xF9,
17 | 0x49, 0x02, 0xF8, 0x0F, 0xE7, 0x00, 0xA4, 0xF8, 0x41, 0x02, 0xF0, 0x0F,
18 | 0xF7, 0x00, 0x24, 0xFC, 0x53, 0x00, 0xE0, 0x0F, 0x73, 0x00, 0x84, 0xFC,
19 | 0x03, 0x02, 0xE0, 0x0F, 0x7B, 0x00, 0x20, 0xF8, 0x51, 0x02, 0xC0, 0x0F,
20 | 0x39, 0x00, 0x24, 0xF9, 0x48, 0x00, 0xC0, 0x0F, 0x3D, 0x00, 0x28, 0x60,
21 | 0x00, 0x01, 0xC0, 0x0F, 0x1D, 0x00, 0x40, 0x72, 0x24, 0x01, 0x80, 0x0F,
22 | 0x1C, 0x00, 0x48, 0xF0, 0x90, 0x00, 0x80, 0x0F, 0x1E, 0x00, 0x90, 0xF0,
23 | 0x80, 0x00, 0x80, 0x0F, 0x1E, 0x00, 0x20, 0xF0, 0x40, 0x00, 0x80, 0x0F,
24 | 0x1E, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x0F, 0x0E, 0x00, 0x00, 0xF0,
25 | 0xC0, 0x1F, 0x00, 0x0F, 0x0E, 0x60, 0x30, 0xB8, 0xC1, 0x3F, 0x00, 0x0F,
26 | 0x0E, 0x60, 0x18, 0xD8, 0xC1, 0x70, 0x00, 0x0F, 0x0E, 0x70, 0x1C, 0xF8,
27 | 0xC1, 0x60, 0x00, 0x0F, 0x0F, 0x60, 0x0C, 0x98, 0xE1, 0x60, 0x00, 0x0F,
28 | 0x0E, 0x30, 0x06, 0x98, 0xC1, 0x60, 0x00, 0x0F, 0x0E, 0x70, 0x03, 0xBC,
29 | 0xC1, 0x60, 0x00, 0x0F, 0x0F, 0xA0, 0x03, 0x9C, 0xC3, 0x70, 0x00, 0x0F,
30 | 0x1F, 0xF0, 0x01, 0x0C, 0xC3, 0x3F, 0x80, 0x0F, 0x1F, 0xE0, 0x01, 0xDC,
31 | 0xC3, 0x0F, 0x80, 0x0F, 0x1F, 0x60, 0x03, 0x0C, 0xE3, 0x0C, 0x80, 0x0F,
32 | 0x1F, 0x70, 0x07, 0x0C, 0xC3, 0x1C, 0x80, 0x0F, 0x3F, 0x60, 0x06, 0x0C,
33 | 0xC7, 0x18, 0xC0, 0x0F, 0x3F, 0x70, 0x0C, 0xDE, 0xC7, 0x30, 0xC0, 0x0F,
34 | 0x3F, 0x60, 0x18, 0x06, 0xC6, 0x70, 0xC0, 0x0F, 0x7F, 0x70, 0x38, 0x06,
35 | 0xC6, 0x60, 0xE0, 0x0F, 0x7F, 0x20, 0x30, 0xFE, 0x47, 0x20, 0xF0, 0x0F,
36 | 0xFF, 0x00, 0x00, 0x07, 0x06, 0x00, 0xF0, 0x0F, 0xFF, 0x01, 0x00, 0x03,
37 | 0x0C, 0x00, 0xF8, 0x0F, 0xFF, 0x01, 0x00, 0xDF, 0x0F, 0x00, 0xF8, 0x0F,
38 | 0xFF, 0x03, 0x00, 0x03, 0x0C, 0x00, 0xFC, 0x0F, 0xFF, 0x07, 0x00, 0x03,
39 | 0x0C, 0x00, 0xFE, 0x0F, 0xFF, 0x0F, 0x00, 0x03, 0x1C, 0x00, 0xFF, 0x0F,
40 | 0xFF, 0x1F, 0x80, 0x01, 0x08, 0x80, 0xFF, 0x0F, 0xFF, 0x3F, 0x00, 0x00,
41 | 0x00, 0xC0, 0xFF, 0x0F, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x0F,
42 | 0xFF, 0xFF, 0x03, 0x00, 0x00, 0xFC, 0xFF, 0x0F, 0xFF, 0xFF, 0x0F, 0x00,
43 | 0x00, 0xFF, 0xFF, 0x0F, 0xFF, 0xFF, 0x3F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F,
44 | };
45 |
46 |
47 | #ifdef oled096
48 | U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
49 | #endif
50 | #ifdef oled130
51 | U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
52 | #endif
53 | #ifdef ST7920
54 | U8GLIB_ST7920_128X64_1X u8g(PA5, PA7, PA4); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
55 | #endif
56 | #endif
57 |
58 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
59 | /*
60 | Version 1.0 first release
61 | */
62 |
63 |
64 | /**** Instruction for 128X64 OLED LCD LED Display Module white For Arduino 0.96" I2C IIC SPI Serial *************************
65 | * + IR + Rotary encoder
66 | ----------------------------------------------------------------------------------------------
67 | NOTES:
68 | Confirmed vendor:
69 | lcd:
70 | https://www.aliexpress.com/item/Free-shipping-1Pcs-128X64-OLED-LCD-LED-Display-Module-white-For-Arduino-0-96-I2C-IIC/32671702306.html?spm=2114.13010608.0.0.9K7DWb
71 |
72 | STM32:
73 | https://www.aliexpress.com/item/1pcs-STM32F103C8T6-ARM-STM32-Minimum-System-Development-Board-Module-For-arduino/32720697607.html?spm=2114.13010608.0.0.Dm20du
74 | https://www.aliexpress.com/item/1pcs-STM32F103C8T6-ARM-STM32-Minimum-System-Development-Board-Module-For-arduino/32720697607.html?spm=2114.13010608.0.0.9K7DWb
75 |
76 | Rotary Encoder Module KY-040:
77 | https://www.aliexpress.com/item/5pcs-lot-Rotary-Encoder-Module-Free-Shipping-Dropshipping-KY-040-for-Arduino/32218652643.html?spm=2114.13010608.0.0.Dm20du
78 |
79 | Infrared IR wireless:
80 | https://www.aliexpress.com/item/Hot-Selling-1pcs-New-Infrared-IR-Wireless-Remote-Control-Module-Kits-For-Arduino-Wholesale/32334118062.html?spm=2114.13010608.0.0.j3B4M6
81 |
82 | --------
83 | Pins:
84 | --------
85 | See http://karadio.karawin.fr/images/KaradioUCSTM32l.jpg
86 |
87 | Cable wiring between Graphic LCD and STM32:
88 | -------------------------------------------
89 | ___STM32___LCD_______________
90 | PB7 LCD SDA .... PIN 4
91 | PB6 LCD SCK .... Pin 3
92 | Gnd LCD Gnd .... Pin 1 or 2 (see the board)
93 | 3.3 LCD Vcc .... Pin 2 or 1 (for your model)
94 |
95 |
96 | Cable wiring between nodeMcu and stm32
97 | --------------------------------------
98 | --NodeMcu-- --stm32
99 | Tx Rx PA10
100 | Rx Tx PA9
101 | Gnd Gnd
102 | VU or 5V 5V
103 |
104 | Cable wiring between STM32 and IR:
105 | ----------------------------------
106 | The IR receiver pins:
107 | From left to right (pin at bottom, sensor in front of you)
108 | GND 3.3 SIGNAL
109 | to STM32:
110 | GND 3.3 PC15
111 |
112 | Cable wiring between STM32 and KY040:
113 | -------------------------------------
114 | --KY040-- --STM32--
115 | A PB12
116 | B PB13
117 | Switch PB14
118 | Vcc
119 | Gnd
120 |
121 | Software:
122 | ---------
123 | STM32DUINO (to add support of the stm32 with arduino IDE:
124 | https://github.com/rogerclarkmelbourne/Arduino_STM32
125 | Bootloader (see http://wiki.stm32duino.com/index.php?title=Bootloader)
126 | https://github.com/rogerclarkmelbourne/STM32duino-bootloader (the one we need is generic_boot20_pc13.bin)
127 | Instruction to load the bootloader on stm32 (one time)
128 | http://www.stm32duino.com/viewtopic.php?f=32&t=413
129 | http://wiki.stm32duino.com/index.php?title=Uploading_a_sketch
130 |
131 | Board: Generic STM32F103C series
132 | Tools/variant set to 128K flash
133 |
134 | Libraries needed:
135 | u8glib for stm32 must be installed in arduino IDE library;
136 | https://github.com/karawin/U8glib_Arduino
137 |
138 | IRMP library for stm32Duino:
139 | https://github.com/karawin/irmp-master
140 | See https://www.mikrocontroller.net/articles/IRMP_-_english
141 |
142 | KY040 library:
143 | https://github.com/karawin/encoder
144 |
145 | IMPORTANT:
146 | In C:\Users\jp\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\Wire
147 | In wirebase.h change
148 | In line 47
149 | #define WIRE_BUFSIZ 32
150 | to
151 | #define WIRE_BUFSIZ 256
152 |
153 | Define your tzo (time zone offset) at the beginning of the ino.
154 |
155 |
156 | --------
157 | WARNING:
158 | The webradio serial must be set at 115200 bauds
159 | --------
160 |
161 | In karadioU8STM32.ino:
162 | // Uncomment the following line to see the code of your remote control and report to the case the value
163 | // Serial.println(irmp_protocol_names[irmp_data.protocol]);
164 | // Serial.println(irmp_data.address,HEX);
165 | // Serial.println(irmp_data.command,HEX);
166 | // Serial.println(irmp_data.flags,HEX);
167 | // Serial.println(code,HEX);
168 | // Serial.println();
169 | If you want to use another remote, you can see the code of the keys and modify the switch case for the needed function.
170 | See IRMP.h to add the protocol you need for the remote.
171 |
172 | Enjoy.
173 |
174 | jpc 05/2017
175 | */
176 |
--------------------------------------------------------------------------------
/karadioU8glib/.vs/karadioU8glib/v14/.atsuo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karawin/karadio-addons/77df51cf2f692d93382e3dfd87fe8d6e600b0ce8/karadioU8glib/.vs/karadioU8glib/v14/.atsuo
--------------------------------------------------------------------------------
/karadioU8glib/Debug/core.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karawin/karadio-addons/77df51cf2f692d93382e3dfd87fe8d6e600b0ce8/karadioU8glib/Debug/core.a
--------------------------------------------------------------------------------
/karadioU8glib/Debug/karadioU8glib.elf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karawin/karadio-addons/77df51cf2f692d93382e3dfd87fe8d6e600b0ce8/karadioU8glib/Debug/karadioU8glib.elf
--------------------------------------------------------------------------------
/karadioU8glib/Debug/karadioU8glib.ino.elf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karawin/karadio-addons/77df51cf2f692d93382e3dfd87fe8d6e600b0ce8/karadioU8glib/Debug/karadioU8glib.ino.elf
--------------------------------------------------------------------------------
/karadioU8glib/__vm/.karadioU8glib.vsarduino.h:
--------------------------------------------------------------------------------
1 | /*
2 | Editor: http://www.visualmicro.com
3 | visual micro and the arduino ide ignore this code during compilation. this code is automatically maintained by visualmicro, manual changes to this file will be overwritten
4 | the contents of the Visual Micro sketch sub folder can be deleted prior to publishing a project
5 | all non-arduino files created by visual micro and all visual studio project or solution files can be freely deleted and are not required to compile a sketch (do not delete your own code!).
6 | note: debugger breakpoints are stored in '.sln' or '.asln' files, knowledge of last uploaded breakpoints is stored in the upload.vmps.xml file. Both files are required to continue a previous debug session without needing to compile and upload again
7 |
8 | Hardware: Arduino Pro or Pro Mini w/ ATmega328 (5V, 16 MHz), Platform=avr, Package=arduino
9 | */
10 |
11 | #define __AVR_ATmega328p__
12 | #define __AVR_ATmega328P__
13 | #define ARDUINO 106013
14 | #define ARDUINO_MAIN
15 | #define F_CPU 16000000L
16 | #define __AVR__
17 | #define F_CPU 16000000L
18 | #define ARDUINO 106013
19 | #define ARDUINO_AVR_PRO
20 | #define ARDUINO_ARCH_AVR
21 |
22 | void u8g_prepare(void);
23 | void clearAll();
24 | void cleartitle();
25 | void eepromReadStr(int addr, char* str);
26 | void eepromWriteStr(int addr, char* str);
27 | void separator(char* from);
28 | void parse(char* line);
29 | void setup2();
30 | void setup(void);
31 | void serial();
32 | void draw(int xx);
33 | void scroll();
34 | void translateIR();
35 | void loop(void);
36 | void loop(void);
37 | int freeRam ();
38 | void removeUtf8(byte *characters);
39 |
40 | #include "pins_arduino.h"
41 | #include "arduino.h"
42 | #include "karadioU8glib.ino"
43 | #include "karadioutils.ino"
44 |
--------------------------------------------------------------------------------
/karadioU8glib/__vm/Compile.vmps.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/karadioU8glib/__vm/Configuration.Debug.vmps.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/karadioU8glib/karadioU8glib.atsln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Atmel Studio Solution File, Format Version 11.00
4 | VisualStudioVersion = 14.0.23107.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{E66E83B9-2572-4076-B26E-6BE79FF3018A}") = "karadioU8glib", "karadioU8glib.cppproj", "{1535724F-CC0A-4340-805D-5733DE6BE788}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|AVR = Debug|AVR
11 | Release|AVR = Release|AVR
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {1535724F-CC0A-4340-805D-5733DE6BE788}.Debug|AVR.ActiveCfg = Debug|AVR
15 | {1535724F-CC0A-4340-805D-5733DE6BE788}.Debug|AVR.Build.0 = Debug|AVR
16 | {1535724F-CC0A-4340-805D-5733DE6BE788}.Release|AVR.ActiveCfg = Release|AVR
17 | {1535724F-CC0A-4340-805D-5733DE6BE788}.Release|AVR.Build.0 = Release|AVR
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/karadioU8glib/karadioU8glib.componentinfo.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/karadioU8glib/karadioU8glib.cppproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 2.0
5 | 7.0
6 | com.Atmel.AVRGCC8.CPP
7 | {1535724f-cc0a-4340-805d-5733de6be788}
8 | atmega328p
9 | none
10 | Executable
11 | CPP
12 | $(MSBuildProjectName)
13 | .elf
14 | $(MSBuildProjectDirectory)\$(Configuration)
15 | karadioU8glib
16 | karadioU8glib
17 | karadioU8glib
18 | Native
19 | true
20 | false
21 |
22 |
23 | 0
24 | true
25 | 0x20000000
26 | true
27 |
28 | 0
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | true
42 |
43 |
44 |
45 |
46 | True
47 | True
48 | True
49 | True
50 | False
51 | True
52 | True
53 |
54 |
55 | __AVR_ATmega328p__
56 | __AVR_ATmega328P__
57 | ARDUINO=106013
58 | ARDUINO_MAIN
59 | F_CPU=16000000L
60 | __AVR__
61 | ARDUINO_AVR_PRO
62 | ARDUINO_ARCH_AVR
63 |
64 |
65 |
66 |
67 | C:/Users/jp/Documents/Arduino/libraries/U8glib
68 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries/EEPROM/src
69 | C:/Users/jp/Documents/Arduino/libraries/Arduino-IRremote-master
70 | C:/Users/jp/Documents/Arduino/libraries/Arduino-IRremote-master/utility
71 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries/EEPROM/src/utility
72 | C:/Program Files (x86)/Arduino/libraries
73 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries
74 | C:/Users/jp/Documents/Arduino/libraries
75 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/cores/arduino
76 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/variants/eightanaloginputs
77 | ../../../karadioU8glib
78 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/avr/include/
79 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2//avr/include/avr/
80 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/lib/gcc/avr/4.8.1/include
81 |
82 |
83 | Optimize (-O1)
84 | True
85 | True
86 | Default (-g2)
87 | True
88 | True
89 | True
90 |
91 |
92 | __AVR_ATmega328p__
93 | __AVR_ATmega328P__
94 | ARDUINO=106013
95 | ARDUINO_MAIN
96 | F_CPU=16000000L
97 | __AVR__
98 | ARDUINO_AVR_PRO
99 | ARDUINO_ARCH_AVR
100 |
101 |
102 |
103 |
104 | C:/Users/jp/Documents/Arduino/libraries/U8glib
105 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries/EEPROM/src
106 | C:/Users/jp/Documents/Arduino/libraries/Arduino-IRremote-master
107 | C:/Users/jp/Documents/Arduino/libraries/Arduino-IRremote-master/utility
108 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries/EEPROM/src/utility
109 | C:/Program Files (x86)/Arduino/libraries
110 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries
111 | C:/Users/jp/Documents/Arduino/libraries
112 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/cores/arduino
113 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/variants/eightanaloginputs
114 | ../../../karadioU8glib
115 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/avr/include/
116 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2//avr/include/avr/
117 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/lib/gcc/avr/4.8.1/include
118 |
119 |
120 | Optimize (-O1)
121 | True
122 | True
123 | Default (-g2)
124 | True
125 | Default (-Wa,-g)
126 |
127 |
128 | C:/Users/jp/Documents/Arduino/libraries/U8glib;C:/Program Files (x86)/Arduino/hardware/arduino/avr/libraries/EEPROM/src;C:/Users/jp/Documents/Arduino/libraries/Arduino-IRremote-master;C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries/EEPROM/src;C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries/EEPROM/src/utility;C:/Program Files (x86)/Arduino/libraries;C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries;C:/Users/jp/Documents/Arduino/libraries;C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/cores/arduino;C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/variants/eightanaloginputs;../../../karadioU8glib;C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/avr/include/;C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2//avr/include/avr/;C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/lib/gcc/avr/4.8.1/include;C:/Users/jp/Documents/Arduino/libraries/Arduino-IRremote-master/utility;
129 |
130 |
131 |
132 |
133 | True
134 | True
135 | True
136 | True
137 | False
138 | True
139 | True
140 |
141 |
142 | __AVR_ATmega328p__
143 | __AVR_ATmega328P__
144 | ARDUINO=106013
145 | ARDUINO_MAIN
146 | F_CPU=16000000L
147 | __AVR__
148 | ARDUINO_AVR_PRO
149 | ARDUINO_ARCH_AVR
150 |
151 |
152 |
153 |
154 | C:/Users/jp/Documents/Arduino/libraries/U8glib
155 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries/EEPROM/src
156 | C:/Users/jp/Documents/Arduino/libraries/Arduino-IRremote-master
157 | C:/Users/jp/Documents/Arduino/libraries/Arduino-IRremote-master/utility
158 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries/EEPROM/src/utility
159 | C:/Program Files (x86)/Arduino/libraries
160 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries
161 | C:/Users/jp/Documents/Arduino/libraries
162 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/cores/arduino
163 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/variants/eightanaloginputs
164 | ../../../karadioU8glib
165 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/avr/include/
166 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2//avr/include/avr/
167 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/lib/gcc/avr/4.8.1/include
168 |
169 |
170 | Optimize (-O1)
171 | True
172 | True
173 | Default (-g2)
174 | True
175 | True
176 | True
177 |
178 |
179 | __AVR_ATmega328p__
180 | __AVR_ATmega328P__
181 | ARDUINO=106013
182 | ARDUINO_MAIN
183 | F_CPU=16000000L
184 | __AVR__
185 | ARDUINO_AVR_PRO
186 | ARDUINO_ARCH_AVR
187 |
188 |
189 |
190 |
191 | C:/Users/jp/Documents/Arduino/libraries/U8glib
192 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries/EEPROM/src
193 | C:/Users/jp/Documents/Arduino/libraries/Arduino-IRremote-master
194 | C:/Users/jp/Documents/Arduino/libraries/Arduino-IRremote-master/utility
195 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries/EEPROM/src/utility
196 | C:/Program Files (x86)/Arduino/libraries
197 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries
198 | C:/Users/jp/Documents/Arduino/libraries
199 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/cores/arduino
200 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/variants/eightanaloginputs
201 | ../../../karadioU8glib
202 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/avr/include/
203 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2//avr/include/avr/
204 | C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/lib/gcc/avr/4.8.1/include
205 |
206 |
207 | Optimize (-O1)
208 | True
209 | True
210 | Default (-g2)
211 | True
212 | Default (-Wa,-g)
213 |
214 |
215 | C:/Users/jp/Documents/Arduino/libraries/U8glib;C:/Program Files (x86)/Arduino/hardware/arduino/avr/libraries/EEPROM/src;C:/Users/jp/Documents/Arduino/libraries/Arduino-IRremote-master;C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries/EEPROM/src;C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries/EEPROM/src/utility;C:/Program Files (x86)/Arduino/libraries;C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/libraries;C:/Users/jp/Documents/Arduino/libraries;C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/cores/arduino;C:/Users/jp/AppData/Local/arduino15/packages/arduino/hardware/avr/1.6.17/variants/eightanaloginputs;../../../karadioU8glib;C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/avr/include/;C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2//avr/include/avr/;C:/Users/jp/AppData/Local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/lib/gcc/avr/4.8.1/include;C:/Users/jp/Documents/Arduino/libraries/Arduino-IRremote-master/utility;
216 |
217 |
218 |
219 | compile
220 |
221 |
222 | compile
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 | compile
231 |
232 |
233 | compile
234 |
235 |
236 |
237 |
--------------------------------------------------------------------------------
/karadioU8glib/karadioU8glib.ino:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | KaradioU8glib.pde
4 |
5 | */
6 |
7 | //-------------------------------------------------------
8 | // UnComment the following line if you want the IR remote
9 | #define IR
10 | // Uncomment the following line to use the IRLib2 library
11 | #define IRLib2
12 | //=========================
13 | // Uncomment your oled type
14 | //=========================
15 | #define oled096
16 | //#define oled130
17 | //#define Nokia5110
18 | //-------------------------------------------------------
19 |
20 | // your timezone offset
21 | #define TZO 1
22 |
23 | #undef SERIAL_RX_BUFFER_SIZE
24 | #define SERIAL_RX_BUFFER_SIZE 128
25 | #include "u8glibConf.h"
26 | #include
27 | #include
28 | #include
29 | #ifdef IR
30 | #ifdef IRLib2
31 | #include
32 | #include
33 | //#include
34 | //#include
35 | //#include
36 | //#include
37 | //#include
38 | #include
39 | //#include
40 | //#include
41 | //#include
42 | //#include
43 | //include additional protocols here
44 | #include
45 | //#include
46 | #include
47 | #else
48 | #include "IRremote.h"
49 | #endif
50 | #endif
51 |
52 |
53 | #define PIN_LED 13
54 | #define PIN_PLAYING 12
55 | #define BAUD 28800 // any standard serial value: 300 - 115200
56 |
57 | // nams <--> num of line
58 | #define STATIONNAME 0
59 | #define STATION1 1
60 | #define STATION2 2
61 | #define IP 3
62 | #define GENRE 2
63 | #define TITLE1 3
64 | #define TITLE2 4
65 | #define VOLUME 5
66 |
67 |
68 | // constants
69 | const int EEaddr = 0; // EEPROM address for storing WPM
70 | const int EEaddr1 = 2; // EEPROM address for LCD address
71 | const int EEaddrIp = 10; // EEPROM address for the IP
72 |
73 | const byte ContrastPin = 8; // D8 low activates the Contrast adjustment
74 |
75 |
76 | #ifdef IR
77 | char irStr[4];
78 | // IR define and objects
79 | #ifdef IRLib2
80 | #define PIN_IRRECV 2
81 | IRrecvPCI irrecv(PIN_IRRECV);//create instance of receiver using pin PIN_IRRECV
82 | IRdecode irDecoder; //create decoder
83 | IRdecode results; //create decoder
84 | #else
85 | #define PIN_IRRECV 11
86 | IRrecv irrecv(PIN_IRRECV); // The IR
87 | decode_results results;
88 | #endif
89 | #endif
90 | bool state = false; // start stop on Ok key
91 | //-----------
92 | #ifdef IR
93 | // Character array pointers
94 | char msg2[] = {"IR+lcd V1.5"}; //
95 | #else
96 | char msg2[] = {"lcd V1.5"}; //
97 | #endif
98 | char msg1[] = {"(c) KaraWin"}; //
99 | char msg[] = {" Karadio"};
100 |
101 | // Karadio specific data
102 | #define BUFLEN 180
103 | #define LINES 6
104 | char line[BUFLEN]; // receive buffer
105 | char station[BUFLEN]; //received station
106 | char title[BUFLEN]; // received title
107 | char nameset[BUFLEN/2]; // the local name of the station
108 | char nameNum[5]; // the number of the station
109 | char genre[BUFLEN/2]; // the local name of the station
110 | char* lline[LINES] ; // array of ptr of n lines
111 | uint8_t iline[LINES] ; //array of index for scrolling
112 | uint8_t tline[LINES] ;
113 | int16_t volume;
114 | unsigned index = 0;
115 | unsigned loopScroll = 0;
116 | unsigned loopDate = 0;
117 | char oip[20];
118 |
119 | uint16_t y ; //Height of a line
120 | uint16_t yy; //Height of screen
121 | uint16_t x ; //Width
122 | uint16_t z ; // an internal offset for y
123 |
124 | byte NOKIAcontrast; // LCD initialization contrast values B0 thru BF
125 |
126 | struct tm *dt;
127 | time_t timestamp = 0;
128 | bool syncTime = false;
129 | bool askDraw = false;
130 | bool itAskTime = true;
131 | unsigned loopTime = 0;
132 |
133 | ////////////////////////////////////////
134 | void u8g_prepare(void) {
135 | if (u8g.getWidth() == 84)
136 | u8g.setFont(u8g_font_5x8);
137 | else
138 | // u8g.setFont(u8g_font_6x13);
139 | u8g.setFont(u8g_font_6x10);
140 | u8g.setFontRefHeightExtendedText();
141 | u8g.setDefaultForegroundColor();
142 | u8g.setFontPosTop();
143 | }
144 |
145 |
146 | ////////////////////////////////////////
147 | //Setup all things, check for contrast adjust and show initial page.
148 | void setup2()
149 | {
150 | clearAll();
151 | lline[0] = (char*)msg;
152 | lline[1] = (char*)msg1;
153 | lline[2] = (char*)msg2;
154 | nameNum[0]=0;
155 | eepromReadStr(EEaddrIp, oip);
156 | lline[3] = (char*)"IP:";
157 | lline[4] = oip;
158 | draw(0);
159 | digitalWrite(PIN_PLAYING, LOW);
160 | }
161 |
162 | void setTimer2()
163 | {
164 | cli();//stop interrupts
165 | TCCR2A = 0;// set entire TCCR2A register to 0
166 | TCCR2B = 0;// same for TCCR2B
167 | TCNT2 = 0;//initialize counter value to 0
168 | // set compare match register for 1khz increments
169 | OCR2A = F_CPU/1000/64 -1;// (must be <256)
170 | // turn on CTC mode
171 | TCCR2A |= (1 << WGM21);
172 | // Set CS21 bit for 64 prescaler
173 | TCCR2B |= (1 << CS22) ;
174 | // enable timer compare interrupt
175 | TIMSK2 |= (1 << OCIE2A);
176 | sei();//allow interrupts
177 | }
178 |
179 | void setTimer1()
180 | {
181 | //set timer1 interrupt at 4Hz
182 | cli();//stop interrupts
183 | TCCR1A = 0;// set entire TCCR1A register to 0
184 | TCCR1B = 0;// same for TCCR1B
185 | TCNT1 = 0;//initialize counter value to 0
186 | // set compare match register for 4hz increments
187 | // OCR1A = 15624;// = (16*10^6) / (1*1024) - 1 (must be <65536)
188 | OCR1A = F_CPU/4096 -1;// = (16*10^6) / (2*1024) - 1 (must be <65536)
189 | // turn on CTC mode
190 | TCCR1B |= (1 << WGM12);
191 | // Set CS10 and CS12 bits for 1024 prescaler
192 | TCCR1B |= (1 << CS12) | (1 << CS10);
193 | // enable timer compare interrupt
194 | TIMSK1 |= (1 << OCIE1A);
195 | sei();//allow interrupts
196 | }
197 |
198 | ISR(TIMER2_COMPA_vect)
199 | {
200 | cli();//stop interrupts
201 | serial();
202 | sei();//allow interrupts
203 | }
204 |
205 | ISR(TIMER1_COMPA_vect)
206 | {//timer1 interrupt 4Hz
207 | if (loopTime%4 ==0) // 1hz
208 | {
209 | timestamp++; // time update
210 | loopDate++;
211 | if (!syncTime) itAskTime=true; // first synchro if not done
212 | askDraw = true;
213 | }
214 | loopScroll++;
215 | if ((++loopTime%7200) == 0) itAskTime=true; // refresh ntp time every 30Mn
216 | }
217 |
218 |
219 | void setup(void) {
220 | char msg3[] = {"Karadio"};
221 | Serial.begin(BAUD);
222 | while (!Serial) ;
223 |
224 | pinMode(PIN_LED, OUTPUT);
225 | pinMode(PIN_PLAYING, OUTPUT);
226 | pinMode(ContrastPin, INPUT);
227 | digitalWrite(ContrastPin, HIGH); // activate internal pullup resistor
228 | digitalWrite(PIN_PLAYING, LOW);
229 |
230 | #ifdef IR
231 | irrecv.enableIRIn(); // Start the IR receiver
232 | irStr[0] = 0;
233 | #endif
234 |
235 | ReStart: // Come back here if LCD contract is changed
236 | // Read the EEPROM to determine if display is using a custom contrast value
237 | NOKIAcontrast = EEPROM.read(EEaddr1);
238 | // Set the Nokia LCD Contrast to default or reset if EEPROM is corrupt or set to new value
239 | if (NOKIAcontrast < 0xB0 || NOKIAcontrast > 0xCF) NOKIAcontrast = 0xB8;
240 | u8g.setContrast(2*(NOKIAcontrast-0x80));
241 | u8g_prepare();
242 | y = u8g.getFontLineSpacing();
243 | yy = u8g.getHeight();
244 | x = u8g.getWidth();
245 | z = 0;
246 | clearAll();
247 |
248 | for (int i = 0;i<5;i++)
249 | {
250 | u8g.firstPage();
251 | do {
252 | // if (!(i%2)) u8g.drawFrame(0,0,x/2-1,yy/2-1);
253 | // else u8g.drawFrame(0,0,x-1,yy-1);
254 | u8g.drawStr(u8g.getWidth()/2 - (u8g.getStrWidth(msg3)/2), u8g.getHeight()/3, msg3);
255 | } while( u8g.nextPage() );
256 | delay(500);
257 | if (i%2)u8g.setScale2x2();
258 | else u8g.undoScale();
259 | }
260 | lline[0] = (char*)msg;
261 | lline[1] = (char*)msg1;
262 | // lline[2] =(char*) msg2;
263 | nameNum[0]=0;
264 | eepromReadStr(EEaddrIp, oip);
265 | lline[3] = (char*)"IP:";
266 | lline[4] = oip;
267 | draw(0);
268 | delay(2000);
269 | if (!digitalRead(ContrastPin)) {
270 | NOKIAcontrast+=1;
271 | if (NOKIAcontrast > 0xCF) NOKIAcontrast = 0xB0;
272 | EEPROM.write(EEaddr1,NOKIAcontrast) ;
273 | itoa(NOKIAcontrast,title,16);
274 | lline[2] = title;
275 | goto ReStart;
276 | }
277 | setTimer2();
278 | setTimer1();
279 | lline[2] = (char*)msg2;
280 | draw(0);
281 | }
282 |
283 | ////////////////////////////////////////
284 | // Clear all buffers and indexes
285 | void clearAll()
286 | {
287 | title[0] = 0;
288 | station[0]=0;
289 | for (int i=1;i= 0xc2)&&(characters[index] <= 0xc3)) // only 0 to FF ascii char
310 | {
311 | // Serial.println((characters[index]));
312 | characters[index+1] = ((characters[index]<<6)&0xFF) | (characters[index+1] & 0x3F);
313 | int sind = index+1;
314 | while (characters[sind]) { characters[sind-1] = characters[sind];sind++;}
315 | characters[sind-1] = 0;
316 |
317 | }
318 | index++;
319 | }
320 | }
321 |
322 | ////////////////////////////////////////
323 | void eepromReadStr(int addr, char* str)
324 | {
325 | byte rd;
326 | do {
327 | rd = EEPROM.read(addr++);
328 | *str = rd;
329 | // Serial.println(str[0],16);
330 | str++;
331 | } while (( rd != 0)&&( rd != 0xFF));
332 | *str = 0;
333 | }
334 |
335 | ////////////////////////////////////////
336 | void eepromWriteStr(int addr, char* str)
337 | {
338 | byte rd;
339 | do {
340 | EEPROM.write( addr++,*str);
341 | rd = *str;
342 | str++;
343 | } while (( rd != 0)&&( rd != 0xFF));
344 | EEPROM.write( addr,0);
345 | }
346 |
347 |
348 | ////////////////////////////////////////
349 | void separator(char* from)
350 | {
351 | byte len;
352 | char* interp;
353 | len = strlen(from);
354 | while (from[strlen(from)-1] == ' ') from[strlen(from)-1] = 0; // avoid blank at end
355 | while ((from[0] == ' ') ){ strcpy( from,from+1); }
356 | interp=strstr_PF(from,PSTR(" - "));
357 | if (from == nameset) {lline[0] = nameset;lline[1] = NULL;lline[2] = NULL;return;}
358 | if (interp != NULL)
359 | {
360 | from[interp-from]= 0;
361 | lline[(from==station)?1:3] = from;
362 | lline[(from==station)?2:4] = interp+3;
363 | } else
364 | {
365 | lline[(from==station)?1:3] = from;
366 | }
367 |
368 | }
369 | ////////////////////////////////////////
370 | // parse the karadio received line and do the job
371 | void parse(char* line)
372 | {
373 | char* ici;
374 | removeUtf8((byte*)line);
375 | ////// reset of the esp
376 | if ((ici=strstr_PF(line,PSTR("VS Version"))) != NULL) setup2();
377 | else
378 | ////// Meta title
379 | if ((ici=strstr_PF(line,PSTR("META#: "))) != NULL)
380 | {
381 | cleartitle();
382 | strcpy(title,ici+7);
383 | separator(title);
384 | askDraw = true;
385 | } else
386 | ////// ICY4 Description
387 | if ((ici=strstr_PF(line,PSTR("ICY4#: "))) != NULL)
388 | {
389 | // cleartitle();
390 | strcpy(genre,ici+7);
391 | lline[2] = genre;
392 | askDraw = true;
393 | } else
394 | ////// ICY0 station name
395 | if ((ici=strstr_PF(line,PSTR("ICY0#: "))) != NULL)
396 | {
397 | int len;
398 | clearAll();
399 | if (strlen(ici+7) == 0) strcpy (station,nameset);
400 | else strcpy(station,ici+7);
401 | separator(station);
402 | askDraw = true;
403 | } else
404 | ////// STOPPED
405 | if ((ici=strstr_PF(line,PSTR("STOPPED"))) != NULL)
406 | {
407 | digitalWrite(PIN_PLAYING, LOW);
408 | cleartitle();
409 | strcpy_P(title,PSTR("STOPPED"));
410 | separator(title);
411 | askDraw = true;
412 | }
413 | /////// Station Ip
414 | else
415 | if ((ici=strstr_PF(line,PSTR("Station Ip: "))) != NULL)
416 | {
417 | eepromReadStr(EEaddrIp, oip);
418 | if ( strcmp(oip,ici+12) != 0)
419 | eepromWriteStr(EEaddrIp,ici+12 );
420 | } else
421 | //////Nameset
422 | if ((ici=strstr_PF(line,PSTR("MESET#: "))) != NULL)
423 | {
424 | int len;
425 | strcpy(nameset,ici+8);
426 | ici = strstr(nameset," ");
427 | strncpy(nameNum,nameset,ici-nameset+1);
428 | nameNum[ici - nameset+1] = 0;
429 | strcpy(nameset,nameset+strlen(nameNum));
430 | separator(nameset);
431 | } else
432 | //////Playing
433 | if ((ici=strstr_PF(line,PSTR("YING#"))) != NULL)
434 | {
435 | digitalWrite(PIN_PLAYING, HIGH);
436 | if (strcmp_P(title,PSTR("STOPPED")) == 0)
437 | {
438 | title[0] = 0;
439 | separator(title);
440 | askDraw = true;
441 | }
442 | } else
443 | //////Volume
444 | if ((ici=strstr(line,"VOL#:")) != NULL)
445 | {
446 | volume = atoi(ici+6);
447 | askDraw = true;;
448 | } else
449 | //////Date Time ##SYS.DATE#: 2017-04-12T21:07:59+01:00
450 | if ((ici=strstr(line,"SYS.DATE#:")) != NULL)
451 | {
452 | char lstr[30];
453 | if (*(ici+11) != '2')//// invalid date. try again later
454 | {
455 | askDraw = true;
456 | return;
457 | }
458 | strcpy(lstr,ici+11);
459 | dt = gmtime(×tamp);
460 | int year,month,day,hour,minute,second;
461 | sscanf(lstr,"%04d-%02d-%02dT%02d:%02d:%02d",&(year),&(month),&(day),&(hour),&(minute),&(second));
462 | dt->tm_year = year; dt->tm_mon = month-1; dt->tm_mday = day;
463 | dt->tm_hour = hour; dt->tm_min = minute;dt->tm_sec =second;
464 | dt->tm_year -= 1900;
465 | timestamp = mktime(dt);
466 | syncTime = true;
467 | }
468 | }
469 |
470 |
471 | ////////////////////////////////////////
472 | // receive the esp8266 stream
473 | void serial()
474 | {
475 | char temp;
476 | while ((temp=Serial.read()) != -1)
477 | {
478 | switch (temp)
479 | {
480 | case '\n' : if (index == 0) break;
481 | case '\r' :
482 | line[index] = 0; // end of string
483 | index = 0;
484 | parse(line);
485 | break;
486 | default : // put the received char in line
487 | line[index++] = temp;
488 | if (index>BUFLEN-1) //break; // small memory so small buffer
489 | {
490 | Serial.println(F("overflow"));
491 | line[index] = 0;
492 | parse(line);
493 | index = 0;
494 | }
495 |
496 | }
497 | }
498 | }
499 |
500 | ////////////////////////////////////////
501 | // draw all lines
502 | void draw(int xx)
503 | {
504 | char strsec[30];
505 | dt=gmtime(×tamp);
506 | if (x==84)
507 | sprintf(strsec,"%02d-%02d %02d:%02d:%02d",(dt->tm_mon)+1,dt->tm_mday, dt->tm_hour, dt->tm_min,dt->tm_sec);
508 | else
509 | sprintf(strsec,"%02d-%02d-%04d %02d:%02d:%02d",(dt->tm_mon)+1,dt->tm_mday,dt->tm_year+1900, dt->tm_hour, dt->tm_min,dt->tm_sec);
510 |
511 | u8g.firstPage();
512 | do {
513 | u8g.drawHLine(0,(4*y) - (y/2)-5,x);
514 | u8g.drawBox(0,0,x-1,y);
515 | for (int i = 0;i < LINES;i++)
516 | {
517 | if (i == 0)u8g.setColorIndex(0);
518 | else u8g.setColorIndex(1);
519 | if (i >=3) z = y/2 -3; else z = -1;
520 | if ((lline[i] != NULL))
521 | {
522 | if (i == 0)
523 | {
524 | if (nameNum[0] ==0) u8g.drawStr(1,0,lline[i]+iline[i]);
525 | else
526 | {
527 | u8g.drawStr(1,0,nameNum);
528 | u8g.drawStr(u8g.getStrPixelWidth(nameNum)-2,0,lline[i]+iline[i]);
529 | }
530 | }
531 | else u8g.drawStr(0,y*i+z,lline[i]+iline[i]);
532 | }
533 | if (i == VOLUME)
534 | {
535 | u8g.drawFrame(0,y*i+z+(y/2)-1,x-1,3);
536 | u8g.drawHLine(0,y*i+z+(y/2),((uint16_t)(x*volume)/255));
537 | }
538 | }
539 | //time
540 | // if ((lline[4] == NULL)||(x==84))
541 | u8g.drawStr(x/2-(u8g.getStrWidth(strsec)/2),yy-y,strsec);
542 | } while( u8g.nextPage() );
543 | }
544 | ////////////////////////////////////////
545 | // scroll each line
546 | void scroll()
547 | {
548 | unsigned len;
549 | for (int i = 0;i < LINES;i++)
550 | {
551 | if (tline[i]>0)
552 | {
553 | if (tline[i] == 4) iline[i]= 0;
554 | tline[i]--;
555 | }
556 | else
557 | {
558 | len = u8g.getStrWidth(lline[i]+iline[i]);
559 | if (i == 0) len += u8g.getStrWidth(nameNum) ;
560 | if (len > x)
561 | {iline[i]++;askDraw = true;}
562 | else
563 | tline[i] = 6;
564 | }
565 | }
566 | }
567 |
568 | #ifdef IR
569 | void nbStation(char nb)
570 | {
571 | if (strlen(irStr)>=3) irStr[0] = 0;
572 | uint8_t id = strlen(irStr);
573 | irStr[id] = nb;
574 | irStr[id+1] = 0;
575 | }
576 | void translateIR() // takes action based on IR code received
577 | // KEYES Remote IR codes (NEC P01)
578 | // and Ocean Digital remote (NEC P07)
579 | {
580 | #ifdef IRLib2
581 | if (irrecv.getResults())
582 | {
583 | results.decode();
584 | #else
585 | if ((irrecv.decode(&results)))
586 | {
587 | #endif
588 |
589 | // Uncomment the following line to see the code of your remote control and report to the case the value
590 | #ifdef IRLib2
591 | // Serial.print(F("Protocol:"));Serial.print(results.protocolNum);Serial.print(F(" value:"));Serial.println(results.value,HEX);
592 | #else
593 | // Serial.print(F("Protocol:"));Serial.print(results.decode_type);Serial.print(F(" value:"));Serial.println(results.value,HEX);
594 | #endif
595 | // Serial.print(F(" value:"));Serial.println(results.value,HEX);
596 | switch(results.value)
597 | {
598 | case 0xFF629D:
599 | case 0x10EF48B7: /*(" FORWARD");*/ irStr[0] = 0;Serial.print(F("cli.next\r")); break;
600 |
601 | case 0xFF22DD:
602 | case 0x10EFA857:
603 | case 0x10EF42BD: /*(" LEFT");*/ irStr[0] = 0;Serial.print(F("cli.vol-\r")); break;
604 |
605 | case 0xFF02FD:
606 | case 0x10EF7887: /*(" -OK-");*/
607 | {
608 | // state?Serial.print(F("cli.start\r")):Serial.print(F("cli.stop\r"));
609 | if (strlen(irStr) >0)
610 | {
611 | Serial.print(F("cli.play(\""));Serial.print(irStr);Serial.print(F("\")\r"));
612 | irStr[0] = 0;
613 | }
614 | else
615 | {
616 | state?Serial.print(F("cli.start\r")):Serial.print(F("cli.stop\r"));
617 | /* if (state)
618 | Serial.print("cli.start\r");
619 | else
620 | Serial.print("cli.stop\r");
621 | */
622 | }
623 | state = !state;
624 | irStr[0] = 0;
625 | break;
626 | }
627 | case 0xFFC23D:
628 | case 0x10EF28D7:
629 | case 0x10EF827D: /*(" RIGHT");*/ irStr[0] = 0;Serial.print(F("cli.vol+\r")); break; // volume +
630 | case 0xFFA857:
631 | case 0x10EFC837: /*(" REVERSE");*/ irStr[0] = 0;Serial.print(F("cli.prev\r")); break;
632 | case 0xFF6897:
633 | case 0x10EF807F: /*(" 1");*/ nbStation('1'); break;
634 | case 0xFF9867:
635 | case 0x10EF40BF: /*(" 2");*/ nbStation('2'); break;
636 | case 0xFFB04F:
637 | case 0x10EFC03F: /*(" 3");*/ nbStation('3'); break;
638 | case 0xFF30CF:
639 | case 0x10EF20DF: /*(" 4");*/ nbStation('4'); break;
640 | case 0xFF18E7:
641 | case 0x10EFA05F: /*(" 5");*/ nbStation('5'); break;
642 | case 0xFF7A85:
643 | case 0x10EF609F: /*(" 6");*/ nbStation('6'); break;
644 | case 0xFF10EF:
645 | case 0x10EFE01F: /*(" 7");*/ nbStation('7'); break;
646 | case 0xFF38C7:
647 | case 0x10EF10EF: /*(" 8");*/ nbStation('8'); break;
648 | case 0xFF5AA5:
649 | case 0x10EF906F: /*(" 9");*/ nbStation('9'); break;
650 | case 0xFF42BD:
651 | case 0x10EFE817: /*(" *");*/ irStr[0] = 0;Serial.print(F("cli.stop\r")); break;
652 | case 0xFF4AB5:
653 | case 0x10EF00FF: /*(" 0");*/ nbStation('0'); break;
654 | case 0xFF52AD:
655 | case 0x10EFB847: /*(" #");*/ irStr[0] = 0;Serial.print(F("cli.start\r")); break;
656 | case 0xFFFFFFFF: /*(" REPEAT");*/break;
657 | default:;
658 | /*Serial.println(" other button ");*/
659 | }// End Case
660 | ;
661 | #ifdef IRLib2
662 | irrecv.enableIRIn(); //Restart receiver
663 | #else
664 | irrecv.resume(); // receive the next value
665 | #endif
666 | }
667 | } //END translateIR
668 | #endif
669 |
670 | void askTime()
671 | {
672 | if (itAskTime) // time to ntp. Don't do that in interrupt.
673 | {
674 | Serial.print(F("sys.date\r")) ;
675 | itAskTime = false;
676 | }
677 | }
678 |
679 | ////////////////////////////////////////
680 | void loop(void) {
681 | #ifdef IR
682 | translateIR();
683 | #endif
684 | // scrolling control and draw control
685 | if (loopScroll >=1 ) // 500ms
686 | {
687 | digitalWrite(PIN_LED, !digitalRead(PIN_LED)); // blink led
688 | loopScroll = 0;
689 | if (askDraw) // something to display
690 | {
691 | askDraw = false;
692 | draw(0);
693 | }
694 | // else
695 | scroll();
696 | }
697 | // ntp control and first info demand
698 | if (loopDate>=5)
699 | {
700 | loopDate = 0;
701 | if (itAskTime)
702 | {
703 | if (!syncTime) // time to ntp. Don't do that in interrupt.
704 | {
705 | Serial.print(F("\rsys.tzo(\"")) ;Serial.print(TZO);
706 | Serial.print(F("\")\r"));
707 | Serial.print(F("cli.info\r")); // Synchronise the current state
708 | itAskTime = false;
709 | }
710 | else askTime();
711 | }
712 | }
713 | }
714 |
715 |
--------------------------------------------------------------------------------
/karadioU8glib/karadioU8glib.ino.old:
--------------------------------------------------------------------------------
1 | #include "u8glibConf.h"
2 | /*
3 |
4 | KaradioU8glib.pde
5 |
6 | */
7 |
8 | #include "u8glibConf.h"
9 | #include
10 |
11 | #define PIN_LED 13
12 | #define PIN_PLAYING 12
13 |
14 | // constants
15 | const int BAUD = 28800; // any standard serial value: 300 - 115200
16 | const int EEaddr = 0; // EEPROM address for storing WPM
17 | const int EEaddr1 = 2; // EEPROM address for LCD address
18 | const int EEaddrIp = 10; // EEPROM address for the IP
19 |
20 | const byte ContrastPin = 8; // D8 low activates the Contrast adjustment
21 |
22 | // Character array pointers
23 | char msg[] = {"Karadio lcd V1.3"}; //
24 | char msg1[] = {"== (c) KaraWin =="}; //
25 | char msg2[] = {"https://hackaday.io/project/11570-wifi-webradio-with-esp8266-and-vs1053"};
26 | char msg3[] = {"Karadio"};
27 |
28 | // Karadio specific data
29 | #define BUFLEN 200
30 | #define LINES 10
31 | char line[BUFLEN]; // receive buffer
32 | char station[BUFLEN]; //received station
33 | char title[BUFLEN]; // received title
34 | char nameset[BUFLEN]; // the local name of the station
35 | char nameNum[5]; // the number of the station
36 | char* lline[LINES] ; // array of ptr of n lines
37 | int iline[LINES] ; //array of index for scrolling
38 | char tline[LINES] ;
39 | char* ici;
40 | unsigned index = 0;
41 | unsigned loopcount = 0;
42 | unsigned scrl = 0;
43 | char oip[20];
44 |
45 | int y ; //Height of a line
46 | int yy; //Height of screen
47 | int x ; //Width
48 | int z ; // an internal offset for y
49 |
50 | byte NOKIAcontrast; // LCD initialization contrast values B0 thru BF
51 | char temp;
52 |
53 |
54 | ////////////////////////////////////////
55 | void u8g_prepare(void) {
56 | if (u8g.getWidth() == 84)
57 | u8g.setFont(u8g_font_6x10);
58 | else
59 | u8g.setFont(u8g_font_6x13);
60 | u8g.setFontRefHeightExtendedText();
61 | u8g.setDefaultForegroundColor();
62 | u8g.setFontPosTop();
63 | }
64 |
65 |
66 |
67 | ////////////////////////////////////////
68 | // Clear all buffers and indexes
69 | void clearAll()
70 | {
71 | title[0] = 0;
72 | station[0]=0;
73 | for (int i=1;i 0xCF) NOKIAcontrast = 0xB8;
253 | u8g.setContrast(2*(NOKIAcontrast-0x80));
254 | u8g_prepare();
255 | y = u8g.getFontLineSpacing();
256 | yy = u8g.getHeight();
257 | x = u8g.getWidth();
258 | z = 0;
259 | clearAll();
260 |
261 | for (int i = 0;i<5;i++)
262 | {
263 | u8g.firstPage();
264 | do {
265 | // if (!(i%2)) u8g.drawFrame(0,0,x/2-1,yy/2-1);
266 | // else u8g.drawFrame(0,0,x-1,yy-1);
267 | u8g.drawStr(u8g.getWidth()/2 - (u8g.getStrWidth(msg3)/2), u8g.getHeight()/3, msg3);
268 | } while( u8g.nextPage() );
269 | delay(500);
270 | if (i%2)u8g.setScale2x2();
271 | else u8g.undoScale();
272 | }
273 | lline[0] = msg;
274 | lline[1] = msg1;
275 | // lline[2] = msg2;
276 | nameNum[0]=0;
277 | eepromReadStr(EEaddrIp, oip);
278 | lline[3] = (char*)"IP:";
279 | lline[4] = oip;
280 | draw(0);
281 | delay(2000);
282 | if (!digitalRead(ContrastPin)) {
283 | NOKIAcontrast+=1;
284 | if (NOKIAcontrast > 0xCF) NOKIAcontrast = 0xB0;
285 | EEPROM.write(EEaddr1,NOKIAcontrast) ;
286 | itoa(NOKIAcontrast,title,16);
287 | lline[2] = title;
288 | goto ReStart;
289 | }
290 | lline[2] = msg2;
291 | draw(0);
292 |
293 | }
294 |
295 | ////////////////////////////////////////
296 | // receive the esp8266 stream
297 | void serial()
298 | {
299 | char temp;
300 | while ((temp=Serial.read()) != -1)
301 | {
302 | switch (temp)
303 | {
304 | case '\n' : if (index == 0) break;
305 | case '\r' :
306 | line[index] = 0; // end of string
307 | index = 0;
308 | parse(line);
309 | break;
310 | default : // put the received char in line
311 | if (index>BUFLEN-1) break; // small memory so small buffer
312 | line[index++] = temp;
313 | }
314 | }
315 |
316 | }
317 |
318 | ////////////////////////////////////////
319 | // draw all lines
320 | void draw(int xx)
321 | {
322 | u8g.firstPage();
323 | do {
324 | u8g.drawHLine(0,(4*y) - (y/2)-5,x);
325 | u8g.drawBox(0,0,x-1,(u8g.getWidth() == 84)?9:12);
326 | for (int i = 0;i < LINES;i++)
327 | {
328 | serial();
329 | if (i == 0)u8g.setColorIndex(0);
330 | else u8g.setColorIndex(1);
331 | if (i >=3) z = y/2 -3; else z = -1;
332 | if ((lline[i] != NULL))
333 | if (i == 0)
334 | {
335 | if (nameNum[0] ==0) u8g.drawStr(1,0,lline[i]+iline[i]);
336 | else
337 | {
338 | u8g.drawStr(1,0,nameNum);
339 | u8g.drawStr(u8g.getStrPixelWidth(nameNum)-2,0,lline[i]+iline[i]);
340 | }
341 | }
342 | else u8g.drawStr(0,y*i+z,lline[i]+iline[i]);
343 | }
344 | } while( u8g.nextPage() );
345 | }
346 | ////////////////////////////////////////
347 | // scroll each line
348 | void scroll()
349 | {
350 | unsigned len;
351 | for (int i = 0;i < LINES;i++)
352 | {
353 |
354 | if (tline[i]>0)
355 | {
356 | if (tline[i] == 4) iline[i]= 0;
357 | tline[i]--;
358 | }
359 | else
360 | {
361 | if (i == 0)
362 | len = u8g.getStrWidth(nameNum) + u8g.getStrWidth(lline[i]+iline[i]);
363 | else
364 | len = u8g.getStrWidth(lline[i]+iline[i]);
365 | if (len > x) iline[i] += 1;
366 | else
367 | {tline[i] = 6;}
368 | }
369 | }
370 | draw(0);
371 | }
372 |
373 | ////////////////////////////////////////
374 | void loop(void) {
375 | serial();
376 | if (loopcount++ == ((x==84)?0x3000:0x7000))
377 | {
378 | loopcount = 0;
379 | if (++scrl%6 == 0) digitalWrite(PIN_LED, HIGH);
380 | scroll();
381 | digitalWrite(PIN_LED, LOW);
382 | }
383 | }
384 |
385 |
--------------------------------------------------------------------------------
/karadioU8glib/karadioU8glib.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karawin/karadio-addons/77df51cf2f692d93382e3dfd87fe8d6e600b0ce8/karadioU8glib/karadioU8glib.zip
--------------------------------------------------------------------------------
/karadioU8glib/readme.txt:
--------------------------------------------------------------------------------
1 | This product is the software needed to connect a lcd display and IR remote receiver to the karadio project.
2 | It run on an arduino pro mini or clone.
3 | If the lcd is a 3.3 volts version; please use the 3.3V 8Mhz, and if the lcd is 5v, use the 5V 16Mhz version.
4 | The IR is 3.3 or 5v tolerant.
5 |
6 | The wiring and other important infos and warnings are at the end of the u8glibConf.h file.
7 |
8 | If you use an IR remote control, please uncomment the #define IR at the beginning of the karadioU8glib.ino file
9 | and be sure to read carefully the u8glibConf.h file.
10 |
--------------------------------------------------------------------------------
/karadioU8glib/u8glibConf.h:
--------------------------------------------------------------------------------
1 | // u8glibConf.h
2 | /*
3 |
4 | >>> Before compiling: Please remove comment from the constructor of the
5 | >>> connected graphics display (see below).
6 |
7 | Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
8 |
9 | Copyright (c) 2012, olikraus@gmail.com
10 | All rights reserved.
11 |
12 | Redistribution and use in source and binary forms, with or without modification,
13 | are permitted provided that the following conditions are met:
14 |
15 | * Redistributions of source code must retain the above copyright notice, this list
16 | of conditions and the following disclaimer.
17 |
18 | * Redistributions in binary form must reproduce the above copyright notice, this
19 | list of conditions and the following disclaimer in the documentation and/or other
20 | materials provided with the distribution.
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
23 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
24 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
27 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
34 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 |
36 | */
37 | #ifndef _U8GLIBCONF_h
38 | #define _U8GLIBCONF_h
39 |
40 | #if defined(ARDUINO) && ARDUINO >= 100
41 | #include "arduino.h"
42 | #else
43 | #include "WProgram.h"
44 | #endif
45 | #include "U8glib.h"
46 |
47 | // setup u8g object, please remove comment from one of the following constructor calls
48 | // IMPORTANT NOTE: The following list is incomplete. The complete list of supported
49 | // devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
50 | //U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
51 | //U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
52 | //U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
53 | //U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
54 | //U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
55 | //U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
56 | //U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
57 | //U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
58 | //U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
59 | //U8GLIB_DOGM132 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
60 | //U8GLIB_DOGM128 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
61 | //U8GLIB_DOGM128_2X u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
62 | //U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
63 | //U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
64 | //U8GLIB_ST7920_128X64_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
65 | //U8GLIB_ST7920_128X64_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
66 | //U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
67 | //U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
68 | //U8GLIB_ST7920_192X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
69 | //U8GLIB_ST7920_192X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
70 | //U8GLIB_ST7920_192X32_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
71 | //U8GLIB_ST7920_192X32_4X u8g(10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
72 | //U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
73 | //U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
74 | //U8GLIB_ST7920_202X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
75 | //U8GLIB_ST7920_202X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
76 | //U8GLIB_LM6059 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
77 | //U8GLIB_LM6063 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
78 | //U8GLIB_DOGXL160_BW u8g(10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
79 | //U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
80 | //U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
81 | //U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
82 | //U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
83 | //U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
84 | //U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
85 | //U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
86 | //U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
87 | //U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
88 | //U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
89 | //U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
90 | //U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
91 | //U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
92 | //U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
93 |
94 | // Karadio: choose this one for the http://www.ebay.fr/itm/191909116703?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT
95 | // 0.96" I2C IIC SPI Serial 128X64
96 | #ifdef oled096
97 | U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
98 | #endif
99 | #ifdef oled130
100 | U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
101 | #endif
102 |
103 | //U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
104 | //U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
105 | //U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
106 | //U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
107 | //U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
108 | //U8GLIB_SSD1306_128X32 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
109 | //U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
110 | //U8GLIB_SSD1306_64X48 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
111 | //U8GLIB_SSD1306_64X48 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
112 | //U8GLIB_SSD1306_64X48 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
113 | //U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
114 | //U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
115 | //U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
116 | //U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); // Dev 0, Fast I2C / TWI
117 | //U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send ACK
118 | //U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
119 | //U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
120 | //U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
121 | //U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
122 | //U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
123 | //U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
124 | //U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
125 | //U8GLIB_UC1611_DOGM240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
126 | //U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
127 | //U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
128 | //U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
129 | //U8GLIB_UC1611_DOGXL240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
130 | //U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
131 | //U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
132 | //U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
133 | //U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board)
134 | //U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
135 | //U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
136 | //U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
137 | //U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
138 | //U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
139 | //U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
140 | //U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
141 | //U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
142 | //U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
143 | //U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
144 | //U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
145 | //U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
146 | //U8GLIB_HT1632_24X16 u8g(3, 2, 4); // WR = 3, DATA = 2, CS = 4
147 | //U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
148 | //U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
149 | //U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
150 | //U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
151 | //U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
152 | //U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
153 | //U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
154 | //
155 | //Karadio: Choose this one for http://www.ebay.fr/itm/262558872574?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT
156 | // 84X48 84 * 48 Nokia 5110 Module Lcd
157 | #ifdef Nokia5110
158 | #define PIN_SCE 7
159 | #define PIN_RESET 6
160 | #define PIN_DC 5
161 | #define PIN_SDIN 4
162 | #define PIN_SCLK 3
163 | U8GLIB_PCD8544 u8g(PIN_SCLK, PIN_SDIN, PIN_SCE, PIN_DC, PIN_RESET); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
164 | #endif
165 | //
166 |
167 | #endif
168 |
169 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
170 | /*
171 | Version 1.2 added esp8266 boot detection
172 | Version 1.3 added Pin PLAYING low when not playing, and High when playing.
173 | */
174 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
175 | /* *** Instruction for NOKIA 5110*********************************************
176 | ---------------------------
177 | NOTES:
178 | Confirmed vendor:
179 | lcd: http://www.ebay.fr/itm/262558872574?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT
180 | cpu: http://www.ebay.fr/itm/252409929753?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT
181 |
182 | MiniPRO 3.3 v 8MHz Pins:
183 | #__ Function_________________________________
184 |
185 | RESET Reset (not used)
186 | Tx 0 n/a (dedicated Serial Input)
187 | Rx 1 to the tx of the nodeMcu
188 | PIN 2 n/a
189 | PIN 3-7 Nokia Display (specifics below)
190 | PIN 8 Activate changes to NOKIA contrast B0 --> BF GND and press RESET
191 |
192 | Raw: 3.3 to 16 VDC Max
193 |
194 | Nokia 5110 Graphic LCD Pinout:
195 | _______ Mini Pro____ _______ Nokia GLCD___
196 | #define PIN_SCE 7 LCD CE .... Pin 2
197 | #define PIN_RESET 6 LCD RST .... Pin 1
198 | #define PIN_DC 5 LCD Dat/Com. Pin 3 (DC)
199 | #define PIN_SDIN 4 LCD SPIDat . Pin 4 (DIN)
200 | #define PIN_SCLK 3 LCD SPIClk . Pin 5
201 |
202 | // LCD Gnd .... Pin 8
203 | // LCD Vcc .... Pin 6 3.3 volts from the minipro VCC
204 | // LCD Vled ... Pin 7 (100 to 300 Ohms to Gnd)
205 |
206 | Cable wiring between nodeMcu and Mini Pro
207 | -----------------------------------------
208 | --NodeMcu-- --Mini Pro--
209 | Tx Rx
210 | Gnd Gnd
211 | VU Raw
212 |
213 | Extra features:
214 | ---------------
215 | A Jumper between Nokia GLCD pin 7 and 100 ohm + Gnd to switch on or off the lcd light
216 | A7 ---| |--- 100 ohms --- GND
217 | A push button between PIN8 of mini pro and GND to ajust the contrast after a reset.
218 | - Press the switch, reset and wait for the right contrast (32 steps) .
219 | - Release the switch. Done.
220 | The contrast is saved in eprom.
221 |
222 | Software:
223 | u8glib must be installed in library;
224 | In .../Arduino\libraries\U8glib\utility/u8g.h
225 | uncomment the following line
226 | #define U8G_16BIT 1
227 |
228 | In file u8glibConf.h
229 | comment the current u8g
230 | uncomment:
231 | U8GLIB_PCD8544 u8g(PIN_SCLK, PIN_SDIN, PIN_SCE, PIN_DC, PIN_RESET); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
232 |
233 | Warning:
234 | The webradio serial must be set at 28800 b/s
235 | with sys.uart("28800") command
236 |
237 |
238 |
239 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
240 | **** Instruction for 0.96" I2C IIC SPI Serial 128X64 White OLED LCD LED Display Module for Arduino *************************
241 | ----------------------------------------------------------------------------------------------
242 | NOTES:
243 | Confirmed vendor:
244 | lcd: http://www.ebay.fr/itm/191909116703?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT
245 | cpu: http://www.ebay.fr/itm/Pro-Mini-Atmega328-5V-16M-Micro-controller-Board-for-Arduino-Compatible-Nano-new-/331809989705?hash=item4d416aa449
246 |
247 | MiniPRO 5v 16MHz
248 | Pins:
249 | #__ Function_________________________________
250 |
251 | RESET Reset (not used))
252 | Rx 1 to the tx of the nodeMcu
253 | Gnd ground
254 | jp2: A4,A5 I2C lines
255 | Raw: 5 to 16 VDC Max
256 |
257 | Graphic LCD Pinout:
258 | Mini Pro____ _______ GLCD___
259 | JP2 A4 LCD SDA .... Pin 3
260 | P2 A5 LCD SCK .... Pin 4
261 | // LCD Gnd .... Pin 1
262 | // LCD Vcc .... Pin 2 5 volts from the minipro VCC
263 |
264 | Depending of the pcb, A4 & A5 are on the opposite pins of the board, or on the pcb near A2 & A3
265 |
266 | Cable wiring between nodeMcu and Mini Pro
267 | -----------------------------------------
268 | --NodeMcu-- --Mini Pro--
269 | Tx Rx
270 | Gnd Gnd
271 | VU Raw
272 |
273 | Software:
274 | u8glib must be installed in library;
275 | In .../Arduino\libraries\U8glib\utility/u8g.h
276 | uncomment the following line
277 | #define U8G_16BIT 1
278 |
279 | In file u8glibConf.h
280 | comment the current u8g
281 | uncomment:
282 | U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
283 |
284 | --------
285 | WARNING:
286 | The webradio serial must be set at 28800 b/s
287 | --------
288 | WARNING:
289 | ---------
290 | The nodeMcu is a 3.3v device.
291 | DO NOT connect the Rx pin of the lcd to the Tx pin of the mini Pro
292 |
293 |
294 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
295 | **** Instruction for the IR module *****************************************************************************************
296 | ------------------------------------
297 | The model used here is from:
298 | https://www.aliexpress.com/item/Hot-Selling-1pcs-New-Infrared-IR-Wireless-Remote-Control-Module-Kits-For-Arduino-Wholesale/32334118062.html?spm=2114.13010608.0.0.XzmgYk
299 | or equivalent. Cost less than 1$
300 |
301 | - Based on NEC protocol; Built-in 1 x AG10 battery;
302 | - Remote control range: above 8m;
303 | - Wavelength: 940Nm;
304 | - Frequency: crystal oscillator: 455KHz; IR carrier frequency: 38KHz
305 |
306 | // obsolete-----------
307 | See Library at: https://github.com/shirriff/Arduino-IRremote
308 | Install the library found at https://github.com/z3t0/Arduino-IRremote/releases/download/2.1.0/Arduino-IRremote-dev.zip
309 | Uncomment the #define IR at the beginning of the karadioU8glib.ino file.
310 | ----------------------
311 | // new library
312 | Install the library from https://github.com/cyborg5/IRLib2
313 | Uncomment the #define IR and the #ifdef IRLib2 at the beginning of the karadioU8glib.ino file.
314 | ----------------------
315 |
316 | The IR receiver pins:
317 | From left to right (pin at bottom)
318 | Gnd VCC Signal
319 | The signal must be connected to
320 | #define PIN_IRRECV 11 for the old library or
321 | #define PIN_IRRECV 2 or 3 for the new library IRLib2
322 | It is the default In karadioU8glig.ino, you can change it
323 |
324 | In karadioU8glig.ino:
325 | // Uncomment the following line to see the code of your remote control and report to the case the value
326 | // Serial.print("Protocol:");Serial.print(results.decode_type);Serial.print(" value:");Serial.println(results.value,HEX);
327 | If you want to use another remote, you can see the code of the keys and modify the switch case for the needed function.
328 | See IRremote.h to add the protocol you need for the remote.
329 |
330 | The tx of the pro mini must be connected to the rx of the esp12 but
331 | Warning; the esp rx pin is not 5V tolerant, so if your pro mini is a 5v version we nned to adapt the level.
332 | -------
333 | See
334 | http://www.instructables.com/id/Pi-Cubed-How-to-connect-a-33V-Raspberry-Pi-to-a-5V/
335 |
336 | The value of the resistors is not critical. Only th ration 1/3 2/3 must be respected 1k and 2k for example)
337 |
338 | I found that the ir is not very accurate, but it works.
339 | Enjoy.
340 |
341 | jpc 01/2017
342 | */
343 |
344 |
--------------------------------------------------------------------------------
/karadioUCSTM32/2017-04-17 21.56.12.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karawin/karadio-addons/77df51cf2f692d93382e3dfd87fe8d6e600b0ce8/karadioUCSTM32/2017-04-17 21.56.12.jpg
--------------------------------------------------------------------------------
/karadioUCSTM32/2017-04-17 21.56.24.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karawin/karadio-addons/77df51cf2f692d93382e3dfd87fe8d6e600b0ce8/karadioUCSTM32/2017-04-17 21.56.24.jpg
--------------------------------------------------------------------------------
/karadioUCSTM32/KaradioUCSTM32l.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karawin/karadio-addons/77df51cf2f692d93382e3dfd87fe8d6e600b0ce8/karadioUCSTM32/KaradioUCSTM32l.jpg
--------------------------------------------------------------------------------
/karadioUCSTM32/Thumbs.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karawin/karadio-addons/77df51cf2f692d93382e3dfd87fe8d6e600b0ce8/karadioUCSTM32/Thumbs.db
--------------------------------------------------------------------------------
/karadioUCSTM32/readme.txt:
--------------------------------------------------------------------------------
1 | This product is the software needed to connect a lcd display and IR remote receiver to the karadio project.
2 | It can connect a KY040 rotary encoder.
3 | https://github.com/karawin/Ka-Radio
4 | https://hackaday.io/project/11570-wifi-webradio-with-esp8266-and-vs1053
5 |
6 | It run on a stm32 bluePill board.
7 |
8 |
9 | The wiring and other important infos and warnings are at the end of the ucglibConf.h file.
10 | See also KaradioUCSTM32l.jpg
11 |
12 | If you use an IR remote control, please uncomment the #define IR at the beginning of the ino file.
13 |
--------------------------------------------------------------------------------
/karadioUCSTM32/ucglibConf.h:
--------------------------------------------------------------------------------
1 | // ucglibConf.h
2 | /*
3 |
4 | >>> Before compiling: Please remove comment from the type of the
5 | >>> connected graphics display (see below).
6 |
7 | Use Universal 8bit Graphics Library, https://github.com/olikraus/ucglib/
8 |
9 | */
10 |
11 | #if defined(__arm__)
12 | #ifndef __NOP
13 | #define __NOP __asm volatile ("nop")
14 | #endif
15 | #endif
16 |
17 | #include
18 | #include
19 | #include
20 |
21 |
22 | //-----------------------------------------------------
23 | // >>> Please uncomment one of the following . <<<
24 | //-----------------------------------------------------
25 | //#define ILI9163_18x128x128
26 | //#define SSD1351_18x128x128
27 | //#define SSD1351_18x128x128_FT
28 | //#define SEPS225_16x128x128_UNIVISION
29 | //#define PCF8833_16x132x132
30 | #define ST7735_18x128x160
31 | //#define ILI9341_18x240x320
32 | //#define HX8352C_18x240x400
33 | //#define ILI9486_18x320x480
34 |
35 | //-----------------------------------------------
36 | // Do not modify after this line
37 | //-----------------------------------------------
38 | #if defined (ILI9163_18x128x128)
39 | Ucglib_ILI9163_18x128x128_HWSPI ucg(/*cd=*/ PB5 , /*cs=*/ PB6, /*reset=*/ PB4);
40 | #define W128
41 | #elif defined (SSD1351_18x128x128)
42 | Ucglib_SSD1351_18x128x128_HWSPI ucg(/*cd=*/ PB5 , /*cs=*/ PB6, /*reset=*/ PB4);
43 | #define W128
44 | #elif defined (SSD1351_18x128x128_FT)
45 | Ucglib_SSD1351_18x128x128_FT_HWSPI ucg(/*cd=*/ PB5 , /*cs=*/ PB6, /*reset=*/ PB4);
46 | #define W128
47 | #elif defined (SEPS225_16x128x128_UNIVISION)
48 | Ucglib_SEPS225_16x128x128_UNIVISION_HWSPI ucg(/*cd=*/ PB5 , /*cs=*/ PB6, /*reset=*/ PB4);
49 | #define W128
50 | #elif defined (PCF8833_16x132x132)
51 | Ucglib_PCF8833_16x132x132_HWSPI ucg(/*cd=*/ PB5 , /*cs=*/ PB6, /*reset=*/ PB4);
52 | #define W132
53 | #elif defined (ST7735_18x128x160)
54 | Ucglib_ST7735_18x128x160_HWSPI ucg(/*cd=*/ PB5 , /*cs=*/ PB6, /*reset=*/ PB4);
55 | #define W160
56 | #elif defined (ILI9341_18x240x320)
57 | Ucglib_ILI9341_18x240x320_HWSPI ucg(/*cd=*/ PB5 , /*cs=*/ PB6, /*reset=*/ PB4);
58 | #define W320
59 | #elif defined (HX8352C_18x240x400)
60 | Ucglib_HX8352C_18x240x400_HWSPI ucg(/*cd=*/ PB5 , /*cs=*/ PB6, /*reset=*/ PB4);
61 | #define W400
62 | #elif defined (ILI9486_18x320x480)
63 | Ucglib_ILI9486_18x320x480_HWSPI ucg(/*cd=*/ PB5 , /*cs=*/ PB6, /*reset=*/ PB4);
64 | #define W480
65 | #endif
66 |
67 |
68 | // not supported
69 | //#define W64
70 | //Ucglib_SSD1331_18x96x64_UNIVISION_HWSPI ucg(/*cd=*/ PB5 , /*cs=*/ PB6, /*reset=*/ PB4);
71 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
72 | /*
73 | Version 1.0: Initial release 05/2017 jp Cocatrix
74 | Version 1.3:release 02/2019 jp Cocatrix
75 | */
76 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
77 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
78 | /**** Instruction for 1.8" Serial 128X160 SPI TFT LCD Module Display + t *************************
79 | * + IR + Rotary encoder
80 | ----------------------------------------------------------------------------------------------
81 | NOTES:
82 | Confirmed vendor:
83 | lcd:
84 | https://www.aliexpress.com/item/J34-A96-Free-Shipping-1-8-Serial-128X160-SPI-TFT-LCD-Module-Display-PCB-Adapter-Power/32599685873.html?spm=2114.13010608.0.0.MvX4RI
85 | https://www.aliexpress.com/item/1-8-inch-1-8-TFT-LCD-Display-module-ST7735S-128x160-51-AVR-STM32-ARM-8/32769506973.html?spm=2114.13010608.0.0.Dm20du
86 |
87 | STM32:
88 | https://www.aliexpress.com/item/1pcs-STM32F103C8T6-ARM-STM32-Minimum-System-Development-Board-Module-For-arduino/32720697607.html?spm=2114.13010608.0.0.Dm20du
89 |
90 | Rotary Encoder Module KY-040:
91 | https://www.aliexpress.com/item/5pcs-lot-Rotary-Encoder-Module-Free-Shipping-Dropshipping-KY-040-for-Arduino/32218652643.html?spm=2114.13010608.0.0.Dm20du
92 |
93 | Infrared IR wireless:
94 | https://www.aliexpress.com/item/Hot-Selling-1pcs-New-Infrared-IR-Wireless-Remote-Control-Module-Kits-For-Arduino-Wholesale/32334118062.html?spm=2114.13010608.0.0.j3B4M6
95 |
96 | --------
97 | Pins:
98 | --------
99 | See http://karadio.karawin.fr/images/KaradioUCSTM32l.jpg
100 |
101 | Cable wiring between Graphic LCD and STM32:
102 | -------------------------------------------
103 | ___STM32___LCD_______________
104 | PA7 LCD SDA .... Pin 6
105 | PA5 LCD SCK .... Pin 7
106 | PB6 LCD TFT CS.. Pin 3
107 | PB5 LCD A0 .... Pin 5
108 | PB4 LCD RST .... Pin 4
109 | Gnd LCD Gnd .... Pin 2
110 | 3.3 LCD Vcc .... Pin 1 3.3 VCC
111 | LCD Led .... Pin 8 To Vcc thru a resistor around 100 ohms
112 |
113 |
114 | Cable wiring between nodeMcu and stm32
115 | --------------------------------------
116 | --NodeMcu-- --stm32
117 | Tx Rx PA10
118 | Rx Tx PA9
119 | Gnd Gnd
120 | VU VB
121 |
122 | Cable wiring between STM32 and IR:
123 | ----------------------------------
124 | The IR receiver pins:
125 | From left to right (pin at bottom, sensor in front of you)
126 | GND 3.3 SIGNAL
127 | to STM32:
128 | GND 3.3 PC15
129 |
130 | Cable wiring between STM32 and KY040:
131 | -------------------------------------
132 | --KY040-- --STM32--
133 | A PB7
134 | B PB8
135 | Switch PB9
136 | Vcc
137 | Gnd
138 |
139 | Software:
140 | ---------
141 | STM32DUINO (to add support of the stm32 with arduino IDE:
142 | https://github.com/rogerclarkmelbourne/Arduino_STM32
143 | Bootloader (see http://wiki.stm32duino.com/index.php?title=Bootloader)
144 | https://github.com/rogerclarkmelbourne/STM32duino-bootloader (the one we need is generic_boot20_pc13.bin)
145 | Instruction to load the bootloader on stm32 (one time)
146 | http://www.stm32duino.com/viewtopic.php?f=32&t=413
147 |
148 | Libraries needed:
149 | ucglib for stm32 must be installed in arduino IDE library;
150 | https://github.com/karawin/Ucglib_Arduino
151 |
152 | IRMP library for stm32Duino:
153 | https://github.com/karawin/irmp-master
154 | See https://www.mikrocontroller.net/articles/IRMP_-_english
155 |
156 | KY040 library:
157 | https://github.com/karawin/encoder
158 |
159 |
160 | --------
161 | WARNING:
162 | The webradio serial must be set at 115200 bauds
163 | --------
164 |
165 | In karadioUCSTM32.ino:
166 | // Uncomment the following line to see the code of your remote control and report to the case the value
167 | // Serial.println(irmp_protocol_names[irmp_data.protocol]);
168 | // Serial.println(irmp_data.address,HEX);
169 | // Serial.println(irmp_data.command,HEX);
170 | // Serial.println(irmp_data.flags,HEX);
171 | // Serial.println(code,HEX);
172 | // Serial.println();
173 | If you want to use another remote, you can see the code of the keys and modify the switch case for the needed function.
174 | See IRMP.h to add the protocol you need for the remote.
175 |
176 | Enjoy.
177 |
178 | jpc 05/2017
179 | */
180 |
--------------------------------------------------------------------------------
/karadioUCglib/readme.txt:
--------------------------------------------------------------------------------
1 | This product is the software needed to connect a lcd display and IR remote receiver to the karadio project.
2 | It run on an arduino pro mini/micro or clone.
3 | If the lcd is a 3.3 volts version; please use the 3.3V 8Mhz, and if the lcd is 5v, use the 5V 16Mhz version.
4 | The IR is 3.3 or 5v tolerant.
5 |
6 | The wiring and other important infos and warnings are at the end of the ucglibConf.h file.
7 |
8 | If you use an IR remote control, please uncomment the #define IR at the beginning of the karadioU8glib.ino file
9 | and be sure to read carefully the ucglibConf.h file.
10 |
--------------------------------------------------------------------------------
/karadioUCglib/ucglibConf.h:
--------------------------------------------------------------------------------
1 | // ucglibConf.h
2 | /*
3 |
4 | >>> Before compiling: Please remove comment from the constructor of the
5 | >>> connected graphics display (see below).
6 |
7 | Use Universal 8bit Graphics Library, https://github.com/olikraus/ucglib/
8 |
9 | */
10 |
11 |
12 | #include
13 | #include
14 |
15 | /*
16 | Hardware SPI Pins:
17 | Arduino Uno sclk=13, data=11
18 | Arduino Due sclk=76, data=75
19 | Arduino Mega sclk=52, data=51
20 | Arduino Mini sclk=13, data=11 (mosi)
21 | Arduino Micro sclk=15, data=16
22 |
23 | >>> Please uncomment (and update) one of the following constructors. <<<
24 | */
25 | //Ucglib8BitPortD ucg(ucg_dev_ili9325_18x240x320_itdb02, ucg_ext_ili9325_18, /* wr= */ 18 , /* cd= */ 19 , /* cs= */ 17, /* reset= */ 16 );
26 | //Ucglib8Bit ucg(ucg_dev_ili9325_18x240x320_itdb02, ucg_ext_ili9325_18, 0, 1, 2, 3, 4, 5, 6, 7, /* wr= */ 18 , /* cd= */ 19 , /* cs= */ 17, /* reset= */ 16 );
27 |
28 | //Ucglib4WireSWSPI ucg(ucg_dev_ili9325_18x240x320_itdb02, ucg_ext_ili9325_18, /*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8); // not working
29 | //Ucglib4WireSWSPI ucg(ucg_dev_ili9325_spi_18x240x320, ucg_ext_ili9325_spi_18, /*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8); // not working
30 | //Ucglib3WireILI9325SWSPI ucg(ucg_dev_ili9325_spi_18x240x320, ucg_ext_ili9325_spi_18, /*sclk=*/ 13, /*data=*/ 11, /*cs=*/ 10, /*reset=*/ 8); // not working
31 | //Ucglib3WireILI9325SWSPI ucg(ucg_dev_ili9325_18x240x320_itdb02, ucg_ext_ili9325_18, /*sclk=*/ 13, /*data=*/ 11, /*cs=*/ 10, /*reset=*/ 8); // not working
32 |
33 | //Ucglib_ST7735_18x128x160_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
34 | Ucglib_ST7735_18x128x160_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
35 |
36 | //Ucglib_ILI9163_18x128x128_SWSPI ucg(/*sclk=*/ 7, /*data=*/ 6, /*cd=*/ 5 , /*cs=*/ 3, /*reset=*/ 4);
37 | //Ucglib_ILI9163_18x128x128_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8); /* HW SPI Adapter */
38 |
39 | //Ucglib_ILI9341_18x240x320_SWSPI ucg(/*sclk=*/ 7, /*data=*/ 6, /*cd=*/ 5 , /*cs=*/ 3, /*reset=*/ 4);
40 | //Ucglib_ILI9341_18x240x320_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
41 | //Ucglib_ILI9341_18x240x320_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
42 | //Ucglib_ILI9341_18x240x320_SWSPI ucg(/*sclk=*/ 4, /*data=*/ 3, /*cd=*/ 6 , /*cs=*/ 7, /*reset=*/ 5); /* Elec Freaks Shield */
43 |
44 | //Ucglib_SSD1351_18x128x128_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
45 | //Ucglib_SSD1351_18x128x128_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
46 | //Ucglib_SSD1351_18x128x128_FT_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
47 | //Ucglib_SSD1351_18x128x128_FT_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
48 |
49 | //Ucglib_PCF8833_16x132x132_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, /*cs=*/ 9, /*reset=*/ 8); /* linksprite board */
50 | //Ucglib_PCF8833_16x132x132_HWSPI ucg(/*cs=*/ 9, /*reset=*/ 8); /* linksprite board */
51 |
52 | //Ucglib_LD50T6160_18x160x128_6Bit ucg( /*d0 =*/ d0, /*d1 =*/ d1, /*d2 =*/ d2, /*d3 =*/ d3, /*d4 =*/ d4, /*d5 =*/ d5, /*wr=*/ wr, /*cd=*/ cd, /*cs=*/ cs, /*reset=*/ reset);
53 | //Ucglib_LD50T6160_18x160x128_6Bit ucg( /*d0 =*/ 16, /*d1 =*/ 17, /*d2 =*/ 18, /*d3 =*/ 19, /*d4 =*/ 20, /*d5 =*/ 21, /*wr=*/ 14, /*cd=*/ 15); /* Samsung 160x128 OLED with 6Bit minimal interface with Due */
54 | //Ucglib_LD50T6160_18x160x128_6Bit ucg( /*d0 =*/ 5, /*d1 =*/ 4, /*d2 =*/ 3, /*d3 =*/ 2, /*d4 =*/ 1, /*d5 =*/ 0, /*wr=*/ 7, /*cd=*/ 6); /* Samsung 160x128 OLED with 6Bit minimal interface with Uno */
55 |
56 | //Ucglib_SSD1331_18x96x64_UNIVISION_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
57 | //Ucglib_SSD1331_18x96x64_UNIVISION_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
58 |
59 | //Ucglib_SEPS225_16x128x128_UNIVISION_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
60 | //Ucglib_SEPS225_16x128x128_UNIVISION_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
61 |
62 |
63 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
64 | /*
65 | Version 1.0: Initial release 01/2017 jp Cocatrix
66 | */
67 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
68 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
69 | /**** Instruction for 1.8" Serial 128X160 SPI TFT LCD Module Display + PCB Adapter Power IC SD Socket *************************
70 | ----------------------------------------------------------------------------------------------
71 | NOTES:
72 | Confirmed vendor:
73 | lcd: https://www.aliexpress.com/item/J34-A96-Free-Shipping-1-8-Serial-128X160-SPI-TFT-LCD-Module-Display-PCB-Adapter-Power/32599685873.html?spm=2114.13010608.0.0.MvX4RI
74 | cpu mini: http://www.ebay.fr/itm/Pro-Mini-Atmega328-5V-16M-Micro-controller-Board-for-Arduino-Compatible-Nano-new-/331809989705?hash=item4d416aa449
75 | or cpu micro: https://www.aliexpress.com/item/Free-shipping-Atmega32u4-Game-Board-Module-Esplora-With-1PCS-Mini-USB-Cable-For-Arduino/1847119261.html?spm=2114.13010608.0.0.MvX4RI
76 |
77 | MiniPRO 5v 16MHz:
78 | Pins:
79 | #__ Function_________________________________
80 | RESET Reset (not used))
81 | Rx 0 to the tx of the nodeMcu
82 | Gnd ground
83 | Raw: 5 to 16 VDC Max
84 |
85 | Micro pro 5v 16Mhz:
86 | Pins:
87 | #__ Function_________________________________
88 | RESET Reset (not used))
89 | Rx 0 to the tx of the nodeMcu
90 | Gnd ground
91 | Raw: 5 to 16 VDC Max
92 |
93 |
94 | Graphic LCD Pinout:
95 | Micro Pro____ Mini Pro___LCD_______________
96 | 16 11 LCD SDA .... Pin 6
97 | 15 13 LCD SCK .... Pin 7
98 | 10 10 LCD TFT CS.. Pin 3
99 | 9 9 LCD A0 .... Pin 5
100 | 8 8 LCD RST .... Pin 4
101 | LCD Gnd .... Pin 2
102 | LCD Vcc .... Pin 1 3.3 or 5 volts from the minipro VCC
103 | LCD Led .... Pin 8 To Vcc thru a resistor around 100 ohms
104 |
105 |
106 | Cable wiring between nodeMcu and Mini Pro and stm32
107 | -----------------------------------------
108 | --NodeMcu-- --Mini/Micro Pro-- --stm32
109 | Tx Rx PA10
110 | Gnd Gnd
111 | VU Raw
112 |
113 | Software:
114 | ucglib must be installed in arduino IDE library;
115 | https://github.com/olikraus/ucglib
116 |
117 |
118 | --------
119 | WARNING:
120 | The webradio serial must be set at 28800 b/s
121 | --------
122 | WARNING:
123 | ---------
124 | The nodeMcu is a 3.3v device.
125 | DO NOT connect the Rx pin of the lcd to the Tx pin of the mini Pro if it's a 5V 16Mhz
126 |
127 |
128 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
129 | **** Instruction for the IR module *****************************************************************************************
130 | ------------------------------------
131 | The model used here is from:
132 | https://www.aliexpress.com/item/Hot-Selling-1pcs-New-Infrared-IR-Wireless-Remote-Control-Module-Kits-For-Arduino-Wholesale/32334118062.html?spm=2114.13010608.0.0.XzmgYk
133 | or equivalent. Cost less than 1$
134 |
135 | - Based on NEC protocol; Built-in 1 x AG10 battery;
136 | - Remote control range: above 8m;
137 | - Wavelength: 940Nm;
138 | - Frequency: crystal oscillator: 455KHz; IR carrier frequency: 38KHz
139 |
140 |
141 | // IR library
142 | Install the library from https://github.com/cyborg5/IRLib2
143 | Uncomment the #define IR and the #ifdef IRLib2 at the beginning of the karadioU8glib.ino file.
144 | ----------------------
145 |
146 | The IR receiver pins:
147 | From left to right (pin at bottom, sensor in front of you)
148 | Gnd VCC Signal
149 |
150 | The signal must be connected to
151 | For mini #define PIN_IRRECV 2 or 3
152 | For micro #define PIN_IRRECV 2 or 3 or 7
153 |
154 |
155 | In karadioUcglig.ino:
156 | // Uncomment the following line to see the code of your remote control and report to the case the value
157 | // Serial.print("Protocol:");Serial.print(results.decode_type);Serial.print(" value:");Serial.println(results.value,HEX);
158 | If you want to use another remote, you can see the code of the keys and modify the switch case for the needed function.
159 | See IRremote.h to add the protocol you need for the remote.
160 |
161 | The tx of the pro mini must be connected to the rx of the esp12 but
162 | Warning; the esp rx pin is not 5V tolerant, so if your pro mini is a 5v version we need to adapt the level.
163 | -------
164 | See
165 | http://www.instructables.com/id/Pi-Cubed-How-to-connect-a-33V-Raspberry-Pi-to-a-5V/
166 |
167 | The value of the resistors is not critical. Only the ration 1/3 2/3 must be respected 1k and 2k for example)
168 |
169 | Enjoy.
170 |
171 | jpc 01/2017
172 | */
173 |
174 |
--------------------------------------------------------------------------------
/karadio_IIC_lcd16x2/karadio_IIC_lcd16x2.ino:
--------------------------------------------------------------------------------
1 |
2 | /*
3 |
4 | Karadio IIC LCD 16x2.ino
5 |
6 | Edited by Alexander - yo2ldk - 2019.
7 |
8 | Arduino Board IIC LCD
9 | A4 sda
10 | A5 scl
11 |
12 | */
13 | // include the library code:
14 | //#include
15 |
16 | #include
17 | //#include
18 | #include
19 |
20 | #define I2C_ADDR 0x27 // <<----- Add your address here. Find it from I2C Scanner
21 | #define BACKLIGHT_PIN 3
22 | #define En_pin 2
23 | #define Rw_pin 1
24 | #define Rs_pin 0
25 | #define D4_pin 4
26 | #define D5_pin 5
27 | #define D6_pin 6
28 | #define D7_pin 7
29 |
30 | //int n = 1;
31 |
32 | LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin, D5_pin, D6_pin, D7_pin);
33 |
34 | #define version 3.0
35 | #include
36 | const int EEaddr = 0; // EEPROM address for storing WPM
37 | const int EEaddr1 = 2; // EEPROM address for LCD address
38 | const int EEaddrIp = 10; // EEPROM address for the IP
39 |
40 | // Character array pointers
41 | char msg[] = {"Karadio LCD"}; //
42 | char msg1[] = {"(c) KaraWin"}; //
43 | char blank[] = {" "};
44 | char msg2[] = {" Internet Radio "};
45 |
46 | // Karadio specific data
47 | #define BUFLEN 200
48 | #define LINES 2
49 | char line[BUFLEN]; // receive buffer
50 | char station[BUFLEN]; //received station
51 | char title[BUFLEN]; // received title
52 | char nameset[BUFLEN];
53 | char* lline[LINES] ; // array of ptr of n lines
54 | int iline[LINES] ; //array of index for scrolling
55 | byte tline[LINES] ;
56 | char* ici;
57 | char* ici2;
58 | unsigned index = 0;
59 | unsigned loopcount = 0;
60 | unsigned scrl = 0;
61 |
62 | int x = 16; //Width
63 | char temp;
64 |
65 | int laststateUp = HIGH;
66 | int laststateDown = HIGH;
67 | int laststatePlay = HIGH;
68 | int laststateStop = HIGH;
69 | int buttonState = 0;
70 |
71 | ////////////////////////////////////////
72 | // Clear all buffers and indexes
73 |
74 | void clearAll()
75 | {
76 | title[0] = 0;
77 | station[0] = 0;
78 | for (int i = 0; i < LINES; i++)
79 | {
80 | lline[i] = NULL; iline[i] = 0; tline[i] = 0;
81 | lcd.setCursor(0, i);
82 | lcd.print(blank);
83 | }
84 | }
85 | ////////////////////////////////////////
86 | void cleartitle()
87 | {
88 | title[0] = 0;
89 | for (int i = 1 ; i < LINES; i++) // clear lines
90 | {
91 | lline[i] = NULL;
92 | iline[i] = 0;
93 | tline[i] = 0;
94 | lcd.setCursor(0, i);
95 | lcd.print(blank);
96 | }
97 | draw();
98 | }
99 |
100 | ////////////////////////////////////////
101 | void eepromReadStr(int addr, char* str)
102 | {
103 | byte rd;
104 | do {
105 | rd = EEPROM.read(addr++);
106 | *str = rd;
107 | // Serial.println(str[0],16);
108 | str++;
109 | } while (( rd != 0) && ( rd != 0xFF));
110 | *str = 0;
111 | }
112 |
113 | ////////////////////////////////////////
114 | void eepromWriteStr(int addr, char* str)
115 | {
116 | byte rd;
117 | do {
118 | EEPROM.write( addr++, *str);
119 | rd = *str;
120 | str++;
121 | } while (( rd != 0) && ( rd != 0xFF));
122 | EEPROM.write( addr, 0);
123 | }
124 |
125 | ////////////////////////////////////////
126 | // parse the karadio received line and do the job
127 |
128 | void parse(char* line)
129 | {
130 | int mul;
131 | // removeUtf8((byte*)line);
132 | //Serial.println(line);
133 | ////// Meta title
134 | if ((ici = strstr(line, "META#: ")) != NULL)
135 | {
136 | cleartitle();
137 | //remove station name if present
138 | if ((ici2 = strstr(line, station)) != NULL)
139 | {
140 | ici += strlen(station);
141 | }
142 | strcpy(title, ici + 7);
143 | lline[1] = title;
144 | draw();
145 | } else
146 |
147 | ////// ICY0 station name
148 | if ((ici = strstr(line, "ICY0#: ")) != NULL)
149 | {
150 | int len;
151 | clearAll();
152 | if (strlen(ici + 7) == 0) strcpy (station, nameset);
153 | else strcpy(station, ici + 7);
154 | lline[0] = station;
155 | draw();
156 | } else
157 | ////// STOPPED
158 | if ((ici = strstr(line, "STOPPED")) != NULL)
159 | {
160 | cleartitle();
161 | strcpy(title, "STOPPED");
162 | lline[1] = title;
163 | draw();
164 | }
165 | /////// Station Ip
166 | else if ((ici = strstr(line, "Station Ip: ")) != NULL)
167 | {
168 | char oip[20];
169 | // Serial.println(line);
170 | eepromReadStr(EEaddrIp, oip);
171 | if ( strcmp(oip, ici + 12) != 0)
172 | eepromWriteStr(EEaddrIp, ici + 12 );
173 |
174 | } else
175 | // advertise web interface
176 | if ((ici = strstr(line, "IP: ")) != NULL)
177 | {
178 | clearAll();
179 | lline[0] = msg2;
180 | strcpy(title, ici + 4);
181 | lline[1] = title;
182 | draw();
183 | }
184 |
185 | }
186 |
187 | ////////////////////////////////////////
188 | //Setup all things, check for contrast adjust and show initial page.
189 |
190 | void setup(void) {
191 | char oip[20];
192 | Serial.begin(115200);
193 | while (!Serial) { ;}
194 | Serial.println("Arduino Ready");
195 |
196 | // set up the LCD's number of columns and rows:
197 | lcd.begin(16,2);
198 | lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
199 | lcd.setBacklight(HIGH);
200 | lcd.clear();
201 | lcd.noAutoscroll() ;
202 | lcd.print(msg);
203 | lcd.setCursor(0,1);
204 | lcd.print(msg1);
205 | delay(3000);
206 | clearAll();
207 | eepromReadStr(EEaddrIp, oip);
208 | lline[0] = (char*)"IP:";
209 | lline[1] = oip;
210 | draw();
211 |
212 | }
213 |
214 | ////////////////////////////////////////
215 | // receive the esp8266 stream
216 |
217 | void serial()
218 | {
219 | char temp;
220 | while ((temp = Serial.read()) != -1)
221 | {
222 | switch (temp)
223 | {
224 | case '\n' : if (index == 0) break;
225 | case '\r' :
226 | line[index] = 0; // end of string
227 | index = 0;
228 | parse(line);
229 | break;
230 | default : // put the received char in line
231 | if (index > BUFLEN - 1) break; // small memory so small buffer
232 | line[index++] = temp;
233 | }
234 | }
235 | }
236 |
237 | ////////////////////////////////////////
238 | // draw all lines
239 | void draw()
240 | {
241 | lcd.clear();
242 | for (int i = LINES - 1; i >= 0; i--)
243 | {
244 | serial();
245 | lcd.setCursor(0,i);
246 | if ((lline[i] != NULL)) lcd.print(lline[i] + iline[i]);
247 | delay(1);
248 | }
249 |
250 | }
251 | ////////////////////////////////////////
252 | // scroll each line
253 | void scroll()
254 | {
255 | unsigned len;
256 | int dodraw = 0;
257 |
258 | for (int i = 0; i < LINES; i++)
259 | {
260 | if (tline[i] > 0)
261 | {
262 | if (tline[i] == 4) {
263 | iline[i] = 0;
264 | dodraw = 1;
265 | }
266 | tline[i]--;
267 | }
268 | else
269 | {
270 | len = strlen(lline[i] + (iline[i]));
271 | if (len > x) {
272 | iline[i]++;
273 | dodraw = 1;
274 | }
275 | else
276 | {
277 | tline[i] = 6;
278 | }
279 | }
280 | }
281 | if (dodraw == 1) draw();
282 |
283 | }
284 |
285 | ////////////////////////////////////////
286 | void loop(void) {
287 | serial();
288 | if (loopcount++ == 0x3fff)
289 | {
290 | loopcount = 0;
291 | //if (++scrl%6 == 0) digitalWrite(13,HIGH);
292 | scroll();
293 | //digitalWrite(13,LOW);
294 | }
295 |
296 | }
297 |
298 |
--------------------------------------------------------------------------------
/karadio_IIC_lcd16x2/karadioutils.ino:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | int freeRam () {
5 | extern int __heap_start, *__brkval;
6 | int v;
7 | return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
8 | }
9 | /*
10 | void removeUtf8(byte *characters)
11 | {
12 | int index = 0;
13 | while (characters[index])
14 | {
15 | if ((characters[index]) == 195)
16 | {
17 | characters[index] = 'x';
18 | // Serial.println((characters[index]));
19 | characters[index+1] +=64;
20 | int sind = index+1;
21 | switch(characters[sind])
22 | {
23 | case 0xFF: case 0xFD:
24 | characters[sind] = 'y'; break;
25 | case 0xDF:
26 | characters[sind] = 'Y'; break;
27 | case 0xE7:
28 | characters[sind] = 'c'; break;
29 | case 0xC7:
30 | characters[sind] = 'C'; break;
31 | case 0xF2: case 0XF3: case 0xF4: case 0xF5: case 0xF6:
32 | characters[sind] = 'o'; break;
33 | case 0xD2: case 0XD3: case 0xD4: case 0xD5: case 0xD6:
34 | characters[sind] = 'O'; break;
35 | case 0xEC: case 0XED: case 0xEE: case 0xEF:
36 | characters[sind] = 'i'; break;
37 | case 0xCC: case 0XCD: case 0xCE: case 0xCF:
38 | characters[sind] = 'I'; break;
39 | case 0xF9: case 0XFA: case 0xFB: case 0xFC:
40 | characters[sind] = 'u'; break;
41 | case 0xD9: case 0XDA: case 0xDB: case 0xDC:
42 | characters[sind] = 'U'; break;
43 | case 0xE8: case 0XE9: case 0xEA: case 0xEB:
44 | characters[sind] = 'e'; break;
45 | case 0xC8: case 0XC9: case 0xCA: case 0xCB:
46 | characters[sind] = 'E'; break;
47 | case 0xE3: case 0XE0: case 0xE1: case 0xE2: case 0xE4: case 0XE5: case 0xE6:
48 | characters[sind] = 'a'; break;
49 | case 0xC3: case 0XC0: case 0xC1: case 0xC2: case 0xC4: case 0XC5: case 0xC6:
50 | characters[sind] = 'A'; break;
51 | default: ;
52 | }
53 | while (characters[sind]) { characters[sind-1] = characters[sind];sind++;}
54 | characters[sind-1] = 0;
55 |
56 | }
57 | index++;
58 | }
59 | }*/
60 |
61 | void removeUtf8(byte *characters)
62 | {
63 | int index = 0;
64 | while (characters[index])
65 | {
66 | if ((characters[index] >= 0xc2)&&(characters[index] <= 0xc3)) // only 0 to FF ascii char
67 | {
68 | // Serial.println((characters[index]));
69 | characters[index+1] = ((characters[index]<<6)&0xFF) | (characters[index+1] & 0x3F);
70 | int sind = index+1;
71 | while (characters[sind]) { characters[sind-1] = characters[sind];sind++;}
72 | characters[sind-1] = 0;
73 |
74 | }
75 | index++;
76 | }
77 | }
78 |
79 |
--------------------------------------------------------------------------------
/karadiolcd16x2/karadiolcd16x2.ino:
--------------------------------------------------------------------------------
1 |
2 | /*
3 |
4 | Karadiolcd16x2.ino
5 |
6 | Edited by Paul Sijben May 2018.
7 |
8 | */
9 | // include the library code:
10 | #include
11 | /*
12 | The circuit:
13 | * LCD RS pin to digital pin 12
14 | * LCD Enable pin to digital pin 11
15 | * LCD D4 pin to digital pin 2
16 | * LCD D5 pin to digital pin 3
17 | * LCD D6 pin to digital pin 4
18 | * LCD D7 pin to digital pin 5
19 | * LCD R/W pin to ground
20 | * 10K potentiometer:
21 | * ends to +5V and ground
22 | * wiper to LCD VO pin (pin 3)
23 | */
24 |
25 | #define version 2.0
26 |
27 | #define ChUpPin 10
28 | #define ChDownPin 9
29 | #define PlayPin 8
30 | #define StopPin 7
31 |
32 | // constants
33 | const int BAUD = 19200; // use the telnet interface on the esp32 to set the baudrate there sys.uart("19200")
34 |
35 | const byte ContrastPin = 8; // D8 low activates the Contrast adjustment
36 |
37 | // Character array pointers
38 | char msg[] = {"Karadio lcd"}; //
39 | char msg1[] = {"(c) KaraWin"}; //
40 | char blank[] = {" "};
41 | char msg2[] = {"web interface: "};
42 | // Karadio specific data
43 | #define BUFLEN 200
44 | #define LINES 2
45 | char line[BUFLEN]; // receive buffer
46 | char station[BUFLEN]; //received station
47 | char title[BUFLEN]; // received title
48 | char nameset[BUFLEN];
49 | char* lline[LINES] ; // array of ptr of n lines
50 | int iline[LINES] ; //array of index for scrolling
51 | byte tline[LINES] ;
52 | char* ici;
53 | char* ici2;
54 | unsigned index = 0;
55 | unsigned loopcount = 0;
56 | unsigned scrl = 0;
57 |
58 | int laststateUp=LOW;
59 | int laststateDown=LOW;
60 | int laststatePlay=LOW;
61 | int laststateStop=LOW;
62 | int buttonState = 0;
63 | int x = 16; //Width
64 | char temp;
65 |
66 | // initialize the library with the numbers of the interface pins
67 | LiquidCrystal lcd(12, 11, 2, 3, 4, 5);
68 |
69 | ////////////////////////////////////////
70 | // Clear all buffers and indexes
71 | void clearAll()
72 | {
73 | title[0] = 0;
74 | station[0]=0;
75 | for (int i=0;iBUFLEN-1) break; // small memory so small buffer
197 | line[index++] = temp;
198 | }
199 | }
200 | }
201 |
202 |
203 | ////////////////////////////////////////
204 | // draw all lines
205 | void draw()
206 | {
207 | lcd.clear();
208 | for (int i = LINES-1;i >=0;i--)
209 | {
210 | serial();
211 | lcd.setCursor(0, i);
212 | if ((lline[i] != NULL)) lcd.print(lline[i]+iline[i]);
213 | delay(1);
214 | }
215 |
216 | }
217 | ////////////////////////////////////////
218 | // scroll each line
219 | void scroll()
220 | {
221 | unsigned len;
222 | int dodraw=0;
223 |
224 | for (int i = 0;i < LINES;i++)
225 | {
226 | if (tline[i]>0)
227 | {
228 | if (tline[i] == 4) { iline[i]= 0;dodraw=1; }
229 | tline[i]--;
230 | }
231 | else
232 | {
233 | len = strlen(lline[i]+(iline[i]));
234 | if (len > x) {
235 | iline[i]++;
236 | dodraw=1;
237 | }
238 | else
239 | {tline[i] = 6;}
240 | }
241 | }
242 | if (dodraw==1) draw();
243 |
244 | }
245 |
246 | ////////////////////////////////////////
247 | void loop(void) {
248 | serial();
249 | if (loopcount++ == 0x3fff)
250 | {
251 | loopcount = 0;
252 | //if (++scrl%6 == 0) digitalWrite(13, HIGH);
253 | scroll();
254 | //digitalWrite(13, LOW);
255 | }
256 | // yes this can be done in a nicer way, but for 4 buttons I am not going to bother
257 | buttonState = digitalRead(ChUpPin);
258 | if (buttonState!= laststateUp) {
259 | laststateUp=buttonState;
260 | if (buttonState == HIGH) {
261 | Serial.println("cli.next");
262 | }
263 | }
264 | buttonState = digitalRead(ChDownPin);
265 | if (buttonState!= laststateDown) {
266 | laststateDown=buttonState;
267 | if (buttonState == HIGH) {
268 | Serial.println("cli.prev");
269 | }
270 | }
271 | buttonState = digitalRead(PlayPin);
272 | if (buttonState!= laststatePlay) {
273 | laststatePlay=buttonState;
274 | if (buttonState == HIGH) {
275 | Serial.println("cli.start");
276 | }
277 | }
278 | buttonState = digitalRead(StopPin);
279 | if (buttonState!= laststateStop) {
280 | laststateStop=buttonState;
281 | if (buttonState == HIGH) {
282 | Serial.println("cli.stop");
283 | }
284 | }
285 | }
286 |
--------------------------------------------------------------------------------
/karadiolcd16x2/karadiolcd16x2.ino.eightanaloginputs.hex:
--------------------------------------------------------------------------------
1 | :100000000C945D000C9485000C9485000C94850084
2 | :100010000C9485000C9485000C9485000C9485004C
3 | :100020000C9485000C9485000C9485000C9485003C
4 | :100030000C9485000C9485000C9485000C9485002C
5 | :100040000C944E050C9485000C941C050C94F6043D
6 | :100050000C9485000C9485000C9485000C9485000C
7 | :100060000C9485000C94850000000008000201003B
8 | :100070000003040700000000000000000000000072
9 | :10008000250028002B0000000000240027002A0083
10 | :10009000040404040404040402020202020203032E
11 | :1000A0000303030301020408102040800102040836
12 | :1000B0001020010204081020980511241FBECFEF64
13 | :1000C000D8E0DEBFCDBF11E0A0E0B1E0E0E2FFE0AC
14 | :1000D00002C005900D92A037B107D9F725E0A0E73F
15 | :1000E000B1E001C01D92A036B207E1F710E0CDE506
16 | :1000F000D0E004C02197FE010E944307CC35D10710
17 | :10010000C9F70E94E3050C948E070C94000090E060
18 | :10011000FC01EC55FF4F2491FC01E057FF4F849107
19 | :10012000882399F090E0880F991FFC01EA57FF4F50
20 | :10013000A591B491FC01E458FF4F859194918FB73C
21 | :10014000F894EC91E22BEC938FBF0895CF92DF925D
22 | :10015000EF92FF920F931F93CF93DF936C017A017D
23 | :100160008B01C0E0D0E0CE15DF0589F0D8016D919C
24 | :100170008D01D601ED91FC910190F081E02DC60139
25 | :100180000995892B11F47E0102C02196ECCFC7019D
26 | :10019000DF91CF911F910F91FF90EF90DF90CF9063
27 | :1001A0000895FC01918D828D981761F0828DDF0199
28 | :1001B000A80FB11D5D968C91928D9F5F9F73928F5A
29 | :1001C00090E008958FEF9FEF0895FC01918D828D4F
30 | :1001D000981731F0828DE80FF11D858D90E008951C
31 | :1001E0008FEF9FEF0895FC01918D228D892F90E074
32 | :1001F000805C9F4F821B91098F73992708958BEA2A
33 | :1002000094E00E94F30021E0892B09F420E0822F82
34 | :100210000895FC01848DDF01A80FB11DA35ABF4FC3
35 | :100220002C91848D90E001968F739927848FA689F5
36 | :10023000B7892C93A089B1898C9180648C93938D1C
37 | :10024000848D981306C00288F389E02D80818F7D0C
38 | :1002500080830895EF92FF920F931F93CF93DF93C4
39 | :10026000EC0181E0888F9B8D8C8D981305C0E88907
40 | :10027000F989808185FD24C0F62E0B8D10E00F5F7B
41 | :100280001F4F0F731127E02E8C8DE8120CC00FB694
42 | :1002900007FCFACFE889F989808185FFF5CFCE0187
43 | :1002A0000E940901F1CF8B8DFE01E80FF11DE35A89
44 | :1002B000FF4FF0820B8FEA89FB898081806207C043
45 | :1002C000EE89FF896083E889F98980818064808371
46 | :1002D00081E090E0DF91CF911F910F91FF90EF901F
47 | :1002E0000895CF93DF93EC01888D8823C9F0EA89C4
48 | :1002F000FB89808185FD05C0A889B9898C9186FD1F
49 | :100300000FC00FB607FCF5CF808185FFF2CFA8891B
50 | :10031000B9898C9185FFEDCFCE010E940901E7CF0D
51 | :10032000DF91CF91089580E090E0892B29F00E9421
52 | :10033000FF0081110C940000089590E0FC01E85941
53 | :10034000FF4F3491FC01EC55FF4F2491FC01E05725
54 | :10035000FF4FE491EE2309F43BC0332339F13330EE
55 | :1003600091F038F43130A9F0323001F584B58F7D49
56 | :1003700012C0373091F03830A1F03430B9F48091A8
57 | :1003800080008F7D03C0809180008F7780938000F4
58 | :100390000DC084B58F7784BD09C08091B0008F7780
59 | :1003A00003C08091B0008F7D8093B000F0E0EE0F2D
60 | :1003B000FF1FE458FF4FA591B4918FB7F894EC91CB
61 | :1003C000611103C020952E2301C02E2B2C938FBFCB
62 | :1003D00008953FB7F8948091990490919A04A09160
63 | :1003E0009B04B0919C0426B5A89B05C02F3F19F033
64 | :1003F0000196A11DB11D3FBFBA2FA92F982F8827A5
65 | :10040000820F911DA11DB11DBC01CD0142E0660FFF
66 | :10041000771F881F991F4A95D1F70895CF93DF93CF
67 | :10042000EC0160E08E810E949D0161E08E810E945E
68 | :100430009D0160E08E810E949D018BE891E0019713
69 | :10044000F1F7DF91CF910895CF92DF92EF92FF9273
70 | :100450000F931F93CF93DF937C016C0187E0C80E4D
71 | :10046000D11CC0E0D0E0062F10E0B8010C2E02C075
72 | :10047000759567950A94E2F76170F60181916F01B5
73 | :100480000E949D012196C430D10579F7C701DF9103
74 | :10049000CF911F910F91FF90EF90DF90CF900C9430
75 | :1004A0000E02CF92DF92EF92FF920F931F93CF93A2
76 | :1004B000DF93EC01F62E642F8C810E949D018D81CB
77 | :1004C0008F3F19F060E00E949D018F850F2D10E095
78 | :1004D00084FF25C06E0187E0C80ED11CE12CF12CF1
79 | :1004E000B8010E2C02C0759567950A94E2F7617009
80 | :1004F000F60181916F010E949D01FFEFEF1AFF0A43
81 | :1005000088E0E816F10461F7CE01DF91CF911F91E9
82 | :100510000F91FF90EF90DF90CF900C940E02B801F6
83 | :1005200084E0759567958A95E1F7CE010E942402D3
84 | :100530006F2DCE01DF91CF911F910F91FF90EF9022
85 | :10054000DF90CF900C94240241E00E94510281E0A0
86 | :1005500090E0089540E00C945102EF92FF920F93C7
87 | :100560001F93CF93DF93EC01623018F08F85886082
88 | :100570008F876B8B1C8A80E48D8B80E18E8B80E56E
89 | :100580008F8B8C810E9487008D818F3F11F00E949C
90 | :1005900087008E810E9487007E0187E0E80EF11CB3
91 | :1005A00000E010E08F8584FD03C084E090E002C08D
92 | :1005B00088E090E00817190744F4F70181917F0162
93 | :1005C0000E9487000F5F1F4FEDCF8BE39DE00197E7
94 | :1005D000F1F760E08C810E949D0160E08E810E94B5
95 | :1005E0009D018D818F3F19F060E00E949D016F8514
96 | :1005F00064FD1DC063E0CE010E9424020BE416E4FA
97 | :10060000C8010197F1F763E0CE010E942402C801FE
98 | :100610000197F1F763E0CE010E94240283E592E0A6
99 | :100620000197F1F762E0CE010E94240216C06062D9
100 | :10063000CE010E94AA028BE496E40197F1F76F8540
101 | :100640006062CE010E94AA0283E592E00197F1F771
102 | :100650006F856062CE010E94AA026F856062CE0142
103 | :100660000E94AA0284E0888B6CE0CE010E94AA025C
104 | :1006700061E0CE010E94AA028BE39FE10197F1F7AE
105 | :1006800082E0898B66E0CE01DF91CF911F910F91BF
106 | :10069000FF90EF900C94AA02843008F083E09091D0
107 | :1006A0005B05891710F08FEF890FE82FF0E0E85B0A
108 | :1006B000FA4F6489606888E495E00C94AA02009778
109 | :1006C00069F0FC0101900020E9F73197AF01481B68
110 | :1006D000590BBC0188E495E00C94A60080E090E002
111 | :1006E0000895EF92FF920F931F93CF93DF93109291
112 | :1006F0000003109238028DE9E82E84E0F82EF7010D
113 | :100700001182108201EA14E0F80111821082C5EA18
114 | :10071000D4E0188280E00E944C0380E091E00E94C7
115 | :100720005F03F70113821282F80113821282198289
116 | :1007300081E00E944C0380E091E0DF91CF911F9116
117 | :100740000F91FF90EF900C945F030F931F93CF9343
118 | :10075000DF93EC010AE010E0C8010E94780789935A
119 | :100760000F5F1F4F9FEF980F9E3FB0F31882DF91EE
120 | :10077000CF911F910F9108950E944907CF92DF9268
121 | :10078000EF92FF920F931F93CF93DF93CDB7DEB716
122 | :1007900064970FB6F894DEBF0FBECDBF98E3E92E85
123 | :1007A00092E0F92E8BEA94E00E94D1008F3F09F489
124 | :1007B000D2C020919204309193048A3019F08D3088
125 | :1007C00021F0B9C02115310569F3F901E653FC4F59
126 | :1007D00010821092930410929204EAECF3E091914B
127 | :1007E000992301F18EE3890F8230C8F78081282F89
128 | :1007F0002F7330E4939FC0011124822B8083AF01BB
129 | :10080000CA018A5C9340DA012D91AD01222329F0BF
130 | :10081000CA010297DC012C93F3CFDC01A753BC4F34
131 | :100820001C92DDCF67E471E08AEC93E00E945E07E2
132 | :100830009093C9038093C803892B49F00E94E10477
133 | :100840006091C8037091C903695F7F4F36C06FE440
134 | :1008500071E08AEC93E00E945E079093C903809355
135 | :10086000C803892BD1F00E947103E091C803F09175
136 | :10087000C9038781811103C060E771E003C0BF0134
137 | :10088000695F7F4F88E392E00E945707F0929E04D1
138 | :10089000E0929D040E94BA0485CF67E571E08AEC7E
139 | :1008A00093E00E945E079093C9038093C803892B4D
140 | :1008B00079F00E94E10467E571E080E093E00E9436
141 | :1008C000570780E093E09093A00480939F04E2CFC9
142 | :1008D0006FE571E08AEC93E00E945E078C019093D3
143 | :1008E000C9038093C803892B09F45CCFCE0101961C
144 | :1008F0000E94A503045F1F4FB801CE0101960E941C
145 | :100900004E07892B09F44ECF8AE0C82ED12CBFEFB9
146 | :10091000CB1ADB0AF8016081C60101970E948007AB
147 | :10092000D8018D918D0181508E3F88F360E0C60122
148 | :100930000E94800737CF283C310508F033CFA9014A
149 | :100940004F5F5F4F5093930440939204F901E65335
150 | :10095000FC4F808327CF64960FB6F894DEBF0FBE9E
151 | :10096000CDBFDF91CF911F910F91FF90EF90DF905E
152 | :10097000CF9008950E94BE0380E00E944C038091B6
153 | :100980009D0490919E04009741F02091A104309124
154 | :10099000A204820F931F0E945F030E94BE0381E0A6
155 | :1009A0000E944C0380919F049091A004009741F015
156 | :1009B0002091A3043091A404820F931F0C945F0331
157 | :1009C0000895109200031092A00410929F041092B8
158 | :1009D000A4041092A3041092A60481E00E944C0388
159 | :1009E00080E091E00E945F030C94BA041F920F9282
160 | :1009F0000FB60F9211242F933F934F935F936F93F2
161 | :100A00007F938F939F93AF93BF93EF93FF938BEA63
162 | :100A100094E00E940901FF91EF91BF91AF919F91E6
163 | :100A20008F917F916F915F914F913F912F910F9097
164 | :100A30000FBE0F901F9018951F920F920FB60F9236
165 | :100A400011242F938F939F93EF93FF93E091BB0417
166 | :100A5000F091BC048081E091C104F091C20482FD58
167 | :100A600012C090818091C4048F5F8F732091C50460
168 | :100A7000821751F0E091C404F0E0E555FB4F958FEB
169 | :100A80008093C40401C08081FF91EF919F918F9169
170 | :100A90002F910F900FBE0F901F9018951F920F92DD
171 | :100AA0000FB60F9211242F933F938F939F93AF9381
172 | :100AB000BF938091950490919604A0919704B09172
173 | :100AC00098043091940423E0230F2D3720F40196ED
174 | :100AD000A11DB11D05C026E8230F0296A11DB11D61
175 | :100AE000209394048093950490939604A093970484
176 | :100AF000B09398048091990490919A04A0919B04DA
177 | :100B0000B0919C040196A11DB11D8093990490930E
178 | :100B10009A04A0939B04B0939C04BF91AF919F91C2
179 | :100B20008F913F912F910F900FBE0F901F901895AE
180 | :100B3000EBEAF4E01382128288EE93E0A0E0B0E0EA
181 | :100B400084839583A683B78383E391E09183808335
182 | :100B500085EC90E09587848784EC90E09787868782
183 | :100B600080EC90E0918B808B81EC90E0938B828B7A
184 | :100B700082EC90E0958B848B86EC90E0978B868B53
185 | :100B8000118E128E138E148EE8E4F5E01382128219
186 | :100B900083E491E0918380838CE084838FEF85836D
187 | :100BA0008BE0868385E0878384E0808783E081878C
188 | :100BB00082E082871386148615861686178661E082
189 | :100BC000CF010C94AD02CF93DF93CDB7DEB764971E
190 | :100BD0000FB6F894DEBF0FBECDBF789484B58260A7
191 | :100BE00084BD84B5816084BD85B5826085BD85B5D1
192 | :100BF000816085BD80916E00816080936E0010924F
193 | :100C000081008091810082608093810080918100C9
194 | :100C1000816080938100809180008160809380005A
195 | :100C20008091B10084608093B1008091B0008160B8
196 | :100C30008093B00080917A00846080937A008091E4
197 | :100C40007A00826080937A0080917A00816080933C
198 | :100C50007A0080917A00806880937A001092C100B7
199 | :100C6000E091BB04F091BC0482E08083E091B70482
200 | :100C7000F091B8041082E091B904F091BA0484E4D0
201 | :100C800080831092C304E091BF04F091C00486E019
202 | :100C90008083E091BD04F091BE04808180618083F7
203 | :100CA000E091BD04F091BE04808188608083E09172
204 | :100CB000BD04F091BE04808180688083E091BD0412
205 | :100CC000F091BE0480818F7D808362E088E495E0AE
206 | :100CD0000E94AD028DE00E94870061E088E495E00B
207 | :100CE0000E94AA028BE39FE10197F1F760915905F9
208 | :100CF0006E7F60935905646088E495E00E94AA02C3
209 | :100D00008DE191E00E945F0381E00E944C0381E14C
210 | :100D100091E00E945F030E94E9014B015C0128EB16
211 | :100D2000C22E2BE0D22EE12CF12C0E94E901DC0135
212 | :100D3000CB0188199909AA09BB09883E9340A105EE
213 | :100D4000B10558F021E0C21AD108E108F10888EE97
214 | :100D5000880E83E0981EA11CB11CC114D104E104CB
215 | :100D6000F10419F70E9471038E010F5F1F4FC80134
216 | :100D70000E94A5038CE691E090939E0480939D04CD
217 | :100D80001093A00400939F040E94BA0406E010E0B0
218 | :100D900096E0F92E0E94BE038091A9049091AA04C6
219 | :100DA0008F3FAFEF9A0731F001969093AA0480939A
220 | :100DB000A90452C01092AA041092A9048091A70419
221 | :100DC0009091A80401969093A8048093A704B80179
222 | :100DD0000E942F07892B21F461E08DE00E949D0184
223 | :100DE000E5EAF4E081EAC82E84E0D82E4DE954E02B
224 | :100DF0008081882341F0843019F4D6011D921C9221
225 | :100E00008150808319C0D6012D913C91DA016D91FA
226 | :100E10007C91620F731FDB010D900020E9F7CD017B
227 | :100E20000197861B970B419730F02F5F3F4FD601FC
228 | :100E30002D933C9301C0F0823196B2E0CB0ED11CD1
229 | :100E40004E5F5F4F24E0E73AF20791F60E94BA0442
230 | :100E500060E08DE00E949D010E9493019BCFAA1B40
231 | :100E6000BB1B51E107C0AA1FBB1FA617B70710F095
232 | :100E7000A61BB70B881F991F5A95A9F780959095C7
233 | :100E8000BC01CD010895EE0FFF1F0590F491E02DF8
234 | :100E9000099481E090E0F8940C948E07FB01DC014A
235 | :100EA0008D91019080190110D9F3990B0895FB01E0
236 | :100EB000DC0101900D920020E1F70895FB015191B2
237 | :100EC0005523A9F0BF01DC014D9145174111E1F710
238 | :100ED00059F4CD010190002049F04D914015411188
239 | :100EE000C9F3FB014111EFCF81E090E00197089534
240 | :100EF000F999FECF92BD81BDF89A992780B50895E2
241 | :100F0000262FF999FECF1FBA92BD81BD20BD0FB625
242 | :100F1000F894FA9AF99A0FBE01960895F894FFCFC3
243 | :100F200020202020202020202020202020202020C1
244 | :100F300000286329204B61726157696E004B617212
245 | :100F40006164696F206C63640000006005800000CC
246 | :100F50000000002A01A600F300D100E500710100A5
247 | :100F6000000000A402A6004D455441233A20004948
248 | :100F7000435930233A200053544F505045440053B6
249 | :100F8000746174696F6E2049703A200049503A00CC
250 | :00000001FF
251 |
--------------------------------------------------------------------------------
/karadiolcd16x2/karadiolcd16x2.ino.with_bootloader.eightanaloginputs.hex:
--------------------------------------------------------------------------------
1 | :100000000C945D000C9485000C9485000C94850084
2 | :100010000C9485000C9485000C9485000C9485004C
3 | :100020000C9485000C9485000C9485000C9485003C
4 | :100030000C9485000C9485000C9485000C9485002C
5 | :100040000C944E050C9485000C941C050C94F6043D
6 | :100050000C9485000C9485000C9485000C9485000C
7 | :100060000C9485000C94850000000008000201003B
8 | :100070000003040700000000000000000000000072
9 | :10008000250028002B0000000000240027002A0083
10 | :10009000040404040404040402020202020203032E
11 | :1000A0000303030301020408102040800102040836
12 | :1000B0001020010204081020980511241FBECFEF64
13 | :1000C000D8E0DEBFCDBF11E0A0E0B1E0E0E2FFE0AC
14 | :1000D00002C005900D92A037B107D9F725E0A0E73F
15 | :1000E000B1E001C01D92A036B207E1F710E0CDE506
16 | :1000F000D0E004C02197FE010E944307CC35D10710
17 | :10010000C9F70E94E3050C948E070C94000090E060
18 | :10011000FC01EC55FF4F2491FC01E057FF4F849107
19 | :10012000882399F090E0880F991FFC01EA57FF4F50
20 | :10013000A591B491FC01E458FF4F859194918FB73C
21 | :10014000F894EC91E22BEC938FBF0895CF92DF925D
22 | :10015000EF92FF920F931F93CF93DF936C017A017D
23 | :100160008B01C0E0D0E0CE15DF0589F0D8016D919C
24 | :100170008D01D601ED91FC910190F081E02DC60139
25 | :100180000995892B11F47E0102C02196ECCFC7019D
26 | :10019000DF91CF911F910F91FF90EF90DF90CF9063
27 | :1001A0000895FC01918D828D981761F0828DDF0199
28 | :1001B000A80FB11D5D968C91928D9F5F9F73928F5A
29 | :1001C00090E008958FEF9FEF0895FC01918D828D4F
30 | :1001D000981731F0828DE80FF11D858D90E008951C
31 | :1001E0008FEF9FEF0895FC01918D228D892F90E074
32 | :1001F000805C9F4F821B91098F73992708958BEA2A
33 | :1002000094E00E94F30021E0892B09F420E0822F82
34 | :100210000895FC01848DDF01A80FB11DA35ABF4FC3
35 | :100220002C91848D90E001968F739927848FA689F5
36 | :10023000B7892C93A089B1898C9180648C93938D1C
37 | :10024000848D981306C00288F389E02D80818F7D0C
38 | :1002500080830895EF92FF920F931F93CF93DF93C4
39 | :10026000EC0181E0888F9B8D8C8D981305C0E88907
40 | :10027000F989808185FD24C0F62E0B8D10E00F5F7B
41 | :100280001F4F0F731127E02E8C8DE8120CC00FB694
42 | :1002900007FCFACFE889F989808185FFF5CFCE0187
43 | :1002A0000E940901F1CF8B8DFE01E80FF11DE35A89
44 | :1002B000FF4FF0820B8FEA89FB898081806207C043
45 | :1002C000EE89FF896083E889F98980818064808371
46 | :1002D00081E090E0DF91CF911F910F91FF90EF901F
47 | :1002E0000895CF93DF93EC01888D8823C9F0EA89C4
48 | :1002F000FB89808185FD05C0A889B9898C9186FD1F
49 | :100300000FC00FB607FCF5CF808185FFF2CFA8891B
50 | :10031000B9898C9185FFEDCFCE010E940901E7CF0D
51 | :10032000DF91CF91089580E090E0892B29F00E9421
52 | :10033000FF0081110C940000089590E0FC01E85941
53 | :10034000FF4F3491FC01EC55FF4F2491FC01E05725
54 | :10035000FF4FE491EE2309F43BC0332339F13330EE
55 | :1003600091F038F43130A9F0323001F584B58F7D49
56 | :1003700012C0373091F03830A1F03430B9F48091A8
57 | :1003800080008F7D03C0809180008F7780938000F4
58 | :100390000DC084B58F7784BD09C08091B0008F7780
59 | :1003A00003C08091B0008F7D8093B000F0E0EE0F2D
60 | :1003B000FF1FE458FF4FA591B4918FB7F894EC91CB
61 | :1003C000611103C020952E2301C02E2B2C938FBFCB
62 | :1003D00008953FB7F8948091990490919A04A09160
63 | :1003E0009B04B0919C0426B5A89B05C02F3F19F033
64 | :1003F0000196A11DB11D3FBFBA2FA92F982F8827A5
65 | :10040000820F911DA11DB11DBC01CD0142E0660FFF
66 | :10041000771F881F991F4A95D1F70895CF93DF93CF
67 | :10042000EC0160E08E810E949D0161E08E810E945E
68 | :100430009D0160E08E810E949D018BE891E0019713
69 | :10044000F1F7DF91CF910895CF92DF92EF92FF9273
70 | :100450000F931F93CF93DF937C016C0187E0C80E4D
71 | :10046000D11CC0E0D0E0062F10E0B8010C2E02C075
72 | :10047000759567950A94E2F76170F60181916F01B5
73 | :100480000E949D012196C430D10579F7C701DF9103
74 | :10049000CF911F910F91FF90EF90DF90CF900C9430
75 | :1004A0000E02CF92DF92EF92FF920F931F93CF93A2
76 | :1004B000DF93EC01F62E642F8C810E949D018D81CB
77 | :1004C0008F3F19F060E00E949D018F850F2D10E095
78 | :1004D00084FF25C06E0187E0C80ED11CE12CF12CF1
79 | :1004E000B8010E2C02C0759567950A94E2F7617009
80 | :1004F000F60181916F010E949D01FFEFEF1AFF0A43
81 | :1005000088E0E816F10461F7CE01DF91CF911F91E9
82 | :100510000F91FF90EF90DF90CF900C940E02B801F6
83 | :1005200084E0759567958A95E1F7CE010E942402D3
84 | :100530006F2DCE01DF91CF911F910F91FF90EF9022
85 | :10054000DF90CF900C94240241E00E94510281E0A0
86 | :1005500090E0089540E00C945102EF92FF920F93C7
87 | :100560001F93CF93DF93EC01623018F08F85886082
88 | :100570008F876B8B1C8A80E48D8B80E18E8B80E56E
89 | :100580008F8B8C810E9487008D818F3F11F00E949C
90 | :1005900087008E810E9487007E0187E0E80EF11CB3
91 | :1005A00000E010E08F8584FD03C084E090E002C08D
92 | :1005B00088E090E00817190744F4F70181917F0162
93 | :1005C0000E9487000F5F1F4FEDCF8BE39DE00197E7
94 | :1005D000F1F760E08C810E949D0160E08E810E94B5
95 | :1005E0009D018D818F3F19F060E00E949D016F8514
96 | :1005F00064FD1DC063E0CE010E9424020BE416E4FA
97 | :10060000C8010197F1F763E0CE010E942402C801FE
98 | :100610000197F1F763E0CE010E94240283E592E0A6
99 | :100620000197F1F762E0CE010E94240216C06062D9
100 | :10063000CE010E94AA028BE496E40197F1F76F8540
101 | :100640006062CE010E94AA0283E592E00197F1F771
102 | :100650006F856062CE010E94AA026F856062CE0142
103 | :100660000E94AA0284E0888B6CE0CE010E94AA025C
104 | :1006700061E0CE010E94AA028BE39FE10197F1F7AE
105 | :1006800082E0898B66E0CE01DF91CF911F910F91BF
106 | :10069000FF90EF900C94AA02843008F083E09091D0
107 | :1006A0005B05891710F08FEF890FE82FF0E0E85B0A
108 | :1006B000FA4F6489606888E495E00C94AA02009778
109 | :1006C00069F0FC0101900020E9F73197AF01481B68
110 | :1006D000590BBC0188E495E00C94A60080E090E002
111 | :1006E0000895EF92FF920F931F93CF93DF93109291
112 | :1006F0000003109238028DE9E82E84E0F82EF7010D
113 | :100700001182108201EA14E0F80111821082C5EA18
114 | :10071000D4E0188280E00E944C0380E091E00E94C7
115 | :100720005F03F70113821282F80113821282198289
116 | :1007300081E00E944C0380E091E0DF91CF911F9116
117 | :100740000F91FF90EF900C945F030F931F93CF9343
118 | :10075000DF93EC010AE010E0C8010E94780789935A
119 | :100760000F5F1F4F9FEF980F9E3FB0F31882DF91EE
120 | :10077000CF911F910F9108950E944907CF92DF9268
121 | :10078000EF92FF920F931F93CF93DF93CDB7DEB716
122 | :1007900064970FB6F894DEBF0FBECDBF98E3E92E85
123 | :1007A00092E0F92E8BEA94E00E94D1008F3F09F489
124 | :1007B000D2C020919204309193048A3019F08D3088
125 | :1007C00021F0B9C02115310569F3F901E653FC4F59
126 | :1007D00010821092930410929204EAECF3E091914B
127 | :1007E000992301F18EE3890F8230C8F78081282F89
128 | :1007F0002F7330E4939FC0011124822B8083AF01BB
129 | :10080000CA018A5C9340DA012D91AD01222329F0BF
130 | :10081000CA010297DC012C93F3CFDC01A753BC4F34
131 | :100820001C92DDCF67E471E08AEC93E00E945E07E2
132 | :100830009093C9038093C803892B49F00E94E10477
133 | :100840006091C8037091C903695F7F4F36C06FE440
134 | :1008500071E08AEC93E00E945E079093C903809355
135 | :10086000C803892BD1F00E947103E091C803F09175
136 | :10087000C9038781811103C060E771E003C0BF0134
137 | :10088000695F7F4F88E392E00E945707F0929E04D1
138 | :10089000E0929D040E94BA0485CF67E571E08AEC7E
139 | :1008A00093E00E945E079093C9038093C803892B4D
140 | :1008B00079F00E94E10467E571E080E093E00E9436
141 | :1008C000570780E093E09093A00480939F04E2CFC9
142 | :1008D0006FE571E08AEC93E00E945E078C019093D3
143 | :1008E000C9038093C803892B09F45CCFCE0101961C
144 | :1008F0000E94A503045F1F4FB801CE0101960E941C
145 | :100900004E07892B09F44ECF8AE0C82ED12CBFEFB9
146 | :10091000CB1ADB0AF8016081C60101970E948007AB
147 | :10092000D8018D918D0181508E3F88F360E0C60122
148 | :100930000E94800737CF283C310508F033CFA9014A
149 | :100940004F5F5F4F5093930440939204F901E65335
150 | :10095000FC4F808327CF64960FB6F894DEBF0FBE9E
151 | :10096000CDBFDF91CF911F910F91FF90EF90DF905E
152 | :10097000CF9008950E94BE0380E00E944C038091B6
153 | :100980009D0490919E04009741F02091A104309124
154 | :10099000A204820F931F0E945F030E94BE0381E0A6
155 | :1009A0000E944C0380919F049091A004009741F015
156 | :1009B0002091A3043091A404820F931F0C945F0331
157 | :1009C0000895109200031092A00410929F041092B8
158 | :1009D000A4041092A3041092A60481E00E944C0388
159 | :1009E00080E091E00E945F030C94BA041F920F9282
160 | :1009F0000FB60F9211242F933F934F935F936F93F2
161 | :100A00007F938F939F93AF93BF93EF93FF938BEA63
162 | :100A100094E00E940901FF91EF91BF91AF919F91E6
163 | :100A20008F917F916F915F914F913F912F910F9097
164 | :100A30000FBE0F901F9018951F920F920FB60F9236
165 | :100A400011242F938F939F93EF93FF93E091BB0417
166 | :100A5000F091BC048081E091C104F091C20482FD58
167 | :100A600012C090818091C4048F5F8F732091C50460
168 | :100A7000821751F0E091C404F0E0E555FB4F958FEB
169 | :100A80008093C40401C08081FF91EF919F918F9169
170 | :100A90002F910F900FBE0F901F9018951F920F92DD
171 | :100AA0000FB60F9211242F933F938F939F93AF9381
172 | :100AB000BF938091950490919604A0919704B09172
173 | :100AC00098043091940423E0230F2D3720F40196ED
174 | :100AD000A11DB11D05C026E8230F0296A11DB11D61
175 | :100AE000209394048093950490939604A093970484
176 | :100AF000B09398048091990490919A04A0919B04DA
177 | :100B0000B0919C040196A11DB11D8093990490930E
178 | :100B10009A04A0939B04B0939C04BF91AF919F91C2
179 | :100B20008F913F912F910F900FBE0F901F901895AE
180 | :100B3000EBEAF4E01382128288EE93E0A0E0B0E0EA
181 | :100B400084839583A683B78383E391E09183808335
182 | :100B500085EC90E09587848784EC90E09787868782
183 | :100B600080EC90E0918B808B81EC90E0938B828B7A
184 | :100B700082EC90E0958B848B86EC90E0978B868B53
185 | :100B8000118E128E138E148EE8E4F5E01382128219
186 | :100B900083E491E0918380838CE084838FEF85836D
187 | :100BA0008BE0868385E0878384E0808783E081878C
188 | :100BB00082E082871386148615861686178661E082
189 | :100BC000CF010C94AD02CF93DF93CDB7DEB764971E
190 | :100BD0000FB6F894DEBF0FBECDBF789484B58260A7
191 | :100BE00084BD84B5816084BD85B5826085BD85B5D1
192 | :100BF000816085BD80916E00816080936E0010924F
193 | :100C000081008091810082608093810080918100C9
194 | :100C1000816080938100809180008160809380005A
195 | :100C20008091B10084608093B1008091B0008160B8
196 | :100C30008093B00080917A00846080937A008091E4
197 | :100C40007A00826080937A0080917A00816080933C
198 | :100C50007A0080917A00806880937A001092C100B7
199 | :100C6000E091BB04F091BC0482E08083E091B70482
200 | :100C7000F091B8041082E091B904F091BA0484E4D0
201 | :100C800080831092C304E091BF04F091C00486E019
202 | :100C90008083E091BD04F091BE04808180618083F7
203 | :100CA000E091BD04F091BE04808188608083E09172
204 | :100CB000BD04F091BE04808180688083E091BD0412
205 | :100CC000F091BE0480818F7D808362E088E495E0AE
206 | :100CD0000E94AD028DE00E94870061E088E495E00B
207 | :100CE0000E94AA028BE39FE10197F1F760915905F9
208 | :100CF0006E7F60935905646088E495E00E94AA02C3
209 | :100D00008DE191E00E945F0381E00E944C0381E14C
210 | :100D100091E00E945F030E94E9014B015C0128EB16
211 | :100D2000C22E2BE0D22EE12CF12C0E94E901DC0135
212 | :100D3000CB0188199909AA09BB09883E9340A105EE
213 | :100D4000B10558F021E0C21AD108E108F10888EE97
214 | :100D5000880E83E0981EA11CB11CC114D104E104CB
215 | :100D6000F10419F70E9471038E010F5F1F4FC80134
216 | :100D70000E94A5038CE691E090939E0480939D04CD
217 | :100D80001093A00400939F040E94BA0406E010E0B0
218 | :100D900096E0F92E0E94BE038091A9049091AA04C6
219 | :100DA0008F3FAFEF9A0731F001969093AA0480939A
220 | :100DB000A90452C01092AA041092A9048091A70419
221 | :100DC0009091A80401969093A8048093A704B80179
222 | :100DD0000E942F07892B21F461E08DE00E949D0184
223 | :100DE000E5EAF4E081EAC82E84E0D82E4DE954E02B
224 | :100DF0008081882341F0843019F4D6011D921C9221
225 | :100E00008150808319C0D6012D913C91DA016D91FA
226 | :100E10007C91620F731FDB010D900020E9F7CD017B
227 | :100E20000197861B970B419730F02F5F3F4FD601FC
228 | :100E30002D933C9301C0F0823196B2E0CB0ED11CD1
229 | :100E40004E5F5F4F24E0E73AF20791F60E94BA0442
230 | :100E500060E08DE00E949D010E9493019BCFAA1B40
231 | :100E6000BB1B51E107C0AA1FBB1FA617B70710F095
232 | :100E7000A61BB70B881F991F5A95A9F780959095C7
233 | :100E8000BC01CD010895EE0FFF1F0590F491E02DF8
234 | :100E9000099481E090E0F8940C948E07FB01DC014A
235 | :100EA0008D91019080190110D9F3990B0895FB01E0
236 | :100EB000DC0101900D920020E1F70895FB015191B2
237 | :100EC0005523A9F0BF01DC014D9145174111E1F710
238 | :100ED00059F4CD010190002049F04D914015411188
239 | :100EE000C9F3FB014111EFCF81E090E00197089534
240 | :100EF000F999FECF92BD81BDF89A992780B50895E2
241 | :100F0000262FF999FECF1FBA92BD81BD20BD0FB625
242 | :100F1000F894FA9AF99A0FBE01960895F894FFCFC3
243 | :100F200020202020202020202020202020202020C1
244 | :100F300000286329204B61726157696E004B617212
245 | :100F40006164696F206C63640000006005800000CC
246 | :100F50000000002A01A600F300D100E500710100A5
247 | :100F6000000000A402A6004D455441233A20004948
248 | :100F7000435930233A200053544F505045440053B6
249 | :100F8000746174696F6E2049703A200049503A00CC
250 | :107800000C94343C0C94513C0C94513C0C94513CE1
251 | :107810000C94513C0C94513C0C94513C0C94513CB4
252 | :107820000C94513C0C94513C0C94513C0C94513CA4
253 | :107830000C94513C0C94513C0C94513C0C94513C94
254 | :107840000C94513C0C94513C0C94513C0C94513C84
255 | :107850000C94513C0C94513C0C94513C0C94513C74
256 | :107860000C94513C0C94513C11241FBECFEFD8E036
257 | :10787000DEBFCDBF11E0A0E0B1E0ECE9FFE702C060
258 | :1078800005900D92A230B107D9F712E0A2E0B1E065
259 | :1078900001C01D92AD30B107E1F70E942D3D0C945F
260 | :1078A000CC3F0C94003C982F959595959595959582
261 | :1078B000905D8F708A307CF0282F295A8091C0000B
262 | :1078C00085FFFCCF9093C6008091C00085FFFCCF60
263 | :1078D0002093C6000895282F205DF0CF982F809127
264 | :1078E000C00085FFFCCF9093C6000895EF92FF92F1
265 | :1078F0000F931F93EE24FF2487018091C00087FD22
266 | :1079000017C00894E11CF11C011D111D81E4E8164B
267 | :1079100082E4F8068FE0080780E0180770F3E09132
268 | :107920000401F091050109958091C00087FFE9CF1E
269 | :107930008091C6001F910F91FF90EF9008950E94D3
270 | :10794000763C982F8091C00085FFFCCF9093C600B5
271 | :1079500091362CF490330CF09053892F089597555D
272 | :10796000892F08951F930E949F3C182F0E949F3CCF
273 | :107970001295107F810F1F9108951F93182F882350
274 | :1079800021F00E94763C1150E1F71F9108951F935A
275 | :10799000182F0E94763C803249F0809103018F5F5E
276 | :1079A000809303018530C1F01F9108958091C0003C
277 | :1079B00085FFFCCF84E18093C6008091C00085FFE5
278 | :1079C000FCCF1093C6008091C00085FFFCCF80E102
279 | :1079D0008093C6001F910895E0910401F091050184
280 | :1079E00009951F9108950E94763C803241F0809164
281 | :1079F00003018F5F80930301853081F008958091AA
282 | :107A0000C00085FFFCCF84E18093C6008091C00058
283 | :107A100085FFFCCF80E18093C6000895E0910401CA
284 | :107A2000F09105010995089540E951E08823A1F0FE
285 | :107A30002D9A28EE33E0FA013197F1F721503040CA
286 | :107A4000D1F72D9828EE33E0FA013197F1F7215064
287 | :107A50003040D1F7815061F708953F924F925F9285
288 | :107A60006F927F928F929F92AF92BF92CF92DF924E
289 | :107A7000EF92FF920F931F93CF93DF93000080E16B
290 | :107A80008093C4001092C50088E18093C10086E015
291 | :107A90008093C2005098589A259A81E00E94143D24
292 | :107AA00024E1F22E9EE1E92E85E9D82E0FE0C02ECA
293 | :107AB00010E1B12EAA24A394B1E49B2EA6E58A2E50
294 | :107AC000F2E57F2EE0E26E2E79E4572E63E5462E36
295 | :107AD00050E5352E0E94763C8033B1F18133B9F107
296 | :107AE000803409F46FC0813409F476C0823409F41B
297 | :107AF00085C0853409F488C0803531F1823521F1A3
298 | :107B0000813511F1853509F485C0863509F48DC0BC
299 | :107B1000843609F496C0843709F403C1853709F423
300 | :107B200072C1863709F466C0809103018F5F80932C
301 | :107B30000301853079F6E0910401F0910501099582
302 | :107B40000E94763C803351F60E94F33CC3CF0E94E2
303 | :107B5000763C803249F78091C00085FFFCCFF092DF
304 | :107B6000C6008091C00085FFFCCF9092C600809136
305 | :107B7000C00085FFFCCF8092C6008091C00085FFC9
306 | :107B8000FCCF7092C6008091C00085FFFCCF609250
307 | :107B9000C6008091C00085FFFCCF5092C600809146
308 | :107BA000C00085FFFCCF4092C6008091C00085FFD9
309 | :107BB000FCCF3092C6008091C00085FFFCCFB09210
310 | :107BC000C60088CF0E94763C863808F4BDCF0E945C
311 | :107BD000763C0E94F33C7ECF0E94763C803809F4CC
312 | :107BE0009CC0813809F40BC1823809F43CC1883942
313 | :107BF00009F48FC080E00E94C73C6CCF84E10E94F2
314 | :107C0000BD3C0E94F33C66CF85E00E94BD3C0E94D3
315 | :107C1000F33C60CF0E94763C809306010E94763C44
316 | :107C2000809307010E94F33C55CF0E94763C80333D
317 | :107C300009F41DC183E00E94BD3C80E00E94C73C66
318 | :107C400049CF0E94763C809309020E94763C809343
319 | :107C5000080280910C028E7F80930C020E94763C79
320 | :107C6000853409F415C18091080290910902892B8D
321 | :107C700089F000E010E00E94763CF801E85FFE4FDA
322 | :107C800080830F5F1F4F80910802909109020817AF
323 | :107C9000190788F30E94763C803209F045CF809125
324 | :107CA0000C0280FF01C16091060170910701660F0F
325 | :107CB000771F7093070160930601A0910802B091AD
326 | :107CC00009021097C9F0E8E0F1E09B01AD014E0F09
327 | :107CD0005F1FF999FECF32BD21BD819180BDFA9A17
328 | :107CE000F99A2F5F3F4FE417F50799F76A0F7B1F4B
329 | :107CF00070930701609306018091C00085FFFCCF5F
330 | :107D0000F092C6008091C00085FFFCCFB092C60003
331 | :107D1000E1CE83E00E94C73CDDCE82E00E94C73CFA
332 | :107D2000D9CE0E94763C809309020E94763C8093D3
333 | :107D300008028091060190910701880F991F909386
334 | :107D40000701809306010E94763C853409F4A6C0A1
335 | :107D500080910C028E7F80930C020E94763C8032D0
336 | :107D600009F0B8CE8091C00085FFFCCFF092C6002C
337 | :107D7000609108027091090261157105B9F140E046
338 | :107D800050E080910C02A82FA170B82FB27011C0E2
339 | :107D9000BB2309F45CC0E0910601F0910701319624
340 | :107DA000F0930701E09306014F5F5F4F46175707B7
341 | :107DB000E8F4AA2369F3F999FECF209106013091E6
342 | :107DC000070132BD21BDF89A90B58091C00085FFB2
343 | :107DD000FCCF9093C6002F5F3F4F30930701209355
344 | :107DE00006014F5F5F4F4617570718F38091C00099
345 | :107DF00085FDE5CE8091C00085FFF8CFE0CE81E023
346 | :107E00000E94C73C67CE0E94763C803209F08CCE3F
347 | :107E10008091C00085FFFCCFF092C6008091C00029
348 | :107E200085FFFCCFE092C6008091C00085FFFCCFAB
349 | :107E3000D092C6008091C00085FFFCCFC092C600E2
350 | :107E40008091C00085FFFCCFB092C60043CEE09188
351 | :107E50000601F091070194918091C00085FFFCCF4D
352 | :107E60009093C6009CCF80E10E94C73C33CE0E9415
353 | :107E7000763C0E94763C182F0E94763C112309F430
354 | :107E800083C0113009F484C08FE00E94C73C22CE29
355 | :107E900080910C02816080930C02E5CE80910C02EF
356 | :107EA000816080930C0259CF809107018823880F4D
357 | :107EB000880B8A2180930B02809106019091070123
358 | :107EC000880F991F90930701809306018091080203
359 | :107ED00080FF09C080910802909109020196909359
360 | :107EE000090280930802F894F999FECF1127E091D6
361 | :107EF0000601F0910701C8E0D1E08091080290915D
362 | :107F00000902103091F40091570001700130D9F34B
363 | :107F100003E000935700E89500915700017001308D
364 | :107F2000D9F301E100935700E89509901990009169
365 | :107F3000570001700130D9F301E000935700E89534
366 | :107F40001395103498F011270091570001700130FB
367 | :107F5000D9F305E000935700E895009157000170B0
368 | :107F60000130D9F301E100935700E895329602976A
369 | :107F700009F0C7CF103011F00296E5CF112480919F
370 | :107F8000C00085FFB9CEBCCE8EE10E94C73CA2CD19
371 | :0C7F900085E90E94C73C9ECDF894FFCF0D
372 | :027F9C00800063
373 | :040000030000780081
374 | :00000001FF
375 |
--------------------------------------------------------------------------------
/karadiolcd16x2/karadiolcd16x2.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karawin/karadio-addons/77df51cf2f692d93382e3dfd87fe8d6e600b0ce8/karadiolcd16x2/karadiolcd16x2.zip
--------------------------------------------------------------------------------
/karadiolcd16x2/karadiolcd16x2old.ino:
--------------------------------------------------------------------------------
1 |
2 | /*
3 |
4 | Karadiolcd16x2.ino
5 |
6 | */
7 | // include the library code:
8 | #include
9 | /*
10 | The circuit:
11 | * LCD RS pin to digital pin 12
12 | * LCD Enable pin to digital pin 11
13 | * LCD D4 pin to digital pin 5
14 | * LCD D5 pin to digital pin 4
15 | * LCD D6 pin to digital pin 3
16 | * LCD D7 pin to digital pin 2
17 | * LCD R/W pin to ground
18 | * 10K resistor:
19 | * ends to +5V and ground
20 | * wiper to LCD VO pin (pin 3)
21 | */
22 |
23 | #define version 1.0
24 | #include
25 | // constants
26 | const int BAUD = 28800; // any standard serial value: 300 - 115200
27 | const int EEaddr = 0; // EEPROM address for storing WPM
28 | const int EEaddr1 = 2; // EEPROM address for LCD address
29 | const int EEaddrIp = 10; // EEPROM address for the IP
30 |
31 | const byte ContrastPin = 8; // D8 low activates the Contrast adjustment
32 |
33 | // Character array pointers
34 | char msg[] = {"Karadio lcd"}; //
35 | char msg1[] = {"(c) KaraWin"}; //
36 | char blank[] = {" "};
37 | // Karadio specific data
38 | #define BUFLEN 200
39 | #define LINES 2
40 | char line[BUFLEN]; // receive buffer
41 | char station[BUFLEN]; //received station
42 | char title[BUFLEN]; // received title
43 | char nameset[BUFLEN];
44 | char* lline[LINES] ; // array of ptr of n lines
45 | int iline[LINES] ; //array of index for scrolling
46 | byte tline[LINES] ;
47 | char* ici;
48 | unsigned index = 0;
49 | unsigned loopcount = 0;
50 | unsigned scrl = 0;
51 |
52 |
53 | int x = 16; //Width
54 | char temp;
55 |
56 | // initialize the library with the numbers of the interface pins
57 | LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
58 |
59 | ////////////////////////////////////////
60 | // Clear all buffers and indexes
61 | void clearAll()
62 | {
63 | title[0] = 0;
64 | station[0]=0;
65 | for (int i=0;iBUFLEN-1) break; // small memory so small buffer
205 | line[index++] = temp;
206 | }
207 | }
208 | }
209 |
210 | ////////////////////////////////////////
211 | // draw all lines
212 | void draw()
213 | {
214 | lcd.clear();
215 | for (int i = 0;i < LINES;i++)
216 | {
217 | serial();
218 | lcd.setCursor(0, i);
219 | if ((lline[i] != NULL)) lcd.print(lline[i]+iline[i]);
220 | delay(1);
221 | }
222 | }
223 | ////////////////////////////////////////
224 | // scroll each line
225 | void scroll()
226 | {
227 | unsigned len;
228 | for (int i = 0;i < LINES;i++)
229 | {
230 | if (tline[i]>0)
231 | {
232 | if (tline[i] == 4) iline[i]= 0;
233 | tline[i]--;
234 | }
235 | else
236 | {
237 | len = strlen(lline[i]+(iline[i]));
238 | if (len > x) iline[i]++;
239 | else
240 | {tline[i] = 6;}
241 | }
242 | }
243 | draw();
244 | }
245 |
246 | ////////////////////////////////////////
247 | void loop(void) {
248 | serial();
249 | if (loopcount++ == 0xffff)
250 | {
251 | loopcount = 0;
252 | if (++scrl%6 == 0) digitalWrite(13, HIGH);
253 | scroll();
254 | digitalWrite(13, LOW);
255 | }
256 | }
257 |
258 |
--------------------------------------------------------------------------------
/karadiolcd16x2/karadioutils.ino:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | int freeRam () {
5 | extern int __heap_start, *__brkval;
6 | int v;
7 | return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
8 | }
9 | /*
10 | void removeUtf8(byte *characters)
11 | {
12 | int index = 0;
13 | while (characters[index])
14 | {
15 | if ((characters[index]) == 195)
16 | {
17 | characters[index] = 'x';
18 | // Serial.println((characters[index]));
19 | characters[index+1] +=64;
20 | int sind = index+1;
21 | switch(characters[sind])
22 | {
23 | case 0xFF: case 0xFD:
24 | characters[sind] = 'y'; break;
25 | case 0xDF:
26 | characters[sind] = 'Y'; break;
27 | case 0xE7:
28 | characters[sind] = 'c'; break;
29 | case 0xC7:
30 | characters[sind] = 'C'; break;
31 | case 0xF2: case 0XF3: case 0xF4: case 0xF5: case 0xF6:
32 | characters[sind] = 'o'; break;
33 | case 0xD2: case 0XD3: case 0xD4: case 0xD5: case 0xD6:
34 | characters[sind] = 'O'; break;
35 | case 0xEC: case 0XED: case 0xEE: case 0xEF:
36 | characters[sind] = 'i'; break;
37 | case 0xCC: case 0XCD: case 0xCE: case 0xCF:
38 | characters[sind] = 'I'; break;
39 | case 0xF9: case 0XFA: case 0xFB: case 0xFC:
40 | characters[sind] = 'u'; break;
41 | case 0xD9: case 0XDA: case 0xDB: case 0xDC:
42 | characters[sind] = 'U'; break;
43 | case 0xE8: case 0XE9: case 0xEA: case 0xEB:
44 | characters[sind] = 'e'; break;
45 | case 0xC8: case 0XC9: case 0xCA: case 0xCB:
46 | characters[sind] = 'E'; break;
47 | case 0xE3: case 0XE0: case 0xE1: case 0xE2: case 0xE4: case 0XE5: case 0xE6:
48 | characters[sind] = 'a'; break;
49 | case 0xC3: case 0XC0: case 0xC1: case 0xC2: case 0xC4: case 0XC5: case 0xC6:
50 | characters[sind] = 'A'; break;
51 | default: ;
52 | }
53 | while (characters[sind]) { characters[sind-1] = characters[sind];sind++;}
54 | characters[sind-1] = 0;
55 |
56 | }
57 | index++;
58 | }
59 | }*/
60 |
61 | void removeUtf8(byte *characters)
62 | {
63 | int index = 0;
64 | while (characters[index])
65 | {
66 | if ((characters[index] >= 0xc2)&&(characters[index] <= 0xc3)) // only 0 to FF ascii char
67 | {
68 | // Serial.println((characters[index]));
69 | characters[index+1] = ((characters[index]<<6)&0xFF) | (characters[index+1] & 0x3F);
70 | int sind = index+1;
71 | while (characters[sind]) { characters[sind-1] = characters[sind];sind++;}
72 | characters[sind-1] = 0;
73 |
74 | }
75 | index++;
76 | }
77 | }
78 |
79 |
--------------------------------------------------------------------------------