Skip to content

Commit 928ffc3

Browse files
committed
Cleanup
1 parent 34a7827 commit 928ffc3

File tree

13 files changed

+93
-57
lines changed

13 files changed

+93
-57
lines changed

bsp/input.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ typedef enum _bsp_input_action_type {
199199
BSP_INPUT_ACTION_TYPE_AUDIO_JACK,
200200
BSP_INPUT_ACTION_TYPE_POWER_BUTTON,
201201
BSP_INPUT_ACTION_TYPE_FPGA_CDONE,
202+
BSP_INPUT_ACTION_TYPE_PMIC_FAULT,
202203
} bsp_input_action_type_t;
203204

204205
// Modifiers

idf_component.yml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
targets:
2-
- esp32
3-
- esp32p4
4-
- esp32c6
5-
- esp32c3
2+
- esp32
3+
- esp32p4
4+
- esp32c6
5+
- esp32c3
66
dependencies:
7-
cmake_utilities: 0.*
8-
idf: '>=5.3'
9-
espressif/esp_lcd_ili9341:
10-
version: ^2.0.0
11-
nicolaielectronics/ssd1619:
12-
version: ^0.0.1
13-
espressif/led_strip:
14-
version: ^3.0.1
15-
nicolaielectronics/mipi_dsi_abstraction:
16-
version: "^0.1.0"
17-
rules:
18-
- if: "target == esp32p4"
19-
nicolaielectronics/tanmatsu_coprocessor:
20-
version: "^0.5.0"
21-
rules:
22-
- if: "target == esp32p4"
23-
nicolaielectronics/es8156:
24-
version: "^0.0.1"
25-
rules:
26-
- if: "target == esp32p4"
27-
badgeteam/mch2022-rp2040:
28-
version: "^0.0.2"
29-
rules:
30-
- if: "target == esp32"
7+
cmake_utilities: 0.*
8+
idf: ">=5.3"
9+
espressif/esp_lcd_ili9341:
10+
version: "^2.0.0"
11+
nicolaielectronics/ssd1619:
12+
version: "=>0.0.1"
13+
espressif/led_strip:
14+
version: "^3.0.1"
15+
nicolaielectronics/mipi_dsi_abstraction:
16+
version: "^0.1.0"
17+
rules:
18+
- if: "target == esp32p4"
19+
nicolaielectronics/tanmatsu_coprocessor:
20+
version: "=>0.5.0"
21+
rules:
22+
- if: "target == esp32p4"
23+
nicolaielectronics/es8156:
24+
version: ">=0.0.2"
25+
rules:
26+
- if: "target == esp32p4"
27+
badgeteam/mch2022-rp2040:
28+
version: "=>0.0.2"
29+
rules:
30+
- if: "target == esp32"
3131
description: Badge BSP
3232
license: MIT
3333
issues: https://github.com/badgeteam/esp32-component-badge-bsp/issues

