驴友花雕 发表于 2023-12-23 16:27:23

【花雕动手做】ASRPRO语音识别(15)---1.8寸彩屏显示字号变换



本例实验的SPI彩色液晶1.77寸显示屏(ST7735驱动)



电原理图



【花雕动手做】实验二十:用1.8寸屏(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((0xFFFF));
    spi_tft.set_text_color((0xF800),(0xFFFF));
    spi_tft.set_cursor(35,10);
    spi_tft.draw_hanzi_12("小龟机器人");
    delay(1000);
    spi_tft.set_cursor(25,30);
    spi_tft.draw_hanzi_16("小龟机器人");
    delay(1000);
    spi_tft.set_cursor(5,50);
    spi_tft.draw_hanzi_24("小龟机器人");
    delay(1000);
    spi_tft.set_cursor(30,80);
    spi_tft.draw_hanzi_32("小龟");
    delay(1000);
    spi_tft.set_cursor(16,117);
    spi_tft.draw_hanzi_32("机器人");
}
//{ID:502,keyword:"命令词",ASR:"小龟",ASRTO:"是谁"}
if(snid == 502){
    spi_tft.clear((0xF800));
    spi_tft.set_text_color((0xFFFF),(0xF800));
    spi_tft.set_cursor(30,50);
    spi_tft.draw_hanzi_32("小龟");
}
//{ID:503,keyword:"命令词",ASR:"小龟小车",ASRTO:"是我"}
if(snid == 503){
    spi_tft.clear((0x001F));
    spi_tft.set_text_color((0xFFFF),(0x001F));
    spi_tft.set_cursor(0,50);
    spi_tft.draw_hanzi_32("小龟小车");
}
//{ID:504,keyword:"命令词",ASR:"小龟机器人",ASRTO:"还是我"}
if(snid == 504){
    spi_tft.clear((0x07E0));
    spi_tft.set_text_color((0xF800),(0x07E0));
    spi_tft.set_cursor(5,60);
    spi_tft.draw_hanzi_24("小龟机器人");
}
//{ID:505,keyword:"命令词",ASR:"挺好的",ASRTO:"感谢鼓励,欢迎再来"}
if(snid == 505){

}
}

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);
}

训练模型与编译烧录





实验记录视频


【【花雕动手做】实验二十:用1.8寸屏(ST7735)显示多彩字与字号变换】 https://www.bilibili.com/video/BV1Fg4y1y7BJ/?share_source=copy_web&vd_source=371a292a55e5ca9be994cbb4a86cc987

https://www.bilibili.com/video/BV1Fg4y1y7BJ/?share_source=copy_web&vd_source=371a292a55e5ca9be994cbb4a86cc987







页: [1]
查看完整版本: 【花雕动手做】ASRPRO语音识别(15)---1.8寸彩屏显示字号变换