14
14
#include "esp_lcd_panel_io.h"
15
15
#include "esp_lcd_panel_vendor.h"
16
16
#include "esp_lcd_panel_ops.h"
17
- #include "esp_vfs_fat.h"
18
17
19
- #include "iot_button.h"
18
+ // #include "iot_button.h"
20
19
#include "bsp/esp-box-3.h"
21
20
#include "bsp/display.h"
22
21
#include "bsp/touch.h"
29
28
static const char * TAG = "ESP-BOX-3" ;
30
29
31
30
/** @cond */
32
- _Static_assert (CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS > 0 , "Touch buttons must be supported for this BSP" );
31
+ // _Static_assert(CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS > 0, "Touch buttons must be supported for this BSP");
33
32
/** @endcond */
34
33
35
34
static const ili9341_lcd_init_cmd_t vendor_specific_init [] = {
@@ -55,33 +54,32 @@ static const ili9341_lcd_init_cmd_t vendor_specific_init[] = {
55
54
static esp_lcd_touch_handle_t tp ; // LCD touch handle
56
55
static esp_lcd_panel_handle_t panel_handle = NULL ;
57
56
58
- sdmmc_card_t * bsp_sdcard = NULL ; // Global SD card handler
59
57
static bool i2c_initialized = false;
60
58
61
- // This is just a wrapper to get function signature for espressif/button API callback
62
- static uint8_t bsp_get_main_button (void * param );
63
- static esp_err_t bsp_init_main_button (void * param );
64
-
65
- static const button_config_t bsp_button_config [BSP_BUTTON_NUM ] = {
66
- {
67
- .type = BUTTON_TYPE_GPIO ,
68
- .gpio_button_config .gpio_num = BSP_BUTTON_CONFIG_IO ,
69
- .gpio_button_config .active_level = 0 ,
70
- },
71
- {
72
- .type = BUTTON_TYPE_GPIO ,
73
- .gpio_button_config .gpio_num = BSP_BUTTON_MUTE_IO ,
74
- .gpio_button_config .active_level = 0 ,
75
- },
76
- {
77
- .type = BUTTON_TYPE_CUSTOM ,
78
- .custom_button_config .button_custom_init = bsp_init_main_button ,
79
- .custom_button_config .button_custom_get_key_value = bsp_get_main_button ,
80
- .custom_button_config .button_custom_deinit = NULL ,
81
- .custom_button_config .active_level = 1 ,
82
- .custom_button_config .priv = (void * ) BSP_BUTTON_MAIN ,
83
- }
84
- };
59
+ // // This is just a wrapper to get function signature for espressif/button API callback
60
+ // static uint8_t bsp_get_main_button(void *param);
61
+ // static esp_err_t bsp_init_main_button(void *param);
62
+
63
+ // static const button_config_t bsp_button_config[BSP_BUTTON_NUM] = {
64
+ // {
65
+ // .type = BUTTON_TYPE_GPIO,
66
+ // .gpio_button_config.gpio_num = BSP_BUTTON_CONFIG_IO,
67
+ // .gpio_button_config.active_level = 0,
68
+ // },
69
+ // {
70
+ // .type = BUTTON_TYPE_GPIO,
71
+ // .gpio_button_config.gpio_num = BSP_BUTTON_MUTE_IO,
72
+ // .gpio_button_config.active_level = 0,
73
+ // },
74
+ // {
75
+ // .type = BUTTON_TYPE_CUSTOM,
76
+ // .custom_button_config.button_custom_init = bsp_init_main_button,
77
+ // .custom_button_config.button_custom_get_key_value = bsp_get_main_button,
78
+ // .custom_button_config.button_custom_deinit = NULL,
79
+ // .custom_button_config.active_level = 1,
80
+ // .custom_button_config.priv = (void *) BSP_BUTTON_MAIN,
81
+ // }
82
+ // };
85
83
86
84
esp_err_t bsp_i2c_init (void )
87
85
{
@@ -160,45 +158,6 @@ esp_err_t bsp_spiffs_unmount(void)
160
158
return esp_vfs_spiffs_unregister (CONFIG_BSP_SPIFFS_PARTITION_LABEL );
161
159
}
162
160
163
- esp_err_t bsp_sdcard_mount (void )
164
- {
165
- gpio_config_t power_gpio_config = {
166
- .mode = GPIO_MODE_OUTPUT ,
167
- .pin_bit_mask = 1ULL << BSP_SD_POWER
168
- };
169
- ESP_ERROR_CHECK (gpio_config (& power_gpio_config ));
170
-
171
- /* SD card power on first */
172
- ESP_ERROR_CHECK (gpio_set_level (BSP_SD_POWER , 0 ));
173
-
174
- const esp_vfs_fat_sdmmc_mount_config_t mount_config = {
175
- #ifdef CONFIG_BSP_SD_FORMAT_ON_MOUNT_FAIL
176
- .format_if_mount_failed = true,
177
- #else
178
- .format_if_mount_failed = false,
179
- #endif
180
- .max_files = 5 ,
181
- .allocation_unit_size = 16 * 1024
182
- };
183
-
184
- sdmmc_host_t host = SDMMC_HOST_DEFAULT ();
185
- sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT ();
186
- slot_config .width = 4 ;
187
- slot_config .cmd = BSP_SD_CMD ;
188
- slot_config .clk = BSP_SD_CLK ;
189
- slot_config .d0 = BSP_SD_D0 ;
190
- slot_config .d1 = BSP_SD_D1 ;
191
- slot_config .d2 = BSP_SD_D2 ;
192
- slot_config .d3 = BSP_SD_D3 ;
193
-
194
- return esp_vfs_fat_sdmmc_mount (BSP_SD_MOUNT_POINT , & host , & slot_config , & mount_config , & bsp_sdcard );
195
- }
196
-
197
- esp_err_t bsp_sdcard_unmount (void )
198
- {
199
- return esp_vfs_fat_sdcard_unmount (BSP_SD_MOUNT_POINT , bsp_sdcard );
200
- }
201
-
202
161
esp_codec_dev_handle_t bsp_audio_codec_speaker_init (void )
203
162
{
204
163
const audio_codec_data_if_t * i2s_data_if = bsp_audio_get_codec_itf ();
@@ -495,47 +454,47 @@ esp_err_t bsp_touch_new(const bsp_touch_config_t *config, esp_lcd_touch_handle_t
495
454
return ESP_OK ;
496
455
}
497
456
498
- static uint8_t bsp_get_main_button (void * param )
499
- {
500
- assert (tp );
501
- #if (CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS > 0 )
502
- uint8_t home_btn_val = 0x00 ;
503
- esp_lcd_touch_get_button_state (tp , 0 , & home_btn_val );
504
- return home_btn_val ? true : false;
505
- #else
506
- ESP_LOGE (TAG , "Button main is inaccessible" );
507
- return false;
508
- #endif
509
- }
510
-
511
- static esp_err_t bsp_init_main_button (void * param )
512
- {
513
- if (tp == NULL ) {
514
- BSP_ERROR_CHECK_RETURN_ERR (bsp_touch_new (NULL , & tp ));
515
- }
516
- return ESP_OK ;
517
- }
518
-
519
- esp_err_t bsp_iot_button_create (button_handle_t btn_array [], int * btn_cnt , int btn_array_size )
520
- {
521
- esp_err_t ret = ESP_OK ;
522
- if ((btn_array_size < BSP_BUTTON_NUM ) ||
523
- (btn_array == NULL )) {
524
- return ESP_ERR_INVALID_ARG ;
525
- }
526
-
527
- if (btn_cnt ) {
528
- * btn_cnt = 0 ;
529
- }
530
- for (int i = 0 ; i < BSP_BUTTON_NUM ; i ++ ) {
531
- btn_array [i ] = iot_button_create (& bsp_button_config [i ]);
532
- if (btn_array [i ] == NULL ) {
533
- ret = ESP_FAIL ;
534
- break ;
535
- }
536
- if (btn_cnt ) {
537
- (* btn_cnt )++ ;
538
- }
539
- }
540
- return ret ;
541
- }
457
+ // static uint8_t bsp_get_main_button(void *param)
458
+ // {
459
+ // assert(tp);
460
+ // #if (CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS > 0)
461
+ // uint8_t home_btn_val = 0x00;
462
+ // esp_lcd_touch_get_button_state(tp, 0, &home_btn_val);
463
+ // return home_btn_val ? true : false;
464
+ // #else
465
+ // ESP_LOGE(TAG, "Button main is inaccessible");
466
+ // return false;
467
+ // #endif
468
+ // }
469
+
470
+ // static esp_err_t bsp_init_main_button(void *param)
471
+ // {
472
+ // if (tp == NULL) {
473
+ // BSP_ERROR_CHECK_RETURN_ERR(bsp_touch_new(NULL, &tp));
474
+ // }
475
+ // return ESP_OK;
476
+ // }
477
+
478
+ // esp_err_t bsp_iot_button_create(button_handle_t btn_array[], int *btn_cnt, int btn_array_size)
479
+ // {
480
+ // esp_err_t ret = ESP_OK;
481
+ // if ((btn_array_size < BSP_BUTTON_NUM) ||
482
+ // (btn_array == NULL)) {
483
+ // return ESP_ERR_INVALID_ARG;
484
+ // }
485
+
486
+ // if (btn_cnt) {
487
+ // *btn_cnt = 0;
488
+ // }
489
+ // for (int i = 0; i < BSP_BUTTON_NUM; i++) {
490
+ // btn_array[i] = iot_button_create(&bsp_button_config[i]);
491
+ // if (btn_array[i] == NULL) {
492
+ // ret = ESP_FAIL;
493
+ // break;
494
+ // }
495
+ // if (btn_cnt) {
496
+ // (*btn_cnt)++;
497
+ // }
498
+ // }
499
+ // return ret;
500
+ // }
0 commit comments