Skip to content

Commit 145bf94

Browse files
committed
esp32: Add support for DHT11 and DHT22 sensors.
1 parent 681cb0d commit 145bf94

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

esp32/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ LIB_SRC_C += \
169169
endif
170170

171171
DRIVERS_SRC_C = $(addprefix drivers/,\
172+
dht/dht.c \
172173
)
173174

174175
OBJ_MP =

esp32/modesp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
#include "py/runtime.h"
3535
#include "py/mperrno.h"
36+
#include "drivers/dht/dht.h"
3637

3738
STATIC mp_obj_t esp_flash_read(mp_obj_t offset_in, mp_obj_t buf_in) {
3839
mp_int_t offset = mp_obj_get_int(offset_in);
@@ -86,6 +87,8 @@ STATIC const mp_rom_map_elem_t esp_module_globals_table[] = {
8687
{ MP_ROM_QSTR(MP_QSTR_flash_erase), MP_ROM_PTR(&esp_flash_erase_obj) },
8788
{ MP_ROM_QSTR(MP_QSTR_flash_size), MP_ROM_PTR(&esp_flash_size_obj) },
8889
{ MP_ROM_QSTR(MP_QSTR_flash_user_start), MP_ROM_PTR(&esp_flash_user_start_obj) },
90+
91+
{ MP_ROM_QSTR(MP_QSTR_dht_readinto), MP_ROM_PTR(&dht_readinto_obj) },
8992
};
9093

9194
STATIC MP_DEFINE_CONST_DICT(esp_module_globals, esp_module_globals_table);

esp32/modules/dht.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../esp8266/scripts/dht.py

esp32/mphalport.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434

3535
extern ringbuf_t stdin_ringbuf;
3636

37+
// TODO implement me
38+
#define disable_irq() 0
39+
#define enable_irq(irq_state) (void)(irq_state)
40+
3741
uint32_t mp_hal_ticks_us(void);
3842
__attribute__((always_inline)) static inline uint32_t mp_hal_ticks_cpu(void) {
3943
uint32_t ccount;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy