Skip to content

Commit e216318

Browse files
committed
docs(aht20): improve documentation and update changelog
- Expanded documentation with additional details - Fixed a typo in `main.c` of the associated example - Updated `CHANGELOG.md` to reflect recent updates On branch update_aht20 Changes to be committed: modified: components/sensors/humiture/aht20/CHANGELOG.md modified: components/sensors/humiture/aht20/README.md deleted: components/sensors/humiture/aht20/priv_include/aht20_reg.h modified: examples/sensors/aht20_Sensor_Hub/README.md modified: examples/sensors/aht20_Sensor_Hub/main/aht20_demo_sensor_hub.c
1 parent 75b9060 commit e216318

File tree

5 files changed

+34
-29
lines changed

5 files changed

+34
-29
lines changed

components/sensors/humiture/aht20/CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# ChangeLog
22

3-
## v1.1.1 (2025-05-02)
4-
* Replace the i2c interface with i2c_bus
3+
## v1.1.1 (2025-05-28)
4+
* Replace the i2c interface with i2c_bus.
5+
* Added support for Sensor Hub.
56

67
## v1.0.0 (2024-08-09)
78

components/sensors/humiture/aht20/README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Component: AHT20
2-
I2C driver for Aosong AHT20 humidity and temperature sensor using esp-idf.
2+
I2C driver with Sensor Hub support for Aosong AHT20 humidity and temperature sensor using esp-idf.
33
Tested with AHT20 using ESP32 and ESP32-S3 devkits.
44

55
# Features
@@ -45,13 +45,13 @@ Tested with AHT20 using ESP32 and ESP32-S3 devkits.
4545

4646
# How To Use
4747

48-
This driver includes a demo example project.
48+
This driver includes demo examples.
4949

50-
Follow the example to learn how to initialize the driver and read the sensor data.
50+
Follow the examples to learn how to initialize the driver or use Sensor Hub and read the sensor data.
5151

5252
All public APIs are documented in aht20.h.
5353

54-
54+
## Driver
5555

5656
Following are the general guidelines.
5757
```c
@@ -75,8 +75,23 @@ Following are the general guidelines.
7575
printf("tempertature = %uC humidity = %u \n", raw_value.temperature, raw_value.humidity);
7676
```
7777
78+
## Senosr Hub
79+
80+
Following are the general guidelines. The sensor config and event handler used are in example.
81+
```
82+
83+
/*create a sensor with specific sensor_id and configurations*/
84+
iot_sensor_create("aht20", &sensor_config, &sensor_handle);
85+
86+
/*register handler with sensor's handle*/
87+
iot_sensor_handler_register(sensor_handle, sensor_event_handler, NULL);
88+
89+
/*start the sensor, data ready events will be posted once data is acquired successfully*/
90+
iot_sensor_start(sensor_handle);
91+
92+
```
7893
79-
# How to Configure CRC and I2C clock speed
94+
## How to Configure CRC and I2C clock speed
8095
Additionally, select in menuconfig under Component Config → AHT20; to use CRC(default is not used)
8196
or change the clock speed of device (default is 100KHz).
8297

components/sensors/humiture/aht20/priv_include/aht20_reg.h

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
This is a demo which uses the aht20 driver.
1+
This is a demo which uses the Sensor Hub.
22

33
It simply reads the humiture from aht20 sensor and prints the output continuously on terminal.

examples/sensors/aht20_Sensor_Hub/main/aht20_demo_sensor_hub.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static void sensor_event_handler(void *handler_args, esp_event_base_t base, int3
5959
sensor_data->temperature);
6060
break;
6161
case SENSOR_HUMI_DATA_READY:
62-
ESP_LOGI(TAG, "Timestamp = %llu - %s_0x%x TEMP_DATA_READY - "
62+
ESP_LOGI(TAG, "Timestamp = %llu - %s_0x%x HUMIDITY_DATA_READY - "
6363
"humidity=%.2f\n",
6464
sensor_data->timestamp,
6565
sensor_data->sensor_name,
@@ -100,19 +100,24 @@ void init_aht20()
100100
.min_delay = SENSOR_PERIOD /*data acquire period*/
101101
};
102102

103-
iot_sensor_create("aht20", &sensor_config, &sensor_handle); /*create a sensor with specific sensor_id and configurations*/
103+
/*create a sensor with specific sensor_id and configurations*/
104+
iot_sensor_create("aht20", &sensor_config, &sensor_handle);
104105

105106
/*register handler with sensor's handle*/
106107
iot_sensor_handler_register(sensor_handle, sensor_event_handler, NULL);
107108

108-
iot_sensor_start(sensor_handle); /*start a sensor, data ready events will be posted once data acquired successfully*/
109+
/*start a sensor, data ready events will be posted once data acquired successfully*/
110+
iot_sensor_start(sensor_handle);
109111

110112
}
111113

112114
void app_main(void)
113115
{
114-
i2c_master_init(); //initialize i2c master
115-
init_aht20(); // user defined function for aht20 initialization
116+
//initialize i2c master
117+
i2c_master_init();
118+
119+
// user defined function for aht20 initialization
120+
init_aht20();
116121

117122
while (1) {
118123
vTaskDelay(1000);

0 commit comments

Comments
 (0)