Trying to get Kconfig to work
There's something wrong with the importing part I think
This commit is contained in:
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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user