Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/muffinking-jpeg/aht20
my implementation of aht20 driver
https://github.com/muffinking-jpeg/aht20
aht20 driver embedded hal sensor stm32
Last synced: about 1 month ago
JSON representation
my implementation of aht20 driver
- Host: GitHub
- URL: https://github.com/muffinking-jpeg/aht20
- Owner: MuffinKing-jpeg
- Created: 2024-11-13T21:35:55.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-15T22:11:15.000Z (about 2 months ago)
- Last Synced: 2024-11-15T23:18:34.593Z (about 2 months ago)
- Topics: aht20, driver, embedded, hal, sensor, stm32
- Language: C
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AHT20
My implementation of AHT20 driver.
## Usage
1. Init sensor `AHT20_Init();`
2. Start measuring `AHT20_StartMeasurement();`
3. **Make delay about 100ms**
4. Parse data `AHT20_ParseData(&temp,&humidity);`Note: temp and humidity variables must be **float** type!
### Example
with stm32 HAL
```C
float temp = 0;
float humidity = 0;
void main() {
HAL_Init();
/* USER CODE BEGIN Init */
AHT20_Init();
/* USER CODE END Init */
/* Initialize all configured peripherals */
MX_I2C1_Init();
/* Infinite loop */
while (1)
{
AHT20_StartMeasurement();
HAL_Delay(150);
AHT20_ParseData(&temp,&humidity);
HAL_Delay(5000);
}
}
```## Return type
All functions return `AHT20_ResponseTypeDef`.
Values:
AHT20_OK = 0
AHT20_ERROR = 1
AHT20_BUSY = 2
AHT20_BAD_CRC =3### Explanation
- AHT20_OK if everything is OK.
- AHT20_ERROR something went wrong.
- AHT20_BUSY You called `AHT20_ParseData` too early, and chip still measuring.
- AHT20_BAD_CRC mismatch of CRC.## CMAKE
If you are using CMAKE, you can add config to your toolchain.
```cmake
#Default path. Change tou yours.
add_subdirectory(Drivers/AHT20)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE
aht20
)
```## Hardware
Core functionality is hardware agnostic. You can add your hardware implementation. By default shipped with STM32 HAL implementation.
You can change hardware by toggling build params.
CMAKE params:- AHT20_DRIVER_HAL_STM32 - Default, STM32 HAL
*WIP*## TODO
- [] DMA and INTERRUPT modes
- [] Doxygen
- [] More supported hardware
- [] CC13xx/CC11xx
- [] MSP430
- [] Arduino
- [] PI nano SDK