targets/bornhack-2024-pov/badge_bsp_i2c.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ esp_err_t bsp_i2c_primary_bus_get_semaphore(SemaphoreHandle_t* semaphore) {
5858
esp_err_t bsp_i2c_primary_bus_claim(void) {
5959
if (i2c_concurrency_semaphore != NULL) {
6060
xSemaphoreTake(i2c_concurrency_semaphore, portMAX_DELAY);
61-
} else {
62-
ESP_LOGW(TAG, "No concurrency semaphore");
6361
}
6462
return ESP_OK;
6563
}

targets/bornhack-2024-pov/badge_bsp_led.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
static led_strip_handle_t led_strip = NULL;
1212

1313
esp_err_t bsp_led_initialize(void) {
14-
ESP_LOGI("led", "test");
15-
1614
led_strip_config_t strip_config = {
1715
.strip_gpio_num = BSP_LED_DATA_PIN,
1816
.max_leds = BSP_LED_NUM,

targets/esp32-p4-function-ev-board/badge_bsp_display.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ esp_err_t bsp_display_initialize(void) {
8080
esp_err_t bsp_display_get_parameters(size_t* h_res, size_t* v_res, lcd_color_rgb_pixel_format_t* color_fmt,
8181
lcd_rgb_data_endian_t* data_endian) {
8282
if (!bsp_display_initialized) {
83-
ESP_LOGE(TAG, "Display not initialized");
8483
return ESP_FAIL;
8584
}
8685
ek79007_get_parameters(h_res, v_res, color_fmt);
@@ -92,7 +91,6 @@ esp_err_t bsp_display_get_parameters(size_t* h_res, size_t* v_res, lcd_color_rgb
9291

9392
esp_err_t bsp_display_get_panel(esp_lcd_panel_handle_t* panel) {
9493
if (!bsp_display_initialized) {
95-
ESP_LOGE(TAG, "Display not initialized");
9694
return ESP_FAIL;
9795
}
9896
*panel = ek79007_get_panel();
@@ -101,7 +99,6 @@ esp_err_t bsp_display_get_panel(esp_lcd_panel_handle_t* panel) {
10199

102100
esp_err_t bsp_display_get_panel_io(esp_lcd_panel_io_handle_t* panel_io) {
103101
if (!bsp_display_initialized) {
104-
ESP_LOGE(TAG, "Display not initialised");
105102
return ESP_FAIL;
106103
}
107104

targets/kami/badge_bsp_i2c.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ esp_err_t bsp_i2c_primary_bus_get_semaphore(SemaphoreHandle_t* semaphore) {
5858
esp_err_t bsp_i2c_primary_bus_claim(void) {
5959
if (i2c_concurrency_semaphore != NULL) {
6060
xSemaphoreTake(i2c_concurrency_semaphore, portMAX_DELAY);
61-
} else {
62-
ESP_LOGW(TAG, "No concurrency semaphore");
6361
}
6462
return ESP_OK;
6563
}

targets/kami/badge_bsp_input.c

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
// Board support package API: Hackerhotel 2024 implementation
21
// SPDX-FileCopyrightText: 2025 Nicolai Electronics
32
// SPDX-License-Identifier: MIT
43

54
#include <inttypes.h>
65
#include <stdint.h>
76
#include <string.h>
7+
#include "bsp/i2c.h"
88
#include "bsp/input.h"
99
#include "driver/gpio.h"
1010
#include "esp_check.h"
@@ -14,16 +14,68 @@
1414
#include "freertos/projdefs.h"
1515
#include "freertos/queue.h"
1616
#include "hal/gpio_types.h"
17+
#include "kami_hardware.h"
18+
#include "mpr121.h"
1719

1820
static char const* TAG = "BSP: INPUT";
1921

20-
static QueueHandle_t event_queue = NULL;
22+
static QueueHandle_t event_queue = NULL;
23+
static mpr121_handle_t mpr121 = NULL;
2124

2225
esp_err_t bsp_input_initialize(void) {
2326
if (event_queue == NULL) {
2427
event_queue = xQueueCreate(32, sizeof(bsp_input_event_t));
2528
ESP_RETURN_ON_FALSE(event_queue, ESP_ERR_NO_MEM, TAG, "Failed to create input event queue");
2629
}
30+
31+
static i2c_master_bus_handle_t i2c_bus_handle_internal = NULL;
32+
static SemaphoreHandle_t i2c_concurrency_semaphore = NULL;
33+
ESP_RETURN_ON_ERROR(bsp_i2c_primary_bus_get_handle(&i2c_bus_handle_internal), TAG, "Failed to get I2C bus handle");
34+
ESP_RETURN_ON_ERROR(bsp_i2c_primary_bus_get_semaphore(&i2c_concurrency_semaphore), TAG,
35+
"Failed to get I2C bus semaphore");
36+
37+
mpr121_config_t mpr121_config = {
38+
.int_io_num = BSP_MPR121_INT_PIN,
39+
.i2c_bus = i2c_bus_handle_internal,
40+
.i2c_address = BSP_MPR121_I2C_ADDRESS,
41+
.concurrency_semaphore = i2c_concurrency_semaphore,
42+
.touch_callback = NULL, // TODO
43+
.input_callback = NULL, // TODO
44+
.i2c_timeout = 1000,
45+
};
46+
47+
ESP_RETURN_ON_ERROR(mpr121_initialize(&mpr121_config, &mpr121), TAG, "Failed to initialize MPR121");
48+
49+
/*mpr121_touch_set_baseline(mpr121_handle_t handle, uint8_t pin, uint8_t baseline);
50+
mpr121_touch_set_touch_threshold(mpr121_handle_t handle, uint8_t pin, uint8_t touch_threshold);
51+
mpr121_touch_set_release_threshold(mpr121_handle_t handle, uint8_t pin, uint8_t release_threshold);*/
52+
53+
mpr121_gpio_set_mode(mpr121, BSP_MPR121_PIN_INPUT_CHRG, MPR121_INPUT_PULL_UP);
54+
mpr121_gpio_set_mode(mpr121, BSP_MPR121_PIN_INPUT_SD_DET, MPR121_INPUT_PULL_UP);
55+
56+
mpr121_touch_configure(mpr121, 10, 0, true); // Use first 10 electrodes for touch
57+
58+
/*while (1) {
59+
for (uint8_t pin = 0; pin < 10; pin++) {
60+
uint16_t value;
61+
if (mpr121_touch_get_analog(mpr121, pin, &value) == ESP_OK) {
62+
printf("%04x ", value);
63+
} else {
64+
ESP_LOGE(TAG, "Failed to read touch state from MPR121");
65+
}
66+
}
67+
for (uint8_t pin = 10; pin < 12; pin++) {
68+
bool value;
69+
if (mpr121_gpio_get_level(mpr121, pin, &value) == ESP_OK) {
70+
printf("%s ", value ? "H" : "L");
71+
} else {
72+
ESP_LOGE(TAG, "Failed to read input state from MPR121");
73+
}
74+
}
75+
printf("\r\n");
76+
vTaskDelay(100);
77+
}*/
78+
2779
return ESP_OK;
2880
}
2981

targets/mch2022/badge_bsp_display.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ esp_err_t bsp_display_get_parameters(size_t* h_res, size_t* v_res, lcd_color_rgb
155155

156156
esp_err_t bsp_display_get_panel(esp_lcd_panel_handle_t* panel) {
157157
if (!panel_handle) {
158-
ESP_LOGE(TAG, "Display not initialised");
159158
return ESP_FAIL;
160159
}
161160

@@ -165,7 +164,6 @@ esp_err_t bsp_display_get_panel(esp_lcd_panel_handle_t* panel) {
165164

166165
esp_err_t bsp_display_get_panel_io(esp_lcd_panel_io_handle_t* panel_io) {
167166
if (!panel_handle) {
168-
ESP_LOGE(TAG, "Display IO not initialised");
169167
return ESP_FAIL;
170168
}
171169

targets/tanmatsu/badge_bsp_audio.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ static esp_err_t initialize_i2s(uint32_t rate) {
2424

2525
esp_err_t res = i2s_new_channel(&chan_cfg, &i2s_handle, NULL);
2626
if (res != ESP_OK) {
27-
ESP_LOGE(TAG, "Initializing I2S channel failed");
2827
return res;
2928
}
3029

@@ -49,13 +48,11 @@ static esp_err_t initialize_i2s(uint32_t rate) {
4948

5049
res = i2s_channel_init_std_mode(i2s_handle, &i2s_config);
5150
if (res != ESP_OK) {
52-
ESP_LOGE(TAG, "Configuring I2S channel failed");
5351
return res;
5452
}
5553

5654
res = i2s_channel_enable(i2s_handle);
5755
if (res != ESP_OK) {
58-
ESP_LOGE(TAG, "Enabling I2S channel failed");
5956
return res;
6057
}
6158

targets/tanmatsu/badge_bsp_device.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ esp_err_t bsp_tanmatsu_coprocessor_get_handle(tanmatsu_coprocessor_handle_t* han
4646
}
4747

4848
esp_err_t bsp_device_initialize_custom(void) {
49-
printf("Tanmatsu coprocessor!\r\n");
5049
initialized_without_coprocessor = true;
5150

5251
BSP_RETURN_ON_FAILURE(bsp_i2c_primary_bus_get_handle(&i2c_bus_handle_internal));

0 commit comments

Comments
 (0)