Trying to get Kconfig to work
There's something wrong with the importing part I think
This commit is contained in:
56
README.md
56
README.md
@@ -1,53 +1,21 @@
|
||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||
# ESP Air Monitor
|
||||
|
||||
# Hello World Example
|
||||
Skeletal idea for an esp based air monitor.
|
||||
|
||||
Starts a FreeRTOS task to print "Hello World".
|
||||
## Hardware
|
||||
|
||||
(See the README.md file in the upper level 'examples' directory for more information about examples.)
|
||||
I have used the following:
|
||||
|
||||
## How to use example
|
||||
* ESP32-S3 (although as far as I know, I'm not using any special features... and should work on any esp)
|
||||
* DHT22
|
||||
* PMS5003
|
||||
|
||||
Follow detailed instructions provided specifically for this example.
|
||||
I am thinking about also adding the following too:
|
||||
|
||||
Select the instructions depending on Espressif chip installed on your development board:
|
||||
* Senseair S8 NDIR CO2
|
||||
|
||||
- [ESP32 Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/stable/get-started/index.html)
|
||||
- [ESP32-S2 Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/index.html)
|
||||
Honestly... it might not look overly different from this sort of product (but I made this myself): https://www.airgradient.com/
|
||||
|
||||
## License
|
||||
|
||||
## Example folder contents
|
||||
|
||||
The project **hello_world** contains one source file in C language [hello_world_main.c](main/hello_world_main.c). The file is located in folder [main](main).
|
||||
|
||||
ESP-IDF projects are built using CMake. The project build configuration is contained in `CMakeLists.txt` files that provide set of directives and instructions describing the project's source files and targets (executable, library, or both).
|
||||
|
||||
Below is short explanation of remaining files in the project folder.
|
||||
|
||||
```
|
||||
├── CMakeLists.txt
|
||||
├── pytest_hello_world.py Python script used for automated testing
|
||||
├── main
|
||||
│ ├── CMakeLists.txt
|
||||
│ └── hello_world_main.c
|
||||
└── README.md This is the file you are currently reading
|
||||
```
|
||||
|
||||
For more information on structure and contents of ESP-IDF projects, please refer to Section [Build System](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html) of the ESP-IDF Programming Guide.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
* Program upload failure
|
||||
|
||||
* Hardware connection is not correct: run `idf.py -p PORT monitor`, and reboot your board to see if there are any output logs.
|
||||
* The baud rate for downloading is too high: lower your baud rate in the `menuconfig` menu, and try again.
|
||||
|
||||
## Technical support and feedback
|
||||
|
||||
Please use the following feedback channels:
|
||||
|
||||
* For technical queries, go to the [esp32.com](https://esp32.com/) forum
|
||||
* For a feature request or bug report, create a [GitHub issue](https://github.com/espressif/esp-idf/issues)
|
||||
|
||||
We will get back to you as soon as possible.
|
||||
GPLv3
|
||||
|
||||
3
components/dht22/CMakeLists.txt
Normal file
3
components/dht22/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
idf_component_register(SRCS "dht22.c"
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES driver)
|
||||
6
components/dht22/Kconfig.projbuild
Normal file
6
components/dht22/Kconfig.projbuild
Normal file
@@ -0,0 +1,6 @@
|
||||
menu "DHT22"
|
||||
config DHT22_DATA_GPIO
|
||||
int "DHT22 Data GPIO Pin"
|
||||
default -1
|
||||
|
||||
endmenu
|
||||
15
components/dht22/dht22.c
Normal file
15
components/dht22/dht22.c
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "dht22.h"
|
||||
|
||||
#define DATA_GPIO CONFIG_DHT22_DATA_GPIO
|
||||
|
||||
#if DATA_GPIO == -1
|
||||
#error "Please define your DHT22 GPIO Data Pin"
|
||||
#endif /* CONFIG_DHT22_DATA_GPIO == -1 */
|
||||
|
||||
dht22_error dht_read() {
|
||||
return DHT_OK;
|
||||
}
|
||||
|
||||
int dht_temperature() {
|
||||
return DATA_GPIO;
|
||||
}
|
||||
10
components/dht22/dht22.h
Normal file
10
components/dht22/dht22.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
typedef enum {
|
||||
DHT_OK
|
||||
} dht22_error;
|
||||
|
||||
int dht_temperature();
|
||||
dht22_error dht_read();
|
||||
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
//#include "sdkconfig.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "dht22.h"
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
printf("Hello world!\n");
|
||||
int ret = dht_read();
|
||||
printf("Hello world! - dhtRet: %i\n", ret);
|
||||
for (int i = 10; i >= 0; i--) {
|
||||
printf("Restarting in %d seconds...\n", i);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
|
||||
Reference in New Issue
Block a user