| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <cstdint> | ||
| 4 | #include "esp_err.h" | ||
| 5 | |||
| 6 | // GPIO number type | ||
| 7 | typedef enum { | ||
| 8 | GPIO_NUM_0 = 0, | ||
| 9 | GPIO_NUM_15 = 15, | ||
| 10 | GPIO_NUM_22 = 22, | ||
| 11 | GPIO_NUM_25 = 25, | ||
| 12 | GPIO_NUM_26 = 26, | ||
| 13 | GPIO_NUM_27 = 27, | ||
| 14 | } gpio_num_t; | ||
| 15 | |||
| 16 | // GPIO modes | ||
| 17 | typedef enum { | ||
| 18 | GPIO_MODE_INPUT = 1, | ||
| 19 | GPIO_MODE_OUTPUT = 2, | ||
| 20 | GPIO_MODE_DISABLE = 0, | ||
| 21 | } gpio_mode_t; | ||
| 22 | |||
| 23 | // GPIO pull modes | ||
| 24 | typedef enum { | ||
| 25 | GPIO_PULLUP_DISABLE = 0, | ||
| 26 | GPIO_PULLUP_ENABLE = 1, | ||
| 27 | } gpio_pullup_t; | ||
| 28 | |||
| 29 | typedef enum { | ||
| 30 | GPIO_PULLDOWN_DISABLE = 0, | ||
| 31 | GPIO_PULLDOWN_ENABLE = 1, | ||
| 32 | } gpio_pulldown_t; | ||
| 33 | |||
| 34 | // GPIO interrupt types | ||
| 35 | typedef enum { | ||
| 36 | GPIO_INTR_DISABLE = 0, | ||
| 37 | GPIO_INTR_POSEDGE = 1, | ||
| 38 | GPIO_INTR_NEGEDGE = 2, | ||
| 39 | GPIO_INTR_ANYEDGE = 3, | ||
| 40 | GPIO_INTR_LOW_LEVEL = 4, | ||
| 41 | GPIO_INTR_HIGH_LEVEL = 5, | ||
| 42 | } gpio_int_type_t; | ||
| 43 | |||
| 44 | // GPIO configuration structure | ||
| 45 | typedef struct { | ||
| 46 | uint64_t pin_bit_mask; | ||
| 47 | gpio_mode_t mode; | ||
| 48 | gpio_pullup_t pull_up_en; | ||
| 49 | gpio_pulldown_t pull_down_en; | ||
| 50 | gpio_int_type_t intr_type; | ||
| 51 | } gpio_config_t; | ||
| 52 | |||
| 53 | // GPIO ISR handler type | ||
| 54 | typedef void (*gpio_isr_t)(void*); | ||
| 55 | |||
| 56 | // GPIO functions (stubs) | ||
| 57 | ✗ | inline esp_err_t gpio_config(const gpio_config_t* config) { | |
| 58 | ✗ | return ESP_OK; | |
| 59 | } | ||
| 60 | |||
| 61 | ✗ | inline int gpio_get_level(gpio_num_t gpio_num) { | |
| 62 | ✗ | return 0; // Default level LOW | |
| 63 | } | ||
| 64 | |||
| 65 | ✗ | inline esp_err_t gpio_set_level(gpio_num_t gpio_num, uint32_t level) { | |
| 66 | ✗ | return ESP_OK; | |
| 67 | } | ||
| 68 | |||
| 69 | ✗ | inline esp_err_t gpio_install_isr_service(int intr_alloc_flags) { | |
| 70 | ✗ | return ESP_OK; | |
| 71 | } | ||
| 72 | |||
| 73 | ✗ | inline esp_err_t gpio_isr_handler_add(gpio_num_t gpio_num, gpio_isr_t isr_handler, void* args) { | |
| 74 | ✗ | return ESP_OK; | |
| 75 | } | ||
| 76 | |||
| 77 | ✗ | inline esp_err_t gpio_isr_handler_remove(gpio_num_t gpio_num) { | |
| 78 | ✗ | return ESP_OK; | |
| 79 | } | ||
| 80 |