modified: Makefile

deleted:    main/include/dht.h
new file:   main/include/leds.h
modified:   main/include/sensor.h
deleted:    main/src/dht.c
new file:   main/src/leds.c
modified:   main/src/main.c
modified:   main/src/sensor.c
This commit is contained in:
Sven Luethi committed 2024-08-01 23:32:24 +02:00
1 parent ccc6e72ea7
commit 9bd0883aeb
8 files changed
+66 -346

No files matched your search

-77
View File
@@ -1,77 +0,0 @@
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <driver/gpio.h>
#include <esp_err.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Sensor type
*/
typedef enum
{
DHT_TYPE_DHT11 = 0, //!< DHT11
DHT_TYPE_DHT22, //!< DHT22
DHT_TYPE_SI7021 //!< Itead SI7021
} dht_sensor_type_t;
/**
* Initialize Config dht pin to be read on specified pin
* If you are usingPull up resistor
*/
/**
* @brief Initialize Config dht pin to be read on specified pin
*
* @param pin GPIO number of dht sensor
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
* - ESP_FAIL Init error
*/
esp_err_t dht_init(gpio_num_t pin, bool pull_up);
/**
* @brief Read data from sensor on specified pin. dht_init must be called before reading it.
* Humidity and temperature is returned as integers.
* For example: humidity=625 is 62.5 %
* temperature=244 is 24.4 degrees Celsius
*
* @param sensor_type
* @param pin GPIO number of dht sensor
* @param humidity output humidity
* @param temperature output temperature
*
* @return
* - ESP_OK Success
* - ESP_FAIL Init error
*/
esp_err_t dht_read_data(dht_sensor_type_t sensor_type, gpio_num_t pin, int16_t *humidity, int16_t *temperature);
/**
* @brief Float version of dht_read_data. Read data from sensor on specified pin. dht_init must be called before reading it.
* Humidity and temperature is returned as float.
* For example: humidity=62.5 is 62.5 %
* temperature=24.4 is 24.4 degrees Celsius
*
* @param sensor_type
* @param pin GPIO number of dht sensor
* @param humidity output humidity
* @param temperature output temperature
*
* @return
* - ESP_OK Success
* - ESP_FAIL Init error
*/
esp_err_t dht_read_float_data(dht_sensor_type_t sensor_type, gpio_num_t pin, float *humidity, float *temperature);
#ifdef __cplusplus
}
#endif
+16
View File
@@ -0,0 +1,16 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#define LED_INT GPIO_NUM_2
#define LED1 GPIO_NUM_4
#define LED2 GPIO_NUM_5
void led_blink_task(void *pvParameter);
unsigned initLEDs();
#ifdef __cplusplus
}
#endif
+1 -1
View File
@@ -6,7 +6,7 @@ extern "C" {
#endif
// Function to initialize the sensor
void initialize(void);
void initSensor(void);
// Function to get the current humidity level
// Returns the humidity as a percentage (0-100)