12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #ifndef _IO_H
- #define _IO_H
- #include "esp_common.h"
- #include "driver/gpio16.h"
- #define STATUS_LED 0
- #define SWITCH_A 5
- #define SWITCH_B 2
- #define LDO_SHUTDOWN 4
- #define STATUS_LED_MUX PERIPHS_IO_MUX_GPIO0_U
- #define SWITCH_A_MUX PERIPHS_IO_MUX_GPIO5_U
- #define SWITCH_B_MUX PERIPHS_IO_MUX_GPIO2_U
- #define LDO_SHUTDOWN_MUX PERIPHS_IO_MUX_GPIO4_U
- #define STATUS_LED_FUNC FUNC_GPIO0
- #define SWITCH_A_FUNC FUNC_GPIO5
- #define SWITCH_B_FUNC FUNC_GPIO2
- #define LDO_SHUTDOWN_FUNC FUNC_GPIO4
- #define DEBOUNCEDELAY 15 // ms
- typedef enum {
- IMU_NO_INTERRUPT = 0,
- IMU_FIFO_FULL,
- IMU_FIFO_OVERFLOW,
- IMU_MOTION
- } IMU_Interrupt_et;
- typedef void (* switch_function_t)(void);
- typedef void (* imu_function_t)(IMU_Interrupt_et);
- typedef struct {
- os_timer_t switch_a_timer;
- os_timer_t switch_b_timer;
- switch_function_t switch_a_cb;
- switch_function_t switch_b_cb;
- imu_function_t imu_cb;
- uint32_t debounce_delay;
- } IO_config_t;
- void ICACHE_FLASH_ATTR IO_InitIO(void);
- void ICACHE_FLASH_ATTR IO_Shutdown(void);
- void ICACHE_FLASH_ATTR IO_Restart(void);
- #endif
|