更新按键驱动
This commit is contained in:
@@ -13,6 +13,7 @@ list(APPEND srcs "esp32/kernel/os_semaphore.c")
|
||||
list(APPEND srcs "esp32/kernel/os_thread.c")
|
||||
list(APPEND srcs "esp32/kernel/os_kit.c")
|
||||
list(APPEND srcs "esp32/kernel/os_service.c")
|
||||
list(APPEND srcs "esp32/chip/gpio_esp32.c")
|
||||
list(APPEND srcs "esp32/chip/uart_esp32.c")
|
||||
list(APPEND srcs "esp32/soc_shell.c")
|
||||
list(APPEND srcs "esp32/os_entry.c")
|
||||
|
||||
63
sal/esp32/chip/gpio_esp32.c
Normal file
63
sal/esp32/chip/gpio_esp32.c
Normal file
@@ -0,0 +1,63 @@
|
||||
#include "drivers/chip/gpio.h"
|
||||
|
||||
#include "driver/gpio.h"
|
||||
|
||||
#define SYS_LOG_DOMAIN "gpio"
|
||||
#include "sys_log.h"
|
||||
|
||||
void drv_gpio_enable_all(void)
|
||||
{
|
||||
}
|
||||
|
||||
void drv_gpio_disable_all(void)
|
||||
{
|
||||
}
|
||||
|
||||
int drv_gpio_pin_configure(uint8_t pin, gpio_dir_t dir, gpio_pud_t pull)
|
||||
{
|
||||
gpio_config_t io_conf;
|
||||
static __typeof__(io_conf.mode) const mode_tab[] = {
|
||||
[_GPIO_DIR_IN] = GPIO_MODE_INPUT,
|
||||
[_GPIO_DIR_ANALOG] = GPIO_MODE_INPUT,
|
||||
[_GPIO_DIR_OUT] = GPIO_MODE_OUTPUT,
|
||||
[_GPIO_DIR_OPEN_DRAIN] = GPIO_MODE_OUTPUT_OD,
|
||||
};
|
||||
io_conf.intr_type = GPIO_INTR_DISABLE;
|
||||
io_conf.mode = mode_tab[dir];
|
||||
io_conf.pin_bit_mask = (1ULL << pin);
|
||||
io_conf.pull_up_en = pull == _GPIO_PUD_PULL_UP;
|
||||
io_conf.pull_down_en = pull == _GPIO_PUD_PULL_DOWN;
|
||||
gpio_config(&io_conf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int drv_gpio_pin_read(uint8_t pin)
|
||||
{
|
||||
return gpio_get_level(pin);
|
||||
}
|
||||
|
||||
void drv_gpio_pin_write(uint8_t pin, int value)
|
||||
{
|
||||
gpio_set_level(pin, value);
|
||||
}
|
||||
|
||||
void drv_gpio_exti_callback_enable(gpio_exti_cb_fn cb)
|
||||
{
|
||||
}
|
||||
|
||||
void drv_gpio_exti_callback_disable(void)
|
||||
{
|
||||
}
|
||||
|
||||
void drv_gpio_exti_irq_enable(uint8_t pin, gpio_exti_edge_t polarity, int priority)
|
||||
{
|
||||
}
|
||||
|
||||
void drv_gpio_exti_irq_disable(uint8_t pin)
|
||||
{
|
||||
}
|
||||
|
||||
int drv_gpio_exti_get_pin(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user