Thomas Buck пре 8 месеци
родитељ
комит
6036a73cfe
4 измењених фајлова са 128 додато и 1 уклоњено
  1. 1
    0
      CMakeLists.txt
  2. 29
    0
      include/logo.h
  3. 9
    1
      src/lcd.c
  4. 89
    0
      src/logo.c

+ 1
- 0
CMakeLists.txt Прегледај датотеку

@@ -35,6 +35,7 @@ target_sources(drumkit PUBLIC
35 35
     src/encoder.c
36 36
     src/lcd.c
37 37
     src/led.c
38
+    src/logo.c
38 39
     src/main.c
39 40
     src/pulse.c
40 41
     src/sequence.c

+ 29
- 0
include/logo.h Прегледај датотеку

@@ -0,0 +1,29 @@
1
+/*
2
+ * logo.h
3
+ *
4
+ * Copyright (c) 2022 - 2023 Thomas Buck (thomas@xythobuz.de)
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * See <http://www.gnu.org/licenses/>.
17
+ */
18
+
19
+#ifndef __LOGO_H__
20
+#define __LOGO_H__
21
+
22
+#include <stdint.h>
23
+
24
+#define LOGO_HEIGHT 64
25
+#define LOGO_WIDTH 128
26
+
27
+extern uint8_t logo_data[LOGO_HEIGHT * LOGO_WIDTH / 8];
28
+
29
+#endif // __LOGO_H__

+ 9
- 1
src/lcd.c Прегледај датотеку

@@ -23,6 +23,7 @@
23 23
 #include "hardware/i2c.h"
24 24
 
25 25
 #include "ssd1306.h"
26
+#include "logo.h"
26 27
 #include "lcd.h"
27 28
 
28 29
 #define LCD_I2C i2c0
@@ -42,7 +43,14 @@ void lcd_init(void) {
42 43
     ssd1306_init(&disp, LCD_WIDTH, LCD_HEIGHT, LCD_ADDR, LCD_I2C);
43 44
 
44 45
     ssd1306_clear(&disp);
45
-    ssd1306_draw_string(&disp, 0, 5, 5, "LARS");
46
+    for (uint y = 0; y < LOGO_HEIGHT; y++) {
47
+        for (uint x = 0; x < LOGO_WIDTH; x++) {
48
+            uint pos = y * LOGO_WIDTH + x;
49
+            if (logo_data[pos / 8] & (1 << (pos % 8))) {
50
+                ssd1306_draw_pixel(&disp, x, y);
51
+            }
52
+        }
53
+    }
46 54
     ssd1306_show(&disp);
47 55
 }
48 56
 

+ 89
- 0
src/logo.c Прегледај датотеку

@@ -0,0 +1,89 @@
1
+/*
2
+ * logo.c
3
+ *
4
+ * Image converted with:
5
+ * https://notisrac.github.io/FileToCArray/
6
+ *
7
+ * Copyright (c) 2024 Thomas Buck (thomas@xythobuz.de)
8
+ *
9
+ * This program is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * See <http://www.gnu.org/licenses/>.
20
+ */
21
+
22
+#include "logo.h"
23
+
24
+uint8_t logo_data[LOGO_HEIGHT * LOGO_WIDTH / 8] = {
25
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80,
26
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x97,
27
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7a,
28
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x40,
29
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
30
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
31
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
32
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
33
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00,
34
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x83,
35
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x09,
36
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x05, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f,
37
+  0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x1f, 0xff, 0x83, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88,
38
+  0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0xff, 0xf8, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0,
39
+  0xff, 0xff, 0xff, 0xff, 0x80, 0x07, 0xff, 0x00, 0x58, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
40
+  0xff, 0xff, 0xff, 0xfc, 0x00, 0x1f, 0xf0, 0x03, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc,
41
+  0xff, 0xff, 0xff, 0xe0, 0x02, 0xfe, 0x00, 0x7f, 0xff, 0xc1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe,
42
+  0xff, 0xff, 0xfe, 0x00, 0x07, 0xf0, 0x07, 0xff, 0xff, 0xf0, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff,
43
+  0xff, 0xff, 0xf8, 0x08, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff,
44
+  0xff, 0xff, 0xc0, 0x41, 0x7f, 0x07, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xfe,
45
+  0xe0, 0xfe, 0x00, 0x07, 0xfe, 0x0f, 0xff, 0xff, 0xe0, 0x3f, 0xc1, 0xff, 0xff, 0xff, 0xff, 0xfe,
46
+  0x88, 0x78, 0x00, 0x3f, 0xff, 0x01, 0xff, 0xfe, 0x00, 0x07, 0xf0, 0x7f, 0xff, 0xff, 0xff, 0xfc,
47
+  0x0c, 0x00, 0x01, 0xff, 0xfe, 0x00, 0x7f, 0x40, 0x00, 0x01, 0xfc, 0x3f, 0xff, 0xff, 0xff, 0xfe,
48
+  0x3c, 0x00, 0x0f, 0xff, 0xff, 0x00, 0x78, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0xff, 0xff, 0xff, 0xfe,
49
+  0x98, 0x00, 0x3f, 0xff, 0xfe, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x0e, 0x3f, 0xff, 0xff, 0xff, 0xfe,
50
+  0x8c, 0x01, 0xff, 0xff, 0xff, 0x00, 0x78, 0x00, 0x00, 0x00, 0x07, 0x3f, 0xff, 0xff, 0xff, 0xfe,
51
+  0x18, 0x0f, 0xff, 0xff, 0xfe, 0x00, 0x78, 0x00, 0x07, 0x80, 0x03, 0x3f, 0xff, 0xff, 0xff, 0xff,
52
+  0x18, 0x7f, 0xff, 0xff, 0xff, 0x00, 0x78, 0x00, 0x0a, 0xc0, 0x03, 0x3f, 0xff, 0xff, 0xff, 0xff,
53
+  0x18, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x78, 0x00, 0x18, 0x40, 0x02, 0x3f, 0xff, 0xff, 0xff, 0xff,
54
+  0x19, 0xff, 0xff, 0xff, 0xff, 0x00, 0x78, 0x00, 0x1d, 0x40, 0x03, 0x3f, 0xff, 0xff, 0xff, 0xff,
55
+  0x39, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x78, 0x20, 0x15, 0x40, 0xf2, 0x3f, 0xff, 0xff, 0xff, 0xff,
56
+  0x19, 0xff, 0xff, 0xff, 0xff, 0x00, 0x78, 0x78, 0x19, 0x61, 0xf9, 0x3f, 0xff, 0xff, 0xff, 0xff,
57
+  0x31, 0xff, 0xff, 0xff, 0xff, 0x16, 0xf9, 0xf8, 0x0d, 0xc3, 0xfd, 0x3f, 0xff, 0xff, 0xff, 0xff,
58
+  0x71, 0xff, 0xff, 0xff, 0xff, 0x12, 0x79, 0x8c, 0x07, 0x27, 0x8c, 0x3f, 0xff, 0xff, 0xff, 0xff,
59
+  0xf1, 0xff, 0xff, 0xff, 0xfe, 0x00, 0xf9, 0x8f, 0xfa, 0xe7, 0x0c, 0x3f, 0xff, 0xff, 0xff, 0xff,
60
+  0xe3, 0xff, 0xff, 0xff, 0xff, 0x00, 0x79, 0x82, 0xf7, 0x6e, 0x0c, 0x3f, 0xff, 0xff, 0xff, 0xff,
61
+  0xc7, 0xff, 0xff, 0xff, 0xff, 0x00, 0x79, 0x80, 0x17, 0x1f, 0x9c, 0x3f, 0xff, 0xff, 0xff, 0xff,
62
+  0x87, 0xff, 0xff, 0xff, 0xff, 0x00, 0x78, 0xf8, 0x17, 0x01, 0xfc, 0x3f, 0xff, 0xff, 0xff, 0xff,
63
+  0x1f, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x78, 0x68, 0x07, 0x00, 0xe1, 0x3f, 0xff, 0xff, 0xff, 0xff,
64
+  0x3f, 0xff, 0xff, 0xff, 0xff, 0x00, 0x78, 0x00, 0x07, 0x00, 0x03, 0x3f, 0xff, 0xff, 0xff, 0xff,
65
+  0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x78, 0x00, 0x02, 0x00, 0x02, 0x3f, 0xff, 0xff, 0xff, 0xff,
66
+  0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x78, 0x00, 0x00, 0x00, 0x02, 0x3f, 0xff, 0xff, 0xff, 0xff,
67
+  0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff,
68
+  0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff,
69
+  0xff, 0xff, 0xff, 0xff, 0xff, 0x40, 0x78, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff,
70
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x78, 0x00, 0x00, 0x00, 0x56, 0xff, 0xff, 0xff, 0xff, 0xff,
71
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x38, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
72
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x82, 0xa0, 0x00, 0x7f, 0xff, 0xff, 0xf0, 0x01, 0x5f, 0xff,
73
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x7f, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x2f,
74
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x7f, 0xff, 0xff, 0x83, 0xfa, 0x00, 0x00,
75
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x7f, 0xff, 0xff, 0x03, 0x7f, 0xf4, 0x41,
76
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x2a, 0x00, 0x00, 0x33, 0x05, 0xff, 0xfc,
77
+  0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xd4, 0x80, 0x00, 0x51, 0xf0, 0x00, 0xf2, 0x00, 0x07, 0x7f,
78
+  0xff, 0xff, 0xff, 0xb5, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x7f, 0xfc, 0x00, 0x72, 0x00, 0x00, 0x0b,
79
+  0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xfe, 0x00, 0x26, 0x00, 0x00, 0x00,
80
+  0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0x00, 0x66, 0x00, 0x00, 0x00,
81
+  0xff, 0xff, 0xc1, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0x00, 0x26, 0x00, 0x00, 0x00,
82
+  0xff, 0xff, 0xcf, 0xf0, 0x00, 0x00, 0x00, 0x01, 0xfe, 0xd4, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00,
83
+  0xff, 0xff, 0x0f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00,
84
+  0xff, 0xff, 0x1f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0xf0, 0x66, 0x00, 0x00, 0x00,
85
+  0xff, 0xfe, 0x3f, 0xfe, 0x00, 0x00, 0x00, 0x02, 0xaf, 0xff, 0xff, 0xf0, 0x2e, 0x00, 0x00, 0x00,
86
+  0xff, 0xfc, 0x7f, 0xfe, 0x00, 0x02, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x7f, 0xe8, 0x00, 0x00,
87
+  0xff, 0xfc, 0x7f, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x2f, 0xff, 0xc0, 0x00,
88
+  0xff, 0xfc, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x2f, 0xff, 0xff, 0x00
89
+};

Loading…
Откажи
Сачувај