@geastack/targets 0.1.95 → 0.1.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/build-config.json +79 -0
- package/package.json +2 -2
- package/targets/esp32/chip_bindings/displays/co5300.cpp +50 -2
- package/targets/esp32/chip_bindings/displays/sh8601.cpp +22 -3
- package/targets/esp32/chip_bindings/touch/cst9217.cpp +19 -1
- package/targets/esp32/display.cpp +4 -0
- package/targets/esp32-s3-epaper-1.54/main/CMakeLists.txt +10 -0
- package/targets/esp32-s3-m5stack-sticks3/main/display.cpp +29 -8
- package/targets/esp32-s3-m5stack-stopwatch/CMakeLists.txt +9 -0
- package/targets/esp32-s3-m5stack-stopwatch/README.md +76 -0
- package/targets/esp32-s3-m5stack-stopwatch/dependencies.lock +35 -0
- package/targets/esp32-s3-m5stack-stopwatch/main/CMakeLists.txt +45 -0
- package/targets/esp32-s3-m5stack-stopwatch/main/Kconfig.projbuild +1 -0
- package/targets/esp32-s3-m5stack-stopwatch/main/idf_component.yml +4 -0
- package/targets/esp32-s3-m5stack-stopwatch/main/include/board.h +33 -0
- package/targets/esp32-s3-m5stack-stopwatch/main/include/panel_power.h +12 -0
- package/targets/esp32-s3-m5stack-stopwatch/main/panel_reset.cpp +199 -0
- package/targets/esp32-s3-m5stack-stopwatch/main/touch.cpp +147 -0
- package/targets/esp32-s3-m5stack-stopwatch/partitions.csv +8 -0
- package/targets/esp32-s3-m5stack-stopwatch/sdkconfig.defaults +33 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/CMakeLists.txt +11 -2
- package/targets/esp32-s3-touch-amoled-2.06/main/idf_component.yml +2 -0
- package/targets/esp32-s3-touch-amoled-2.06-sh8601.json +158 -0
- package/targets/esp32-s3-touch-lcd-1.54/CMakeLists.txt +10 -0
- package/targets/esp32-s3-touch-lcd-1.54/README.md +45 -0
- package/targets/esp32-s3-touch-lcd-1.54/dependencies.lock +87 -0
- package/targets/esp32-s3-touch-lcd-1.54/main/CMakeLists.txt +27 -0
- package/targets/esp32-s3-touch-lcd-1.54/main/Kconfig.projbuild +12 -0
- package/targets/esp32-s3-touch-lcd-1.54/main/app_main.cpp +133 -0
- package/targets/esp32-s3-touch-lcd-1.54/main/buttons.cpp +102 -0
- package/targets/esp32-s3-touch-lcd-1.54/main/display.cpp +2 -0
- package/targets/esp32-s3-touch-lcd-1.54/main/fatfs_ffconf.h +377 -0
- package/targets/esp32-s3-touch-lcd-1.54/main/i2c.cpp +2 -0
- package/targets/esp32-s3-touch-lcd-1.54/main/idf_component.yml +7 -0
- package/targets/esp32-s3-touch-lcd-1.54/main/include/board.h +37 -0
- package/targets/esp32-s3-touch-lcd-1.54/main/include/buttons.h +2 -0
- package/targets/esp32-s3-touch-lcd-1.54/main/launcher_button.cpp +2 -0
- package/targets/esp32-s3-touch-lcd-1.54/main/power.cpp +69 -0
- package/targets/esp32-s3-touch-lcd-1.54/main/sdcard_mount.cpp +2 -0
- package/targets/esp32-s3-touch-lcd-1.54/main/touch.cpp +2 -0
- package/targets/esp32-s3-touch-lcd-1.54/partitions.csv +7 -0
- package/targets/esp32-s3-touch-lcd-1.54/sdkconfig.defaults +272 -0
- package/targets/esp32-s31-espressif-mosaico/main/CMakeLists.txt +2 -0
- package/targets/esp32-s31-espressif-mosaico/main/include/mosaico_peer_uart.h +17 -0
- package/targets/esp32-s31-espressif-mosaico/main/peer_uart.cpp +86 -0
- package/targets/rp2350-tufty-2350/CMakeLists.txt +11 -2
- package/targets/rp2350-waveshare-touch-amoled-2.41/CMakeLists.txt +6 -2
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/app.cpp +5 -1
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_gea_platform.cpp +13 -7
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_panel.h +4 -0
- package/targets.json +29 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
#ifndef _FFCONF_DEFINED
|
|
2
|
+
#define _FFCONF_DEFINED
|
|
3
|
+
|
|
4
|
+
#include "sdkconfig.h"
|
|
5
|
+
|
|
6
|
+
/*---------------------------------------------------------------------------/
|
|
7
|
+
/ Configurations of FatFs Module
|
|
8
|
+
/---------------------------------------------------------------------------*/
|
|
9
|
+
|
|
10
|
+
#define FFCONF_DEF 80286 /* Revision ID */
|
|
11
|
+
|
|
12
|
+
/*---------------------------------------------------------------------------/
|
|
13
|
+
/ Function Configurations
|
|
14
|
+
/---------------------------------------------------------------------------*/
|
|
15
|
+
|
|
16
|
+
#define FF_FS_READONLY 0
|
|
17
|
+
/* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
|
|
18
|
+
/ Read-only configuration removes writing API functions, f_write(), f_sync(),
|
|
19
|
+
/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
|
|
20
|
+
/ and optional writing functions as well. */
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#define FF_FS_MINIMIZE 0
|
|
24
|
+
/* This option defines minimization level to remove some basic API functions.
|
|
25
|
+
/
|
|
26
|
+
/ 0: Basic functions are fully enabled.
|
|
27
|
+
/ 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename()
|
|
28
|
+
/ are removed.
|
|
29
|
+
/ 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1.
|
|
30
|
+
/ 3: f_lseek() function is removed in addition to 2. */
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#define FF_USE_FIND 0
|
|
34
|
+
/* This option switches filtered directory read functions, f_findfirst() and
|
|
35
|
+
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
#define FF_USE_MKFS 1
|
|
39
|
+
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
#ifdef CONFIG_FATFS_USE_FASTSEEK
|
|
43
|
+
#define FF_USE_FASTSEEK 1
|
|
44
|
+
#else
|
|
45
|
+
#define FF_USE_FASTSEEK 0
|
|
46
|
+
#endif
|
|
47
|
+
/* This option switches fast seek function. (0:Disable or 1:Enable) */
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
#define FF_USE_EXPAND 1
|
|
51
|
+
/* This option switches f_expand function. (0:Disable or 1:Enable) */
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
#define FF_USE_CHMOD 1
|
|
55
|
+
/* This option switches attribute manipulation functions, f_chmod() and f_utime().
|
|
56
|
+
/ (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
#ifdef CONFIG_FATFS_USE_LABEL
|
|
60
|
+
#define FF_USE_LABEL 1
|
|
61
|
+
#else
|
|
62
|
+
#define FF_USE_LABEL 0
|
|
63
|
+
#endif
|
|
64
|
+
/* This option switches volume label functions, f_getlabel() and f_setlabel().
|
|
65
|
+
/ (0:Disable or 1:Enable) */
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
#define FF_USE_FORWARD 0
|
|
69
|
+
/* This option switches f_forward() function. (0:Disable or 1:Enable) */
|
|
70
|
+
|
|
71
|
+
#if defined(CONFIG_FATFS_USE_STRFUNC_WITHOUT_CRLF_CONV)
|
|
72
|
+
#define FF_USE_STRFUNC 1
|
|
73
|
+
#elif defined(CONFIG_FATFS_USE_STRFUNC_WITH_CRLF_CONV)
|
|
74
|
+
#define FF_USE_STRFUNC 2
|
|
75
|
+
#else /* CONFIG_FATFS_USE_STRFUNC_NONE */
|
|
76
|
+
#define FF_USE_STRFUNC 0
|
|
77
|
+
#endif
|
|
78
|
+
|
|
79
|
+
#ifdef CONFIG_FATFS_PRINT_LLI
|
|
80
|
+
#define FF_PRINT_LLI 1
|
|
81
|
+
#else
|
|
82
|
+
#define FF_PRINT_LLI 0
|
|
83
|
+
#endif
|
|
84
|
+
|
|
85
|
+
#ifdef CONFIG_FATFS_PRINT_FLOAT
|
|
86
|
+
#define FF_PRINT_FLOAT 1
|
|
87
|
+
#else
|
|
88
|
+
#define FF_PRINT_FLOAT 0
|
|
89
|
+
#endif
|
|
90
|
+
|
|
91
|
+
#if defined(CONFIG_FATFS_STRF_ENCODE_ANSI)
|
|
92
|
+
#define FF_STRF_ENCODE 0
|
|
93
|
+
#elif defined(CONFIG_FATFS_STRF_ENCODE_UTF16LE)
|
|
94
|
+
#define FF_STRF_ENCODE 1
|
|
95
|
+
#elif defined(CONFIG_FATFS_STRF_ENCODE_UTF16BE)
|
|
96
|
+
#define FF_STRF_ENCODE 2
|
|
97
|
+
#else /* CONFIG_FATFS_STRF_ENCODE_UTF8 */
|
|
98
|
+
#define FF_STRF_ENCODE 3
|
|
99
|
+
#endif
|
|
100
|
+
|
|
101
|
+
/* FF_USE_STRFUNC switches string functions, f_gets(), f_putc(), f_puts() and
|
|
102
|
+
/ f_printf().
|
|
103
|
+
/
|
|
104
|
+
/ 0: Disable. FF_PRINT_LLI, FF_PRINT_FLOAT and FF_STRF_ENCODE have no effect.
|
|
105
|
+
/ 1: Enable without LF-CRLF conversion.
|
|
106
|
+
/ 2: Enable with LF-CRLF conversion.
|
|
107
|
+
/
|
|
108
|
+
/ FF_PRINT_LLI = 1 makes f_printf() support long long argument and FF_PRINT_FLOAT = 1/2
|
|
109
|
+
/ makes f_printf() support floating point argument. These features want C99 or later.
|
|
110
|
+
/ When FF_LFN_UNICODE >= 1 with LFN enabled, string functions convert the character
|
|
111
|
+
/ encoding in it. FF_STRF_ENCODE selects assumption of character encoding ON THE FILE
|
|
112
|
+
/ to be read/written via those functions.
|
|
113
|
+
/
|
|
114
|
+
/ 0: ANSI/OEM in current CP
|
|
115
|
+
/ 1: Unicode in UTF-16LE
|
|
116
|
+
/ 2: Unicode in UTF-16BE
|
|
117
|
+
/ 3: Unicode in UTF-8
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
/*---------------------------------------------------------------------------/
|
|
122
|
+
/ Locale and Namespace Configurations
|
|
123
|
+
/---------------------------------------------------------------------------*/
|
|
124
|
+
|
|
125
|
+
#define FF_CODE_PAGE CONFIG_FATFS_CODEPAGE
|
|
126
|
+
/* This option specifies the OEM code page to be used on the target system.
|
|
127
|
+
/ Incorrect code page setting can cause a file open failure.
|
|
128
|
+
/
|
|
129
|
+
/ 437 - U.S.
|
|
130
|
+
/ 720 - Arabic
|
|
131
|
+
/ 737 - Greek
|
|
132
|
+
/ 771 - KBL
|
|
133
|
+
/ 775 - Baltic
|
|
134
|
+
/ 850 - Latin 1
|
|
135
|
+
/ 852 - Latin 2
|
|
136
|
+
/ 855 - Cyrillic
|
|
137
|
+
/ 857 - Turkish
|
|
138
|
+
/ 860 - Portuguese
|
|
139
|
+
/ 861 - Icelandic
|
|
140
|
+
/ 862 - Hebrew
|
|
141
|
+
/ 863 - Canadian French
|
|
142
|
+
/ 864 - Arabic
|
|
143
|
+
/ 865 - Nordic
|
|
144
|
+
/ 866 - Russian
|
|
145
|
+
/ 869 - Greek 2
|
|
146
|
+
/ 932 - Japanese (DBCS)
|
|
147
|
+
/ 936 - Simplified Chinese (DBCS)
|
|
148
|
+
/ 949 - Korean (DBCS)
|
|
149
|
+
/ 950 - Traditional Chinese (DBCS)
|
|
150
|
+
/ 0 - Include all code pages above and configured by f_setcp()
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
#if defined(CONFIG_FATFS_LFN_STACK)
|
|
155
|
+
#define FF_USE_LFN 2
|
|
156
|
+
#elif defined(CONFIG_FATFS_LFN_HEAP)
|
|
157
|
+
#define FF_USE_LFN 3
|
|
158
|
+
#else /* CONFIG_FATFS_LFN_NONE */
|
|
159
|
+
#define FF_USE_LFN 0
|
|
160
|
+
#endif
|
|
161
|
+
|
|
162
|
+
#ifdef CONFIG_FATFS_MAX_LFN
|
|
163
|
+
#define FF_MAX_LFN CONFIG_FATFS_MAX_LFN
|
|
164
|
+
#endif
|
|
165
|
+
|
|
166
|
+
/* The FF_USE_LFN switches the support for LFN (long file name).
|
|
167
|
+
/
|
|
168
|
+
/ 0: Disable LFN. FF_MAX_LFN has no effect.
|
|
169
|
+
/ 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe.
|
|
170
|
+
/ 2: Enable LFN with dynamic working buffer on the STACK.
|
|
171
|
+
/ 3: Enable LFN with dynamic working buffer on the HEAP.
|
|
172
|
+
/
|
|
173
|
+
/ To enable the LFN, ffunicode.c needs to be added to the project. The LFN function
|
|
174
|
+
/ requiers certain internal working buffer occupies (FF_MAX_LFN + 1) * 2 bytes and
|
|
175
|
+
/ additional (FF_MAX_LFN + 44) / 15 * 32 bytes when exFAT is enabled.
|
|
176
|
+
/ The FF_MAX_LFN defines size of the working buffer in UTF-16 code unit and it can
|
|
177
|
+
/ be in range of 12 to 255. It is recommended to be set it 255 to fully support LFN
|
|
178
|
+
/ specification.
|
|
179
|
+
/ When use stack for the working buffer, take care on stack overflow. When use heap
|
|
180
|
+
/ memory for the working buffer, memory management functions, ff_memalloc() and
|
|
181
|
+
/ ff_memfree() exemplified in ffsystem.c, need to be added to the project. */
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
#ifdef CONFIG_FATFS_API_ENCODING_UTF_8
|
|
185
|
+
#define FF_LFN_UNICODE 2
|
|
186
|
+
#else /* CONFIG_FATFS_API_ENCODING_ANSI_OEM */
|
|
187
|
+
#define FF_LFN_UNICODE 0
|
|
188
|
+
#endif
|
|
189
|
+
/* This option switches the character encoding on the API when LFN is enabled.
|
|
190
|
+
/
|
|
191
|
+
/ 0: ANSI/OEM in current CP (TCHAR = char)
|
|
192
|
+
/ 1: Unicode in UTF-16 (TCHAR = WCHAR)
|
|
193
|
+
/ 2: Unicode in UTF-8 (TCHAR = char)
|
|
194
|
+
/ 3: Unicode in UTF-32 (TCHAR = DWORD)
|
|
195
|
+
/
|
|
196
|
+
/ Also behavior of string I/O functions will be affected by this option.
|
|
197
|
+
/ When LFN is not enabled, this option has no effect. */
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
#define FF_LFN_BUF 255
|
|
201
|
+
#define FF_SFN_BUF 12
|
|
202
|
+
/* This set of options defines size of file name members in the FILINFO structure
|
|
203
|
+
/ which is used to read out directory items. These values should be suffcient for
|
|
204
|
+
/ the file names to read. The maximum possible length of the read file name depends
|
|
205
|
+
/ on character encoding. When LFN is not enabled, these options have no effect. */
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
#define FF_FS_RPATH 0
|
|
209
|
+
/* This option configures support for relative path.
|
|
210
|
+
/
|
|
211
|
+
/ 0: Disable relative path and remove related functions.
|
|
212
|
+
/ 1: Enable relative path. f_chdir() and f_chdrive() are available.
|
|
213
|
+
/ 2: f_getcwd() function is available in addition to 1.
|
|
214
|
+
*/
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
/*---------------------------------------------------------------------------/
|
|
218
|
+
/ Drive/Volume Configurations
|
|
219
|
+
/---------------------------------------------------------------------------*/
|
|
220
|
+
|
|
221
|
+
#define FF_VOLUMES CONFIG_FATFS_VOLUME_COUNT
|
|
222
|
+
/* Number of volumes (logical drives) to be used. (1-10) */
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
#define FF_STR_VOLUME_ID 0
|
|
226
|
+
#define FF_VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3"
|
|
227
|
+
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
|
|
228
|
+
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
|
|
229
|
+
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
|
|
230
|
+
/ logical drives. Number of items must not be less than FF_VOLUMES. Valid
|
|
231
|
+
/ characters for the volume ID strings are A-Z, a-z and 0-9, however, they are
|
|
232
|
+
/ compared in case-insensitive. If FF_STR_VOLUME_ID >= 1 and FF_VOLUME_STRS is
|
|
233
|
+
/ not defined, a user defined volume string table is needed as:
|
|
234
|
+
/
|
|
235
|
+
/ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",...
|
|
236
|
+
*/
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
#define FF_MULTI_PARTITION 1
|
|
240
|
+
/* This option switches support for multiple volumes on the physical drive.
|
|
241
|
+
/ By default (0), each logical drive number is bound to the same physical drive
|
|
242
|
+
/ number and only an FAT volume found on the physical drive will be mounted.
|
|
243
|
+
/ When this function is enabled (1), each logical drive number can be bound to
|
|
244
|
+
/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk()
|
|
245
|
+
/ function will be available. */
|
|
246
|
+
|
|
247
|
+
/* SD card sector size */
|
|
248
|
+
#define FF_SS_SDCARD 512
|
|
249
|
+
/* wear_levelling library sector size */
|
|
250
|
+
#define FF_SS_WL CONFIG_WL_SECTOR_SIZE
|
|
251
|
+
|
|
252
|
+
#define FF_MIN_SS MIN(FF_SS_SDCARD, FF_SS_WL)
|
|
253
|
+
#define FF_MAX_SS MAX(FF_SS_SDCARD, FF_SS_WL)
|
|
254
|
+
/* This set of options configures the range of sector size to be supported. (512,
|
|
255
|
+
/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
|
|
256
|
+
/ harddisk, but a larger value may be required for on-board flash memory and some
|
|
257
|
+
/ type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured
|
|
258
|
+
/ for variable sector size mode and disk_ioctl() function needs to implement
|
|
259
|
+
/ GET_SECTOR_SIZE command. */
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
#define FF_LBA64 0
|
|
263
|
+
/* This option switches support for 64-bit LBA. (0:Disable or 1:Enable)
|
|
264
|
+
/ To enable the 64-bit LBA, also exFAT needs to be enabled. (FF_FS_EXFAT == 1) */
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
#define FF_MIN_GPT 0x10000000
|
|
268
|
+
/* Minimum number of sectors to switch GPT as partitioning format in f_mkfs and
|
|
269
|
+
/ f_fdisk function. 0x100000000 max. This option has no effect when FF_LBA64 == 0. */
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
#define FF_USE_TRIM 1
|
|
273
|
+
/* This option switches support for ATA-TRIM. (0:Disable or 1:Enable)
|
|
274
|
+
/ To enable Trim function, also CTRL_TRIM command should be implemented to the
|
|
275
|
+
/ disk_ioctl() function. */
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
/*---------------------------------------------------------------------------/
|
|
280
|
+
/ System Configurations
|
|
281
|
+
/---------------------------------------------------------------------------*/
|
|
282
|
+
|
|
283
|
+
#define FF_FS_TINY (!CONFIG_FATFS_PER_FILE_CACHE)
|
|
284
|
+
/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
|
|
285
|
+
/ At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes.
|
|
286
|
+
/ Instead of private sector buffer eliminated from the file object, common sector
|
|
287
|
+
/ buffer in the filesystem object (FATFS) is used for the file data transfer. */
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
#define FF_FS_EXFAT 1
|
|
291
|
+
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
|
|
292
|
+
/ To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1)
|
|
293
|
+
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
#define FF_FS_NORTC 0
|
|
297
|
+
#define FF_NORTC_MON 1
|
|
298
|
+
#define FF_NORTC_MDAY 1
|
|
299
|
+
#define FF_NORTC_YEAR 2022
|
|
300
|
+
/* The option FF_FS_NORTC switches timestamp feature. If the system does not have
|
|
301
|
+
/ an RTC or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable the
|
|
302
|
+
/ timestamp feature. Every object modified by FatFs will have a fixed timestamp
|
|
303
|
+
/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time.
|
|
304
|
+
/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be
|
|
305
|
+
/ added to the project to read current time form real-time clock. FF_NORTC_MON,
|
|
306
|
+
/ FF_NORTC_MDAY and FF_NORTC_YEAR have no effect.
|
|
307
|
+
/ These options have no effect in read-only configuration (FF_FS_READONLY = 1). */
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
#define FF_FS_NOFSINFO (CONFIG_FATFS_DONT_TRUST_FREE_CLUSTER_CNT << 0 | CONFIG_FATFS_DONT_TRUST_LAST_ALLOC << 1)
|
|
311
|
+
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
|
|
312
|
+
/ option, and f_getfree() function at the first time after volume mount will force
|
|
313
|
+
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
|
|
314
|
+
/
|
|
315
|
+
/ bit0=0: Use free cluster count in the FSINFO if available.
|
|
316
|
+
/ bit0=1: Do not trust free cluster count in the FSINFO.
|
|
317
|
+
/ bit1=0: Use last allocated cluster number in the FSINFO if available.
|
|
318
|
+
/ bit1=1: Do not trust last allocated cluster number in the FSINFO.
|
|
319
|
+
*/
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
#define FF_FS_LOCK CONFIG_FATFS_FS_LOCK
|
|
323
|
+
/* The option FF_FS_LOCK switches file lock function to control duplicated file open
|
|
324
|
+
/ and illegal operation to open objects. This option must be 0 when FF_FS_READONLY
|
|
325
|
+
/ is 1.
|
|
326
|
+
/
|
|
327
|
+
/ 0: Disable file lock function. To avoid volume corruption, application program
|
|
328
|
+
/ should avoid illegal open, remove and rename to the open objects.
|
|
329
|
+
/ >0: Enable file lock function. The value defines how many files/sub-directories
|
|
330
|
+
/ can be opened simultaneously under file lock control. Note that the file
|
|
331
|
+
/ lock control is independent of re-entrancy. */
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
#define FF_FS_REENTRANT 1
|
|
335
|
+
#define FF_FS_TIMEOUT (CONFIG_FATFS_TIMEOUT_MS / portTICK_PERIOD_MS)
|
|
336
|
+
/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
|
|
337
|
+
/ module itself. Note that regardless of this option, file access to different
|
|
338
|
+
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
|
|
339
|
+
/ and f_fdisk() function, are always not re-entrant. Only file/directory access
|
|
340
|
+
/ to the same volume is under control of this featuer.
|
|
341
|
+
/
|
|
342
|
+
/ 0: Disable re-entrancy. FF_FS_TIMEOUT have no effect.
|
|
343
|
+
/ 1: Enable re-entrancy. Also user provided synchronization handlers,
|
|
344
|
+
/ ff_mutex_create(), ff_mutex_delete(), ff_mutex_take() and ff_mutex_give()
|
|
345
|
+
/ function, must be added to the project. Samples are available in ffsystem.c.
|
|
346
|
+
/
|
|
347
|
+
/ The FF_FS_TIMEOUT defines timeout period in unit of O/S time tick.
|
|
348
|
+
*/
|
|
349
|
+
|
|
350
|
+
#define FF_USE_DYN_BUFFER CONFIG_FATFS_USE_DYN_BUFFERS
|
|
351
|
+
/* The option FF_USE_DYN_BUFFER controls source of size used for buffers in the FS and FIL objects.
|
|
352
|
+
/
|
|
353
|
+
/ 0: Disable dynamic buffer size and use static size buffers defined by FF_MAX_SS.
|
|
354
|
+
/ 1: Enable dynamic buffer size and use ff_memmalloc() to allocate buffers.
|
|
355
|
+
*/
|
|
356
|
+
|
|
357
|
+
#include <sys/param.h>
|
|
358
|
+
#include "freertos/FreeRTOS.h"
|
|
359
|
+
#include "freertos/semphr.h"
|
|
360
|
+
|
|
361
|
+
/* Some memory allocation functions are declared here in addition to ff.h, so that
|
|
362
|
+
they can be used also by external code when LFN feature is disabled.
|
|
363
|
+
*/
|
|
364
|
+
void* ff_memalloc (unsigned msize);
|
|
365
|
+
void ff_memfree(void*);
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
/*--- End of configuration options ---*/
|
|
369
|
+
|
|
370
|
+
/* Redefine names of disk IO functions to prevent name collisions */
|
|
371
|
+
#define disk_initialize ff_disk_initialize
|
|
372
|
+
#define disk_status ff_disk_status
|
|
373
|
+
#define disk_read ff_disk_read
|
|
374
|
+
#define disk_write ff_disk_write
|
|
375
|
+
#define disk_ioctl ff_disk_ioctl
|
|
376
|
+
|
|
377
|
+
#endif /* _FFCONF_DEFINED */
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include "driver/gpio.h"
|
|
3
|
+
#include "driver/spi_master.h"
|
|
4
|
+
|
|
5
|
+
// Waveshare factory BSP, ESP-IDF-5.5.1/01_factory/components/esp_bsp.
|
|
6
|
+
namespace gea::platform::board {
|
|
7
|
+
struct I2cBusConfig { gpio_num_t sda, scl; };
|
|
8
|
+
struct St7789DisplayConfig { spi_host_device_t spiHost; gpio_num_t mosi, sclk, cs, dc, reset, backlight; };
|
|
9
|
+
struct TouchConfig { gpio_num_t reset, interrupt; bool swapXy = false, mirrorX = false, mirrorY = false; };
|
|
10
|
+
struct ButtonConfig { gpio_num_t key1, key2; };
|
|
11
|
+
struct Es8311AudioConfig {
|
|
12
|
+
int i2sPort;
|
|
13
|
+
gpio_num_t mclk, bclk, ws, dout, din, powerAmplifier;
|
|
14
|
+
int es7210Address;
|
|
15
|
+
};
|
|
16
|
+
struct SdMmcStorageConfig { gpio_num_t clk, cmd, d0; };
|
|
17
|
+
struct PowerConfig { gpio_num_t enable, charging, adc; };
|
|
18
|
+
class WaveshareTouchLcd154 {
|
|
19
|
+
public:
|
|
20
|
+
static constexpr I2cBusConfig i2c{GPIO_NUM_42, GPIO_NUM_41};
|
|
21
|
+
static constexpr St7789DisplayConfig display{SPI2_HOST, GPIO_NUM_39, GPIO_NUM_38,
|
|
22
|
+
GPIO_NUM_21, GPIO_NUM_45, GPIO_NUM_40, GPIO_NUM_46};
|
|
23
|
+
static constexpr TouchConfig touch{GPIO_NUM_47, GPIO_NUM_48};
|
|
24
|
+
static constexpr ButtonConfig buttons{GPIO_NUM_0, GPIO_NUM_4};
|
|
25
|
+
static constexpr Es8311AudioConfig audio{0, GPIO_NUM_8, GPIO_NUM_9, GPIO_NUM_10,
|
|
26
|
+
GPIO_NUM_12, GPIO_NUM_11, GPIO_NUM_7, 0x40};
|
|
27
|
+
static constexpr SdMmcStorageConfig storage{GPIO_NUM_16, GPIO_NUM_15, GPIO_NUM_17};
|
|
28
|
+
static constexpr PowerConfig power{GPIO_NUM_2, GPIO_NUM_3, GPIO_NUM_1};
|
|
29
|
+
};
|
|
30
|
+
using Board = WaveshareTouchLcd154;
|
|
31
|
+
inline constexpr auto i2c = Board::i2c;
|
|
32
|
+
inline constexpr auto display = Board::display;
|
|
33
|
+
inline constexpr auto touch = Board::touch;
|
|
34
|
+
inline constexpr auto buttons = Board::buttons;
|
|
35
|
+
inline constexpr auto audio = Board::audio;
|
|
36
|
+
inline constexpr auto power = Board::power;
|
|
37
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#include "power.h"
|
|
2
|
+
#include "board.h"
|
|
3
|
+
#include <algorithm>
|
|
4
|
+
#include <mutex>
|
|
5
|
+
#include "driver/gpio.h"
|
|
6
|
+
#include "esp_adc/adc_oneshot.h"
|
|
7
|
+
#include "esp_adc/adc_cali.h"
|
|
8
|
+
#include "esp_adc/adc_cali_scheme.h"
|
|
9
|
+
#include "esp_log.h"
|
|
10
|
+
|
|
11
|
+
namespace gea::platform::power {
|
|
12
|
+
namespace {
|
|
13
|
+
std::mutex mutex;
|
|
14
|
+
adc_oneshot_unit_handle_t adc = nullptr;
|
|
15
|
+
adc_cali_handle_t calibration = nullptr;
|
|
16
|
+
bool ready = false;
|
|
17
|
+
}
|
|
18
|
+
bool Power::init() {
|
|
19
|
+
std::lock_guard<std::mutex> lock(mutex);
|
|
20
|
+
if (ready) return true;
|
|
21
|
+
// Hold the battery soft latch before releasing the physical PWR button.
|
|
22
|
+
gpio_config_t output{};
|
|
23
|
+
output.mode = GPIO_MODE_OUTPUT;
|
|
24
|
+
output.pin_bit_mask = 1ULL << board::power.enable;
|
|
25
|
+
if (gpio_config(&output) != ESP_OK || gpio_set_level(board::power.enable, 1) != ESP_OK) return false;
|
|
26
|
+
gpio_config_t input{};
|
|
27
|
+
input.mode = GPIO_MODE_INPUT;
|
|
28
|
+
input.pin_bit_mask = 1ULL << board::power.charging;
|
|
29
|
+
input.pull_up_en = GPIO_PULLUP_ENABLE;
|
|
30
|
+
if (gpio_config(&input) != ESP_OK) return false;
|
|
31
|
+
adc_oneshot_unit_init_cfg_t unit{};
|
|
32
|
+
unit.unit_id = ADC_UNIT_1;
|
|
33
|
+
if (!adc && adc_oneshot_new_unit(&unit, &adc) != ESP_OK) return false;
|
|
34
|
+
adc_oneshot_chan_cfg_t channel{};
|
|
35
|
+
channel.atten = ADC_ATTEN_DB_12;
|
|
36
|
+
channel.bitwidth = ADC_BITWIDTH_DEFAULT;
|
|
37
|
+
if (adc_oneshot_config_channel(adc, ADC_CHANNEL_0, &channel) != ESP_OK) return false;
|
|
38
|
+
adc_cali_curve_fitting_config_t cal{};
|
|
39
|
+
cal.unit_id = ADC_UNIT_1;
|
|
40
|
+
cal.chan = ADC_CHANNEL_0;
|
|
41
|
+
cal.atten = ADC_ATTEN_DB_12;
|
|
42
|
+
cal.bitwidth = ADC_BITWIDTH_DEFAULT;
|
|
43
|
+
if (adc_cali_create_scheme_curve_fitting(&cal, &calibration) != ESP_OK) {
|
|
44
|
+
calibration = nullptr;
|
|
45
|
+
ESP_LOGW("lcd154_power", "ADC calibration unavailable; battery percentage unknown");
|
|
46
|
+
}
|
|
47
|
+
ready = true;
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
int Power::batteryPercent() {
|
|
51
|
+
if (!init()) return -1;
|
|
52
|
+
std::lock_guard<std::mutex> lock(mutex);
|
|
53
|
+
if (!calibration) return -1;
|
|
54
|
+
int total = 0;
|
|
55
|
+
for (int i = 0; i < 8; ++i) {
|
|
56
|
+
int raw = 0;
|
|
57
|
+
if (adc_oneshot_read(adc, ADC_CHANNEL_0, &raw) != ESP_OK) return -1;
|
|
58
|
+
total += raw;
|
|
59
|
+
}
|
|
60
|
+
int mv = 0;
|
|
61
|
+
if (adc_cali_raw_to_voltage(calibration, total / 8, &mv) != ESP_OK) return -1;
|
|
62
|
+
// Vendor divider: Vbat = ADC voltage * 3. Percentage is a voltage estimate.
|
|
63
|
+
mv *= 3;
|
|
64
|
+
return std::clamp((mv - 3300) * 100 / 900, 0, 100);
|
|
65
|
+
}
|
|
66
|
+
bool Power::charging() {
|
|
67
|
+
return init() && gpio_get_level(board::power.charging) == 0;
|
|
68
|
+
}
|
|
69
|
+
}
|