本帖最后由 驴友花雕 于 2023-12-19 18:34 编辑
本例实验的SPI彩色液晶1.77寸显示屏(ST7735驱动)
电原理图
SPI彩色液晶显示屏:TFT177-SPI,型号为SX177QQVGA,像素128X160TFT,驱动芯片为ST7735S,这是一款支持SPI接口的1.77寸TFT彩屏,可以显示文字、图形、图片等内容,提高用户互动体验度。
【花雕动手做】实验十八:用1.8寸TFT彩屏(ST7735)显示大号汉字与变换字号
实验开源代码
- #define ASC2_12
- #define ST7735_CS_PIN 9
- #define ST7735_CS_GPIO_PIN gpio_pin_1
- #define ST7735_DC_PIN 1
- #define ST7735_DC_GPIO_PIN gpio_pin_1
- #define ST7735_RST_PIN 25
- #define ST7735_RST_GPIO_PIN gpio_pin_1
- #define ST7735_SCK_PIN 3
- #define ST7735_SCK_GPIO_PIN gpio_pin_3
- #define ST7735_MOSI_PIN 2
- #define ST7735_MOSI_GPIO_PIN gpio_pin_2
- #define ST7735S_RGB_GBR_ORDER 0
-
- #include "asr.h"
- extern "C"{ void * __dso_handle = 0 ;}
- #include "setup.h"
- #include "myLib/asr_ws2812.h"
- #include "myLib/asr_event.h"
- #include "myLib/asr_st7735.h"
-
- uint32_t snid;
- int8_t volue = 5;
- void hardware_init();
-
- //{ID:250,keyword:"命令词",ASR:"最大音量",ASRTO:"音量调整到最大"}
- //{ID:251,keyword:"命令词",ASR:"中等音量",ASRTO:"音量调整到中等"}
- //{ID:252,keyword:"命令词",ASR:"最小音量",ASRTO:"音量调整到最小"}
- WS2812 ASR_WS2812_27(27);
- SPITFT spi_tft(128, 160);
- void ASR_CODE()
- {
- //{ID:500,keyword:"唤醒词",ASR:"智能管家",ASRTO:"我在"}
- if(snid == 500){
- digital_write((21),1);
- spi_tft.clear((0xFFFF));
- ASR_WS2812_27.setBrightness(30);
- ASR_WS2812_27.pixel_set_all_color(0,255,0);
- ASR_WS2812_27.pixel_show();
- }
- //{ID:501,keyword:"命令词",ASR:"蓝色背景",ASRTO:"可以了"}
- if(snid == 501){
- spi_tft.clear((0x001F));
- spi_tft.set_text_color((0xFFFF),(0x001F));
- ASR_WS2812_27.setBrightness(50);
- ASR_WS2812_27.pixel_set_all_color(0,0,255);
- ASR_WS2812_27.pixel_show();
- }
- //{ID:502,keyword:"命令词",ASR:"人工智能",ASRTO:"已显示"}
- if(snid == 502){
- spi_tft.set_cursor(15,40);
- spi_tft.draw_hanzi_24("人工智能");
- }
- //{ID:503,keyword:"命令词",ASR:"显示内容",ASRTO:"人工智能语音识别"}
- if(snid == 503){
-
- }
- //{ID:504,keyword:"命令词",ASR:"语音识别",ASRTO:"有了"}
- if(snid == 504){
- spi_tft.set_cursor(0,90);
- spi_tft.draw_hanzi_32("语音识别");
- }
- //{ID:505,keyword:"命令词",ASR:"不错呀",ASRTO:"这个鼓励很到位,谢谢!"}
- if(snid == 505){
-
- }
- //{ID:506,keyword:"命令词",ASR:"连起来",ASRTO:""}
- if(snid == 506){
- spi_tft.clear((0x001F));
- spi_tft.set_text_color((0xFFFF),(0x001F));
- spi_tft.set_cursor(15,90);
- spi_tft.draw_hanzi_24("语音识别");
- delay(500);
- spi_tft.set_cursor(0,40);
- spi_tft.draw_hanzi_32("人工智能");
- }
- //{ID:507,keyword:"命令词",ASR:"红色背景",ASRTO:"可以了"}
- if(snid == 507){
- spi_tft.clear((0xF800));
- spi_tft.set_text_color((0xFFFF),(0xF800));
- ASR_WS2812_27.pixel_set_all_color(0,0,0);
- ASR_WS2812_27.pixel_show();
- }
- }
-
- void hardware_init(){
- spi_tft.init();
- digital_write((21),0);
- spi_tft.set_direction(2);
- spi_tft.set_text_wrap(true);
- spi_tft.set_text_size(12);
- spi_tft.set_bg_mode(1);
- vTaskDelete(NULL);
- }
-
- void setup()
- {
- //{speak:欢欢-职业女声,vol:20,speed:10,platform:haohaodada}
- //{playid:10001,voice:欢迎使用人工智能AI语音助手,用智能管家唤醒我}
- //{playid:10002,voice:我退下了,用智能管家唤醒我}
- ASR_WS2812_27.pixel_init(3);
- xTaskCreate(hardware_init,"hardware_init",256,NULL,100,NULL);
- }
复制代码
训练模型与编译烧录
实验记录视频
https://www.bilibili.com/video/BV1hK411b7e4/?share_source=copy_web&vd_source=371a292a55e5ca9be994cbb4a86cc987
|