Skip to content

Commit 3f94d50

Browse files
committed
feat(button): support factory mode
1 parent c880bff commit 3f94d50

34 files changed

+1691
-1739
lines changed

.gitlab/ci/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ build_components_button_test_apps:
936936
extends:
937937
- .build_examples_template
938938
- .rules:build:components_button_test_apps
939-
- .build_idf_active_release_version
939+
- .build_idf_version_greater_equal_v5_0
940940
variables:
941941
EXAMPLE_DIR: components/button/test_apps
942942

.gitlab/ci/rules.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1364,8 +1364,6 @@
13641364
- <<: *if-trigger-job
13651365
- <<: *if-dev-push
13661366
changes: *patterns-build_system
1367-
- <<: *if-dev-push
1368-
changes: *patterns-components_button
13691367
- <<: *if-dev-push
13701368
changes: *patterns-components_knob
13711369
- <<: *if-dev-push

.gitlab/ci/target_test.yml

-3
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,6 @@ components_test_button:
255255
optional: false
256256
parallel:
257257
matrix:
258-
- IDF_TARGET: esp32s3
259-
IDF_VERSION: "4.4"
260-
ENV_TAG: "button"
261258
- IDF_TARGET: esp32s3
262259
IDF_VERSION: "5.0"
263260
ENV_TAG: "button"

components/button/CHANGELOG.md

+20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# ChangeLog
22

3+
## v4.0.0 - 2025-1-9
4+
5+
### Enhancements:
6+
7+
* Use the factory pattern to reduce the build size.
8+
* Change the state machine to use enumerated values.
9+
10+
### Break change:
11+
12+
* Standardize the return value of the iot_button interface to esp_err_t.
13+
* Remove support for the old ADC driver.
14+
* Modify the callback registration interface to:
15+
```c
16+
esp_err_t iot_button_register_cb(button_handle_t btn_handle, button_event_t event, button_event_args_t *event_args, button_cb_t cb, void *usr_data);
17+
```
18+
* Modify the callback unregistration interface to:
19+
```c
20+
esp_err_t iot_button_unregister_cb(button_handle_t btn_handle, button_event_t event, button_event_args_t *event_args);
21+
```
22+
323
## v3.5.0 - 2024-12-27
424

525
### Enhancements:

components/button/CMakeLists.txt

+1-15
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,12 @@ if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0")
77
if(CONFIG_SOC_ADC_SUPPORTED)
88
list(APPEND SRC_FILES "button_adc.c")
99
endif()
10-
else()
11-
list(APPEND REQ esp_adc_cal)
12-
list(APPEND SRC_FILES "button_adc.c")
1310
endif()
1411

1512
idf_component_register(SRCS ${SRC_FILES}
16-
INCLUDE_DIRS include
13+
INCLUDE_DIRS include interface
1714
REQUIRES ${REQ}
1815
PRIV_REQUIRES ${PRIVREQ})
1916

20-
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_LESS "5.0")
21-
# Add the macro CONFIG_SOC_ADC_SUPPORTED for the following chips.
22-
if(CONFIG_IDF_TARGET STREQUAL "esp32" OR
23-
CONFIG_IDF_TARGET STREQUAL "esp32s2" OR
24-
CONFIG_IDF_TARGET STREQUAL "esp32s3" OR
25-
CONFIG_IDF_TARGET STREQUAL "esp32c3" OR
26-
CONFIG_IDF_TARGET STREQUAL "esp32h2")
27-
target_compile_definitions(${COMPONENT_LIB} PUBLIC CONFIG_SOC_ADC_SUPPORTED)
28-
endif()
29-
endif()
30-
3117
include(package_manager)
3218
cu_pkg_define_version(${CMAKE_CURRENT_LIST_DIR})

components/button/Kconfig

+3-13
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,12 @@ menu "IoT Button"
2424
range 500 5000
2525
default 1500
2626

27-
config BUTTON_SERIAL_TIME_MS
28-
int "BUTTON SERIAL TIME (MS)"
27+
config BUTTON_LONG_PRESS_HOLD_SERIAL_TIME_MS
28+
int "BUTTON LONG_PRESS_HOLD SERIAL TIME (MS)"
2929
range 2 1000
3030
default 20
3131
help
32-
"Serial trigger interval"
33-
34-
config GPIO_BUTTON_SUPPORT_POWER_SAVE
35-
bool "GPIO BUTTON SUPPORT POWER SAVE"
36-
default n
37-
help
38-
Enable GPIO button power save
39-
40-
The function enables the use of GPIO buttons during light sleep,
41-
but enabling this function prevents the simultaneous use of other
42-
types of buttons.
32+
"Long press hold Serial trigger interval"
4333

4434
config ADC_BUTTON_MAX_CHANNEL
4535
int "ADC BUTTON MAX CHANNEL"

0 commit comments

Comments
 (0)