Rdzleo 4547e9e732 适配ESP32-C3开发板成功
1、原有ESP32-S3功能基本实现,有些小Bug需要修复;
2、RAM内存不够导致Img界面图片显示画质不完整,并且当前未开启蓝牙功能,开机蓝牙功能后RAM内存压力加剧;
2026-02-12 15:45:36 +08:00

54 lines
1.5 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "gpio.h"
#include "driver/gpio.h"
#include "esp_err.h"
#include "esp_log.h"
#include "esp_lcd_st77916.h"
#include "esp_lvgl_port.h"
void test_display(esp_lcd_panel_handle_t panel_handle){
uint16_t *color_buf = malloc(LCD_WID * 100 * sizeof(uint16_t));
if (color_buf == NULL) {
ESP_LOGE(LCD_TAG, "红色缓冲区分配失败");
return;
}
for (int i = 0; i < LCD_WID * 100; i++) {
color_buf[i] = 0xF800;
}
esp_err_t err = esp_lcd_panel_draw_bitmap(
panel_handle,
0, 0,
LCD_WID - 1, 100,
color_buf
);
if (err != ESP_OK) {
ESP_LOGE(LCD_TAG, "绘制红色条失败: %s", esp_err_to_name(err));
} else {
ESP_LOGI(LCD_TAG, "红色条绘制命令已发送");
}
free(color_buf);
}
void test_gpio(){
// SPI LCD引脚测试C3适配
gpio_config_t led_conf = {};
led_conf.mode = GPIO_MODE_OUTPUT;
led_conf.pull_up_en = GPIO_PULLUP_DISABLE;
led_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
led_conf.intr_type = GPIO_INTR_DISABLE;
led_conf.pin_bit_mask = (1ULL << PIN_LCD_CLK);
gpio_config(&led_conf);
led_conf.pin_bit_mask = (1ULL << PIN_LCD_MOSI);
gpio_config(&led_conf);
led_conf.pin_bit_mask = (1ULL << PIN_LCD_CS);
gpio_config(&led_conf);
led_conf.pin_bit_mask = (1ULL << PIN_LCD_DC);
gpio_config(&led_conf);
led_conf.pin_bit_mask = (1ULL << PIN_LCD_BL);
gpio_config(&led_conf);
}