Skip to content

Commit 8cb62db

Browse files
committed
feat(ch422g): support enter/exit sleep
1 parent 86c81f6 commit 8cb62db

12 files changed

+104
-84
lines changed

.github/workflows/arduino_lint.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
workflow_dispatch:
55
pull_request:
66
types: [opened, reopened, synchronize]
7+
push:
8+
branches:
9+
- master
710

811
jobs:
912
lint:

.github/workflows/build_test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
workflow_dispatch:
55
pull_request:
66
types: [opened, reopened, synchronize]
7+
push:
8+
branches:
9+
- master
710

811
jobs:
912
build:

.github/workflows/issue_comment.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/new_issues.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/new_prs.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/pre-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v2
1313
- uses: actions/setup-python@v2
14-
- uses: pre-commit/action@v2.0.3
14+
- uses: pre-commit/action@v3.0.1

.github/workflows/upload_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ jobs:
1515
- name: Upload components to component service
1616
uses: espressif/upload-components-ci-action@v1
1717
with:
18-
name: "ESP32_IO_Expander"
18+
name: "esp32_io_expander"
1919
namespace: "espressif"
2020
api_token: ${{ secrets.IDF_COMPONENT_API_TOKEN }}

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# ChangeLog
22

3+
## v1.1.1 - 2025-07-07
4+
5+
### Enhancements:
6+
7+
* feat(ch422g): support enter/exit sleep
8+
9+
### Bug Fixes:
10+
11+
* fix(port): fix discarded qualifiers warning
12+
313
## v1.1.0 - 2025-02-07
414

515
### Enhancements:

src/chip/esp_expander_ch422g.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,34 @@ bool CH422G::enableAllIO_Output(void)
104104
return true;
105105
}
106106

107+
bool CH422G::enterSleep(void)
108+
{
109+
ESP_UTILS_LOG_TRACE_ENTER_WITH_THIS();
110+
111+
ESP_UTILS_CHECK_FALSE_RETURN(isOverState(State::BEGIN), false, "Not begun");
112+
113+
ESP_UTILS_CHECK_ERROR_RETURN(
114+
esp_io_expander_ch422g_enter_sleep(device_handle), false, "Enter sleep failed"
115+
);
116+
117+
ESP_UTILS_LOG_TRACE_EXIT_WITH_THIS();
118+
119+
return true;
120+
}
121+
122+
bool CH422G::exitSleep(void)
123+
{
124+
ESP_UTILS_LOG_TRACE_ENTER_WITH_THIS();
125+
126+
ESP_UTILS_CHECK_FALSE_RETURN(isOverState(State::BEGIN), false, "Not begun");
127+
128+
ESP_UTILS_CHECK_ERROR_RETURN(
129+
esp_io_expander_ch422g_exit_sleep(device_handle), false, "Exit sleep failed"
130+
);
131+
132+
ESP_UTILS_LOG_TRACE_EXIT_WITH_THIS();
133+
134+
return true;
135+
}
136+
107137
} // namespace esp_expander

src/chip/esp_expander_ch422g.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,20 @@ class CH422G: public Base {
9999
* @return true if success, otherwise false
100100
*/
101101
bool enableAllIO_Output(void);
102+
103+
/**
104+
* @brief Enter sleep mode
105+
*
106+
* @return true if success, otherwise false
107+
*/
108+
bool enterSleep(void);
109+
110+
/**
111+
* @brief Exit sleep mode
112+
*
113+
* @return true if success, otherwise false
114+
*/
115+
bool exitSleep(void);
102116
};
103117

104118
} // namespace esp_expander

0 commit comments

Comments
 (0)