forked from xiaozhi/xiaozhi-esp32
Add support for Waveshare ESP32-S3-ePaper-1.54 board (#1375)
* Add support for Waveshare ESP32-S3-ePaper-1.54 board * 根据审核,做对应的修改 * fix:优化格式,主要是对头文件引用进行修改 --------- Co-authored-by: Tomato Me <55608753+wurongmin@users.noreply.github.com>
This commit is contained in:
58
main/boards/waveshare-s3-epaper-1.54/board_power_bsp.cc
Normal file
58
main/boards/waveshare-s3-epaper-1.54/board_power_bsp.cc
Normal file
@@ -0,0 +1,58 @@
|
||||
#include <stdio.h>
|
||||
#include <driver/gpio.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include "board_power_bsp.h"
|
||||
|
||||
void BoardPowerBsp::PowerLedTask(void *arg) {
|
||||
gpio_config_t gpio_conf = {};
|
||||
gpio_conf.intr_type = GPIO_INTR_DISABLE;
|
||||
gpio_conf.mode = GPIO_MODE_OUTPUT;
|
||||
gpio_conf.pin_bit_mask = (0x1ULL << GPIO_NUM_3);
|
||||
gpio_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
||||
gpio_conf.pull_up_en = GPIO_PULLUP_ENABLE;
|
||||
ESP_ERROR_CHECK_WITHOUT_ABORT(gpio_config(&gpio_conf));
|
||||
for (;;) {
|
||||
gpio_set_level(GPIO_NUM_3, 0);
|
||||
vTaskDelay(pdMS_TO_TICKS(200));
|
||||
gpio_set_level(GPIO_NUM_3, 1);
|
||||
vTaskDelay(pdMS_TO_TICKS(200));
|
||||
}
|
||||
}
|
||||
|
||||
BoardPowerBsp::BoardPowerBsp(int epdPowerPin, int audioPowerPin, int vbatPowerPin) : epdPowerPin_(epdPowerPin), audioPowerPin_(audioPowerPin), vbatPowerPin_(vbatPowerPin) {
|
||||
gpio_config_t gpio_conf = {};
|
||||
gpio_conf.intr_type = GPIO_INTR_DISABLE;
|
||||
gpio_conf.mode = GPIO_MODE_OUTPUT;
|
||||
gpio_conf.pin_bit_mask = (0x1ULL << epdPowerPin_) | (0x1ULL << audioPowerPin_) | (0x1ULL << vbatPowerPin_);
|
||||
gpio_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
||||
gpio_conf.pull_up_en = GPIO_PULLUP_ENABLE;
|
||||
ESP_ERROR_CHECK_WITHOUT_ABORT(gpio_config(&gpio_conf));
|
||||
xTaskCreatePinnedToCore(PowerLedTask, "PowerLedTask", 3 * 1024, NULL, 2, NULL, 0);
|
||||
}
|
||||
|
||||
BoardPowerBsp::~BoardPowerBsp() {
|
||||
}
|
||||
|
||||
void BoardPowerBsp::PowerEpdOn() {
|
||||
gpio_set_level((gpio_num_t) epdPowerPin_, 0);
|
||||
}
|
||||
|
||||
void BoardPowerBsp::PowerEpdOff() {
|
||||
gpio_set_level((gpio_num_t) epdPowerPin_, 1);
|
||||
}
|
||||
|
||||
void BoardPowerBsp::PowerAudioOn() {
|
||||
gpio_set_level((gpio_num_t) audioPowerPin_, 0);
|
||||
}
|
||||
|
||||
void BoardPowerBsp::PowerAudioOff() {
|
||||
gpio_set_level((gpio_num_t) audioPowerPin_, 1);
|
||||
}
|
||||
|
||||
void BoardPowerBsp::VbatPowerOn() {
|
||||
gpio_set_level((gpio_num_t) vbatPowerPin_, 1);
|
||||
}
|
||||
|
||||
void BoardPowerBsp::VbatPowerOff() {
|
||||
gpio_set_level((gpio_num_t) vbatPowerPin_, 0);
|
||||
}
|
||||
Reference in New Issue
Block a user