142 lines
5.2 KiB
C
142 lines
5.2 KiB
C
|
|
/* USER CODE BEGIN Header */
|
|||
|
|
/**
|
|||
|
|
******************************************************************************
|
|||
|
|
* @file : ht16k33_dot_matrix.h
|
|||
|
|
* @brief : <EFBFBD><EFBFBD>Ļ<EFBFBD><EFBFBD>ʾ
|
|||
|
|
* @version : 1.0
|
|||
|
|
* @changelog : version 1.0 <EFBFBD><EFBFBD>ʼ<EFBFBD>汾 2025.11.13
|
|||
|
|
******************************************************************************
|
|||
|
|
* @attention
|
|||
|
|
*
|
|||
|
|
* Copyright (c) 2025 Yuwell Software Danyang.Jiangsu.China
|
|||
|
|
* THIS SOFTWARE is licensed under the Mulan PSL v1.
|
|||
|
|
* can use this software according to the terms and conditions of the Mulan PSL v1.
|
|||
|
|
* You may obtain a copy of Mulan PSL v1 at:
|
|||
|
|
* http://license.coscl.org.cn/MulanPSL
|
|||
|
|
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
|||
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
|||
|
|
* PURPOSE.
|
|||
|
|
* See the Mulan PSL v1 for more details.
|
|||
|
|
*
|
|||
|
|
******************************************************************************
|
|||
|
|
*/
|
|||
|
|
/* USER CODE END Header */
|
|||
|
|
|
|||
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|||
|
|
#ifndef __OXG_8F_10W_DISPLAY_H
|
|||
|
|
#define __OXG_8F_10W_DISPLAY_H
|
|||
|
|
|
|||
|
|
#ifdef __cplusplus
|
|||
|
|
extern "C" {
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
#include <stdint.h>
|
|||
|
|
#include "fm33lg0xx_fl.h"
|
|||
|
|
#include "fm33lg0xx_queue.h"
|
|||
|
|
#include "fm33lg0xx_event.h"
|
|||
|
|
|
|||
|
|
/************************** Ӳ<><D3B2><EFBFBD><EFBFBD><EFBFBD>ӿڶ<D3BF><DAB6><EFBFBD> *************************/
|
|||
|
|
#define HT16K33_SDA_GPIO_GROUP GPIOC
|
|||
|
|
#define HT16K33_SDA_GPIO_PIN FL_GPIO_PIN_11
|
|||
|
|
#define HT16K33_SCL_GPIO_GROUP GPIOC
|
|||
|
|
#define HT16K33_SCL_GPIO_PIN FL_GPIO_PIN_12
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/************************** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB6A8> *************************/
|
|||
|
|
|
|||
|
|
// HT16K33 28<32>Ű汾I2C<32><43>ַ<EFBFBD><D6B7>A0~A2<41><32><EFBFBD><EFBFBD>ʱΪ0x70<37><30><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<DEB8>
|
|||
|
|
#define HT16K33_ADDR 0x70 << 1 // I2C<32><43>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>1λ<31><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>дλ<D0B4><CEBB>
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB6A8>
|
|||
|
|
#define HT16K33_CMD_SYSTEM_ON 0x21 // ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
#define HT16K33_CMD_SYSTEM_OFF 0x20 // ϵͳ<CFB5>رգ<D8B1><D5A3><EFBFBD><EFBFBD><EFBFBD>ģʽ<C4A3><CABD>
|
|||
|
|
#define HT16K33_CMD_DISPLAY_ON 0x81 // <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>D=1<><31><EFBFBD><EFBFBD>˸<EFBFBD>رգ<D8B1>
|
|||
|
|
#define HT16K33_CMD_DISPLAY_OFF 0x80 // <20><>ʾ<EFBFBD>ر<EFBFBD>
|
|||
|
|
#define HT16K33_CMD_BLINK_0_5HZ 0x83 // <20><>˸Ƶ<CBB8><C6B5>0.5Hz<EFBFBD><EFBFBD>B1=1,B0=1<><31>
|
|||
|
|
#define HT16K33_CMD_BLINK_1HZ 0x82 // <20><>˸Ƶ<CBB8><C6B5>1Hz<48><7A>B1=1,B0=0<><30>
|
|||
|
|
#define HT16K33_CMD_BLINK_2HZ 0x81 // <20><>˸Ƶ<CBB8><C6B5>2Hz<48><7A>B1=0,B0=1<><31>
|
|||
|
|
#define HT16K33_CMD_DIMMING_MAX 0xEF // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD>16/16ռ<36>ձȣ<D5B1>
|
|||
|
|
#define HT16K33_CMD_INT_ENABLE 0xA9 // INT<4E><54><EFBFBD><EFBFBD>ʹ<EFBFBD>ܣ<EFBFBD>active-high<67><68>
|
|||
|
|
#define HT16K33_CMD_DISP_ADDR 0x00 // <20><>ʾRAM<41><4D>ַָ<D6B7><D6B8><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>0x00<30><30>
|
|||
|
|
#define HT16K33_CMD_ADDR_KEY 0x40 // <20><><EFBFBD><EFBFBD>RAM<41><4D>ַָ<D6B7><D6B8><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>0x40<34><30>
|
|||
|
|
|
|||
|
|
#define DISP_BUFFER_SIZE (16)
|
|||
|
|
#define SEG_TABLE_SIZE (20)
|
|||
|
|
|
|||
|
|
|
|||
|
|
/************************** <20><>ʾ<EFBFBD><CABE><EFBFBD>ݴ洢<DDB4><E6B4A2>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD> *************************/
|
|||
|
|
/**
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽṹ<EFBFBD>壺<EFBFBD><EFBFBD>ʾģʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
* <EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD>Ƶ<EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ũ<EFBFBD><EFBFBD>
|
|||
|
|
*/
|
|||
|
|
typedef struct
|
|||
|
|
{
|
|||
|
|
uint32_t work_hours; // <20><>ʱģʽ<C4A3>µĹ<C2B5><C4B9><EFBFBD>Сʱ<D0A1><CAB1><EFBFBD><EFBFBD>0-19999h<39><68>
|
|||
|
|
uint32_t work_minutes; // <20><>ȡ<EFBFBD><C8A1>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
uint32_t work_seconds; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
uint16_t oxygen_val; // <20><>Ũ<EFBFBD><C5A8>ģʽ<C4A3>µ<EFBFBD>Ũ<EFBFBD><C5A8>ֵ<EFBFBD><D6B5>0-999<39><39>Ӧ0%-99.9%<25><>
|
|||
|
|
uint16_t flow_val; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ui<75><69><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>LL<4C><4C><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
struct{
|
|||
|
|
|
|||
|
|
uint8_t num1_is_show;
|
|||
|
|
uint8_t first_8_index;
|
|||
|
|
uint8_t second_8_index;
|
|||
|
|
uint8_t third_8_index;
|
|||
|
|
uint8_t fourth_8_index;
|
|||
|
|
uint8_t carlib_code;
|
|||
|
|
}seg_index;
|
|||
|
|
} DisplayContent;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD>״̬<EFBFBD>ṹ<EFBFBD>壨<EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָʾ<EFBFBD>Ƽ<EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>
|
|||
|
|
*/
|
|||
|
|
typedef struct
|
|||
|
|
{
|
|||
|
|
uint8_t ok_led_show : 1; // OK<4F><4B><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ<EFBFBD><CABE>1:<3A><>ʾ 0:<3A><><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>
|
|||
|
|
uint8_t alarm_led_show : 1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ<EFBFBD><CABE>1:<3A><>ʾ 0:<3A><><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>
|
|||
|
|
uint8_t clean_filter_show : 1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ<EFBFBD><CABE>1:<3A><>ʾ 0:<3A><><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>
|
|||
|
|
uint8_t replace_box_show : 1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD><CBBA><EFBFBD>ʾ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ<EFBFBD><CABE>1:<3A><>ʾ 0:<3A><><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>
|
|||
|
|
uint8_t total_time_chn : 1; // <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD>h<EFBFBD><68> <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ<EFBFBD><CABE>1:<3A><>ʾ 0:<3A><><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>
|
|||
|
|
uint8_t oxg_concentration_chn : 1; // Ũ<>ȵ<EFBFBD><C8B5><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> % <20><>.<2E><><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ<EFBFBD><CABE>1:<3A><>ʾ 0:<3A><><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>
|
|||
|
|
// uint8_t on_left_num_1 : 1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ<EFBFBD><CABE>1:<3A><>ʾ 0:<3A><><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>
|
|||
|
|
DisplayContent disp_info; // <20><>ʾģʽ<C4A3><CABD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ݣ<EFBFBD><DDA3>ӽṹ<D3BD>壩
|
|||
|
|
|
|||
|
|
} UIElements;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/************************** <20>꺯<EFBFBD><EABAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *************************/
|
|||
|
|
#define HT16K33_SDA_CLEAR() FL_GPIO_ResetOutputPin(HT16K33_SDA_GPIO_GROUP,HT16K33_SDA_GPIO_PIN);
|
|||
|
|
#define HT16K33_SDA_SET() FL_GPIO_SetOutputPin(HT16K33_SDA_GPIO_GROUP,HT16K33_SDA_GPIO_PIN);
|
|||
|
|
|
|||
|
|
#define HT16K33_SCL_CLEAR() FL_GPIO_ResetOutputPin(HT16K33_SCL_GPIO_GROUP,HT16K33_SCL_GPIO_PIN);
|
|||
|
|
#define HT16K33_SCL_SET() FL_GPIO_SetOutputPin(HT16K33_SCL_GPIO_GROUP,HT16K33_SCL_GPIO_PIN);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/************************** <20>ṩ<EFBFBD><E1B9A9><EFBFBD>ⲿ<EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *************************/
|
|||
|
|
extern UIElements ui;
|
|||
|
|
extern uint8_t ht16k33_disp_buff[DISP_BUFFER_SIZE];
|
|||
|
|
|
|||
|
|
void ht16k33_ui_init(UIElements* p_ui); // <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>Ļ
|
|||
|
|
void ht16k33_chip_init(void); // <20><><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>-<2D><>ʼ<EFBFBD><CABC>оƬ <20><><EFBFBD><EFBFBD>оƬʱ<C6AC><CAB1>
|
|||
|
|
uint8_t ht16k33_send_buffer(uint8_t* disp_buffer); // <20><><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>-<2D>·<EFBFBD><C2B7><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
|
|||
|
|
void ht16k33_refresh_task(void); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<DEB8><C4B1><EFBFBD>ui
|
|||
|
|
void ht16k33_refresh_screen(void); // <20>ŵ<EFBFBD>ui<75><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>Ļ-<2D><><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB>桷<EFBFBD><E6A1B7><EFBFBD><EFBFBD>ui<75><69><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#ifdef __cplusplus
|
|||
|
|
}
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
#endif /* __OXG_8F_10W_DISPLAY_H */
|
|||
|
|
|
|||
|
|
/************************ (C) COPYRIGHT Yuwell *****END OF FILE****/
|