删除测温ADC,更改加热引脚与状态跟初始电平,优化屏幕显示函数,增加 用UFT8转GBK的Python脚本,测试有效,实际使用待完善
This commit is contained in:
@@ -1,52 +0,0 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file adc.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the adc.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2026 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __ADC_H__
|
||||
#define __ADC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
extern ADC_HandleTypeDef hadc1;
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_ADC1_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
|
||||
/* USER CODE END Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ADC_H__ */
|
||||
|
||||
127
Core/Inc/gbk_text.h
Normal file
127
Core/Inc/gbk_text.h
Normal file
@@ -0,0 +1,127 @@
|
||||
#ifndef __GBK_TEXT_H__
|
||||
#define __GBK_TEXT_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// 对应文本(UTF8):智能按摩仪
|
||||
// 对应GBK编码:0xD6, 0xC7, 0xC4, 0xDC, 0xB0, 0xB4, 0xC4, 0xA6, 0xD2, 0xC7
|
||||
const uint8_t text_device_name_GBK[] = {0xD6, 0xC7, 0xC4, 0xDC, 0xB0, 0xB4, 0xC4, 0xA6, 0xD2, 0xC7};
|
||||
#define text_device_name_LEN (sizeof(text_device_name_GBK))
|
||||
#define text_device_name text_device_name_GBK
|
||||
|
||||
// 对应文本(UTF8):设备加载中请稍候
|
||||
// 对应GBK编码:0xC9, 0xE8, 0xB1, 0xB8, 0xBC, 0xD3, 0xD4, 0xD8, 0xD6, 0xD0, 0xC7, 0xEB, 0xC9, 0xD4, 0xBA, 0xF2
|
||||
const uint8_t text_device_loading_GBK[] = {0xC9, 0xE8, 0xB1, 0xB8, 0xBC, 0xD3, 0xD4, 0xD8, 0xD6, 0xD0, 0xC7, 0xEB, 0xC9, 0xD4, 0xBA, 0xF2};
|
||||
#define text_device_loading_LEN (sizeof(text_device_loading_GBK))
|
||||
#define text_device_loading text_device_loading_GBK
|
||||
|
||||
// 对应文本(UTF8):开始按摩
|
||||
// 对应GBK编码:0xBF, 0xAA, 0xCA, 0xBC, 0xB0, 0xB4, 0xC4, 0xA6
|
||||
const uint8_t text_start_massage_GBK[] = {0xBF, 0xAA, 0xCA, 0xBC, 0xB0, 0xB4, 0xC4, 0xA6};
|
||||
#define text_start_massage_LEN (sizeof(text_start_massage_GBK))
|
||||
#define text_start_massage text_start_massage_GBK
|
||||
|
||||
// 对应文本(UTF8):开始加热
|
||||
// 对应GBK编码:0xBF, 0xAA, 0xCA, 0xBC, 0xBC, 0xD3, 0xC8, 0xC8
|
||||
const uint8_t text_start_heating_GBK[] = {0xBF, 0xAA, 0xCA, 0xBC, 0xBC, 0xD3, 0xC8, 0xC8};
|
||||
#define text_start_heating_LEN (sizeof(text_start_heating_GBK))
|
||||
#define text_start_heating text_start_heating_GBK
|
||||
|
||||
// 对应文本(UTF8):停止按摩
|
||||
// 对应GBK编码:0xCD, 0xA3, 0xD6, 0xB9, 0xB0, 0xB4, 0xC4, 0xA6
|
||||
const uint8_t text_stop_massage_GBK[] = {0xCD, 0xA3, 0xD6, 0xB9, 0xB0, 0xB4, 0xC4, 0xA6};
|
||||
#define text_stop_massage_LEN (sizeof(text_stop_massage_GBK))
|
||||
#define text_stop_massage text_stop_massage_GBK
|
||||
|
||||
// 对应文本(UTF8):停止加热
|
||||
// 对应GBK编码:0xCD, 0xA3, 0xD6, 0xB9, 0xBC, 0xD3, 0xC8, 0xC8
|
||||
const uint8_t text_stop_heating_GBK[] = {0xCD, 0xA3, 0xD6, 0xB9, 0xBC, 0xD3, 0xC8, 0xC8};
|
||||
#define text_stop_heating_LEN (sizeof(text_stop_heating_GBK))
|
||||
#define text_stop_heating text_stop_heating_GBK
|
||||
|
||||
// 对应文本(UTF8):按摩档位:1级
|
||||
// 对应GBK编码:0xB0, 0xB4, 0xC4, 0xA6, 0xB5, 0xB5, 0xCE, 0xBB, 0xA3, 0xBA, 0x31, 0xBC, 0xB6
|
||||
const uint8_t text_massage_gear_1_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xB5, 0xB5, 0xCE, 0xBB, 0xA3, 0xBA, 0x31, 0xBC, 0xB6};
|
||||
#define text_massage_gear_1_LEN (sizeof(text_massage_gear_1_GBK))
|
||||
#define text_massage_gear_1 text_massage_gear_1_GBK
|
||||
|
||||
// 对应文本(UTF8):按摩档位:2级
|
||||
// 对应GBK编码:0xB0, 0xB4, 0xC4, 0xA6, 0xB5, 0xB5, 0xCE, 0xBB, 0xA3, 0xBA, 0x32, 0xBC, 0xB6
|
||||
const uint8_t text_massage_gear_2_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xB5, 0xB5, 0xCE, 0xBB, 0xA3, 0xBA, 0x32, 0xBC, 0xB6};
|
||||
#define text_massage_gear_2_LEN (sizeof(text_massage_gear_2_GBK))
|
||||
#define text_massage_gear_2 text_massage_gear_2_GBK
|
||||
|
||||
// 对应文本(UTF8):按摩档位:3级
|
||||
// 对应GBK编码:0xB0, 0xB4, 0xC4, 0xA6, 0xB5, 0xB5, 0xCE, 0xBB, 0xA3, 0xBA, 0x33, 0xBC, 0xB6
|
||||
const uint8_t text_massage_gear_3_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xB5, 0xB5, 0xCE, 0xBB, 0xA3, 0xBA, 0x33, 0xBC, 0xB6};
|
||||
#define text_massage_gear_3_LEN (sizeof(text_massage_gear_3_GBK))
|
||||
#define text_massage_gear_3 text_massage_gear_3_GBK
|
||||
|
||||
// 对应文本(UTF8):按摩时间:10分钟
|
||||
// 对应GBK编码:0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0x31, 0x30, 0xB7, 0xD6, 0xD6, 0xD3
|
||||
const uint8_t text_massage_time_10_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0x31, 0x30, 0xB7, 0xD6, 0xD6, 0xD3};
|
||||
#define text_massage_time_10_LEN (sizeof(text_massage_time_10_GBK))
|
||||
#define text_massage_time_10 text_massage_time_10_GBK
|
||||
|
||||
// 对应文本(UTF8):按摩时间:15分钟
|
||||
// 对应GBK编码:0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0x31, 0x35, 0xB7, 0xD6, 0xD6, 0xD3
|
||||
const uint8_t text_massage_time_15_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0x31, 0x35, 0xB7, 0xD6, 0xD6, 0xD3};
|
||||
#define text_massage_time_15_LEN (sizeof(text_massage_time_15_GBK))
|
||||
#define text_massage_time_15 text_massage_time_15_GBK
|
||||
|
||||
// 对应文本(UTF8):按摩时间:20分钟
|
||||
// 对应GBK编码:0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0x32, 0x30, 0xB7, 0xD6, 0xD6, 0xD3
|
||||
const uint8_t text_massage_time_20_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0x32, 0x30, 0xB7, 0xD6, 0xD6, 0xD3};
|
||||
#define text_massage_time_20_LEN (sizeof(text_massage_time_20_GBK))
|
||||
#define text_massage_time_20 text_massage_time_20_GBK
|
||||
|
||||
// 对应文本(UTF8):按摩时间:30分钟
|
||||
// 对应GBK编码:0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0x33, 0x30, 0xB7, 0xD6, 0xD6, 0xD3
|
||||
const uint8_t text_massage_time_30_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0x33, 0x30, 0xB7, 0xD6, 0xD6, 0xD3};
|
||||
#define text_massage_time_30_LEN (sizeof(text_massage_time_30_GBK))
|
||||
#define text_massage_time_30 text_massage_time_30_GBK
|
||||
|
||||
// 对应文本(UTF8):按摩时间:持续
|
||||
// 对应GBK编码:0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0xB3, 0xD6, 0xD0, 0xF8
|
||||
const uint8_t text_massage_time_cont_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xA3, 0xBA, 0xB3, 0xD6, 0xD0, 0xF8};
|
||||
#define text_massage_time_cont_LEN (sizeof(text_massage_time_cont_GBK))
|
||||
#define text_massage_time_cont text_massage_time_cont_GBK
|
||||
|
||||
// 对应文本(UTF8):剩余按摩时间为:%d
|
||||
// 对应GBK编码:0xCA, 0xA3, 0xD3, 0xE0, 0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xCE, 0xAA, 0xA3, 0xBA, 0x25, 0x64
|
||||
const uint8_t text_remaining_time_GBK[] = {0xCA, 0xA3, 0xD3, 0xE0, 0xB0, 0xB4, 0xC4, 0xA6, 0xCA, 0xB1, 0xBC, 0xE4, 0xCE, 0xAA, 0xA3, 0xBA, 0x25, 0x64};
|
||||
#define text_remaining_time_LEN (sizeof(text_remaining_time_GBK))
|
||||
#define text_remaining_time text_remaining_time_GBK
|
||||
|
||||
// 对应文本(UTF8):加热已开启
|
||||
// 对应GBK编码:0xBC, 0xD3, 0xC8, 0xC8, 0xD2, 0xD1, 0xBF, 0xAA, 0xC6, 0xF4
|
||||
const uint8_t text_heating_on_GBK[] = {0xBC, 0xD3, 0xC8, 0xC8, 0xD2, 0xD1, 0xBF, 0xAA, 0xC6, 0xF4};
|
||||
#define text_heating_on_LEN (sizeof(text_heating_on_GBK))
|
||||
#define text_heating_on text_heating_on_GBK
|
||||
|
||||
// 对应文本(UTF8):加热已关闭
|
||||
// 对应GBK编码:0xBC, 0xD3, 0xC8, 0xC8, 0xD2, 0xD1, 0xB9, 0xD8, 0xB1, 0xD5
|
||||
const uint8_t text_heating_off_GBK[] = {0xBC, 0xD3, 0xC8, 0xC8, 0xD2, 0xD1, 0xB9, 0xD8, 0xB1, 0xD5};
|
||||
#define text_heating_off_LEN (sizeof(text_heating_off_GBK))
|
||||
#define text_heating_off text_heating_off_GBK
|
||||
|
||||
// 对应文本(UTF8):按摩中
|
||||
// 对应GBK编码:0xB0, 0xB4, 0xC4, 0xA6, 0xD6, 0xD0
|
||||
const uint8_t text_massage_running_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xD6, 0xD0};
|
||||
#define text_massage_running_LEN (sizeof(text_massage_running_GBK))
|
||||
#define text_massage_running text_massage_running_GBK
|
||||
|
||||
// 对应文本(UTF8):按摩已暂停
|
||||
// 对应GBK编码:0xB0, 0xB4, 0xC4, 0xA6, 0xD2, 0xD1, 0xD4, 0xDD, 0xCD, 0xA3
|
||||
const uint8_t text_massage_paused_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xD2, 0xD1, 0xD4, 0xDD, 0xCD, 0xA3};
|
||||
#define text_massage_paused_LEN (sizeof(text_massage_paused_GBK))
|
||||
#define text_massage_paused text_massage_paused_GBK
|
||||
|
||||
// 对应文本(UTF8):按摩已结束
|
||||
// 对应GBK编码:0xB0, 0xB4, 0xC4, 0xA6, 0xD2, 0xD1, 0xBD, 0xE1, 0xCA, 0xF8
|
||||
const uint8_t text_massage_ended_GBK[] = {0xB0, 0xB4, 0xC4, 0xA6, 0xD2, 0xD1, 0xBD, 0xE1, 0xCA, 0xF8};
|
||||
#define text_massage_ended_LEN (sizeof(text_massage_ended_GBK))
|
||||
#define text_massage_ended text_massage_ended_GBK
|
||||
|
||||
|
||||
#endif // __GBK_TEXT_H__
|
||||
@@ -57,8 +57,6 @@ void Error_Handler(void);
|
||||
/* USER CODE END EFP */
|
||||
|
||||
/* Private defines -----------------------------------------------------------*/
|
||||
#define HOT_Pin GPIO_PIN_1
|
||||
#define HOT_GPIO_Port GPIOA
|
||||
#define RUN_LED_Pin GPIO_PIN_12
|
||||
#define RUN_LED_GPIO_Port GPIOB
|
||||
#define ERR_LED_Pin GPIO_PIN_13
|
||||
@@ -71,6 +69,8 @@ void Error_Handler(void);
|
||||
#define HOT_KEY_GPIO_Port GPIOC
|
||||
#define TIME_KEY_Pin GPIO_PIN_9
|
||||
#define TIME_KEY_GPIO_Port GPIOC
|
||||
#define HOT_Pin GPIO_PIN_8
|
||||
#define HOT_GPIO_Port GPIOA
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
|
||||
@@ -16,6 +16,11 @@ extern "C" {
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* 颜色使用统一的标志 */
|
||||
#define TEXT_COLOR 15 /* 白色 */
|
||||
#define BG_COLOR 0 /* 黑色 */
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief 发送原始命令字符串到屏幕(阻塞直到发送完成)
|
||||
@@ -24,6 +29,7 @@ extern "C" {
|
||||
*/
|
||||
int Screen_SendCmd(const char *cmd);
|
||||
|
||||
void Screen_Init(void);
|
||||
|
||||
/* 常用封装 - 简短说明见各函数 */
|
||||
/** 清屏,layer: 要清除的层号(通常为0) */
|
||||
@@ -47,7 +53,7 @@ void Screen_BoxFill(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint8_t
|
||||
void Screen_Circle(uint16_t x, uint16_t y, uint16_t r, uint8_t color);
|
||||
void Screen_CircleFill(uint16_t x, uint16_t y, uint16_t r, uint8_t color);
|
||||
void Screen_SetBGColor(uint8_t color);
|
||||
|
||||
void Screen_DrawText16V_GBK(uint16_t x, uint16_t y, const uint8_t *gbk_buf, uint16_t gbk_len, uint8_t color);
|
||||
/* 带/不带背景的文本 */
|
||||
void Screen_DrawText16V(uint16_t x, uint16_t y, const char *text, uint8_t color);
|
||||
void Screen_DrawText24(uint16_t x, uint16_t y, const char *text, uint8_t color);
|
||||
@@ -66,6 +72,19 @@ void Screen_QRCodeEx(uint16_t x, uint16_t y, const char *url, uint16_t size, uin
|
||||
/* 版本信息 */
|
||||
void Screen_Ver(void);
|
||||
|
||||
// GBK
|
||||
void Screen_DrawText16_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
|
||||
void Screen_DrawText16V_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
|
||||
|
||||
void Screen_DrawText24_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
|
||||
void Screen_DrawText24V_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
|
||||
|
||||
void Screen_DrawText32_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
|
||||
void Screen_DrawText32V_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color);
|
||||
|
||||
void Screen_DrawText48_GBK(uint16_t x,uint16_t y,const uint8_t *gbk,uint16_t len,uint8_t color,uint8_t transparent);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
*/
|
||||
|
||||
#define HAL_MODULE_ENABLED
|
||||
#define HAL_ADC_MODULE_ENABLED
|
||||
/*#define HAL_ADC_MODULE_ENABLED */
|
||||
/*#define HAL_CRYP_MODULE_ENABLED */
|
||||
/*#define HAL_CAN_MODULE_ENABLED */
|
||||
/*#define HAL_CAN_LEGACY_MODULE_ENABLED */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define __STM32F1xx_IT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user