可以刷屏了

This commit is contained in:
yxming66 2025-11-28 00:23:54 +08:00
parent 08f38c1d0b
commit ec42834fa3
18 changed files with 119 additions and 65 deletions

View File

@ -62,7 +62,6 @@ void SystemClock_Config(void);
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
SX1281_t radio;
float t;
/* USER CODE END 0 */
/**
@ -116,10 +115,17 @@ int main(void)
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
LCD_Clear(RED);
HAL_Delay(1000);
LCD_Clear(BLUE);
HAL_Delay(1000);
LCD_Clear(WHITE);
HAL_Delay(1000);
LCD_Clear(BLACK);
HAL_Delay(1000);
LCD_Clear(GREEN);
// SX1281_Running();
// LCD_ShowFloatNum1(10,99,t,4,RED,WHITE,32);
t+=0.11;
HAL_Delay(1000);
}
/* USER CODE END 3 */

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -22,7 +22,7 @@ Dialog DLL: TCM.DLL V1.48.0.0
<h2>Project:</h2>
D:\CUBEMX\MR16\MDK-ARM\MR16.uvprojx
Project File Date: 11/27/2025
Project File Date: 11/28/2025
<h2>Output:</h2>
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\cangming\ARM\ARMCC\Bin'

View File

@ -3,7 +3,7 @@
<title>Static Call Graph - [MR16\MR16.axf]</title></head>
<body><HR>
<H1>Static Call Graph for image MR16\MR16.axf</H1><HR>
<BR><P>#&#060CALLGRAPH&#062# ARM Linker, 5060960: Last Updated: Thu Nov 27 22:13:40 2025
<BR><P>#&#060CALLGRAPH&#062# ARM Linker, 5060960: Last Updated: Fri Nov 28 00:21:12 2025
<BR><P>
<H3>Maximum Stack Usage = 176 bytes + Unknown(Cycles, Untraceable Function Pointers)</H3><H3>
Call chain for Maximum Stack Depth:</H3>

View File

@ -1,7 +1,7 @@
Dependencies for Project 'MR16', Target 'MR16': (DO NOT MODIFY !)
CompilerVersion: 5060960::V5.06 update 7 (build 960)::.\ARMCC
F (startup_stm32f103xb.s)(0x692846FC)(--cpu Cortex-M3 -g --apcs=interwork --pd "__MICROLIB SETA 1" -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include --pd "__UVISION_VERSION SETA 534" --pd "_RTE_ SETA 1" --pd "STM32F10X_MD SETA 1" --pd "_RTE_ SETA 1" --list startup_stm32f103xb.lst --xref -o mr16\startup_stm32f103xb.o --depend mr16\startup_stm32f103xb.d)
F (../Core/Src/main.c)(0x69285C92)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\main.o --omf_browse mr16\main.crf --depend mr16\main.d)
F (../Core/Src/main.c)(0x69287A4F)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\main.o --omf_browse mr16\main.crf --depend mr16\main.d)
I (../Core/Inc/main.h)(0x6926BBE5)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x67480A20)
I (../Core/Inc/stm32f1xx_hal_conf.h)(0x6925BA2A)
@ -43,7 +43,7 @@ I (D:\cangming\ARM\ARMCC\include\stdbool.h)(0x5E8E3CC2)
I (../sx1281-driver-c/sx1281_driver.h)(0x69248F54)
I (D:\cangming\ARM\ARMCC\include\math.h)(0x5E8E3CC2)
I (../User/device/device.h)(0x691D6BB5)
I (../User/device/lcd.h)(0x69285BF2)
I (../User/device/lcd.h)(0x69287A4F)
F (../Core/Src/gpio.c)(0x692846F9)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\gpio.o --omf_browse mr16\gpio.crf --depend mr16\gpio.d)
I (../Core/Inc/gpio.h)(0x691B56EA)
I (../Core/Inc/main.h)(0x6926BBE5)
@ -901,7 +901,7 @@ I (..\sx1281-driver-c\radio.h)(0x69249477)
I (D:\cangming\ARM\ARMCC\include\string.h)(0x5E8E3CC2)
F (..\sx1281-driver-c\sx1281_driver_hal.h)(0x6924A201)()
F (..\sx1281-driver-c\sx1281_driver_spi.c)(0x6925BEAD)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\sx1281_driver_spi.o --omf_browse mr16\sx1281_driver_spi.crf --depend mr16\sx1281_driver_spi.d)
I (../User/bsp/spi.h)(0x691D6BB5)
I (../User/bsp/spi.h)(0x69287A10)
I (../Core/Inc/spi.h)(0x691B56EA)
I (../Core/Inc/main.h)(0x6926BBE5)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x67480A20)
@ -1045,7 +1045,7 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x67480A20)
F (..\User\bsp\gpio.h)(0x691D6BB5)()
F (..\User\bsp\spi.c)(0x69203C74)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\spi_1.o --omf_browse mr16\spi_1.crf --depend mr16\spi_1.d)
F (..\User\bsp\spi.c)(0x69287A10)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\spi_1.o --omf_browse mr16\spi_1.crf --depend mr16\spi_1.d)
I (../Core/Inc/spi.h)(0x691B56EA)
I (../Core/Inc/main.h)(0x6926BBE5)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x67480A20)
@ -1076,10 +1076,10 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x67480A20)
I (../User/bsp/spi.h)(0x691D6BB5)
I (../User/bsp/spi.h)(0x69287A10)
I (D:\cangming\ARM\ARMCC\include\stdbool.h)(0x5E8E3CC2)
I (../User/bsp/bsp.h)(0x691D6BB5)
F (..\User\bsp\spi.h)(0x691D6BB5)()
F (..\User\bsp\spi.h)(0x69287A10)()
F (..\User\bsp\uart.c)(0x69249732)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\uart.o --omf_browse mr16\uart.crf --depend mr16\uart.d)
I (../Core/Inc/usart.h)(0x691B56EA)
I (../Core/Inc/main.h)(0x6926BBE5)
@ -1115,8 +1115,8 @@ I (../User/bsp/uart.h)(0x692496BB)
I (D:\cangming\ARM\ARMCC\include\stdbool.h)(0x5E8E3CC2)
I (../User/bsp/bsp.h)(0x691D6BB5)
F (..\User\bsp\uart.h)(0x692496BB)()
F (..\User\device\lcd.c)(0x69285BF2)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\lcd.o --omf_browse mr16\lcd.crf --depend mr16\lcd.d)
I (..\User\device\lcd.h)(0x69285BF2)
F (..\User\device\lcd.c)(0x69287A4F)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\lcd.o --omf_browse mr16\lcd.crf --depend mr16\lcd.d)
I (..\User\device\lcd.h)(0x69287A4F)
I (../Core/Inc/spi.h)(0x691B56EA)
I (../Core/Inc/main.h)(0x6926BBE5)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x67480A20)
@ -1148,11 +1148,11 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x67480A20)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x67480A20)
I (../Core/Inc/gpio.h)(0x691B56EA)
I (..\User\device\lcd_font.h)(0x6926CE6B)
I (..\User\device\lcd_font.h)(0x69287A4F)
I (D:\cangming\ARM\ARMCC\include\stdlib.h)(0x5E8E3CC2)
F (..\User\device\lcd.h)(0x69285BF2)()
F (..\User\device\lcd.h)(0x69287A4F)()
F (..\User\device\device.h)(0x691D6BB5)()
F (..\User\device\lcd_font.h)(0x6926CE6B)()
F (..\User\device\lcd_font.h)(0x69287A4F)()
F (..\User\component\crc8.c)(0x691D6BB5)(--c99 -c --cpu Cortex-M3 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ../sx1281-driver-c -I ../User -I.\RTE\_MR16 -ID:\cangming\ARM\CMSIS\5.7.0\CMSIS\Core\Include -ID:\cangming\keil\STM32F1xx_DFP\2.0.0\Device\Include -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o mr16\crc8.o --omf_browse mr16\crc8.crf --depend mr16\crc8.d)
I (..\User\component\crc8.h)(0x691D6BB5)
I (D:\cangming\ARM\ARMCC\include\stdbool.h)(0x5E8E3CC2)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -24,6 +24,8 @@ static void (*SPI_Callback[BSP_SPI_NUM][BSP_SPI_CB_NUM])(void);
static BSP_SPI_t SPI_Get(SPI_HandleTypeDef *hspi) {
if (hspi->Instance == SPI1)
return BSP_SPI_SX1281;
if (hspi->Instance == SPI2)
return BSP_SPI_LCD;
else
return BSP_SPI_ERR;
}
@ -98,6 +100,8 @@ SPI_HandleTypeDef *BSP_SPI_GetHandle(BSP_SPI_t spi) {
switch (spi) {
case BSP_SPI_SX1281:
return &hspi1;
case BSP_SPI_LCD:
return &hspi2;
default:
return NULL;
}
@ -176,6 +180,13 @@ int8_t BSP_SPI_MemWrite(BSP_SPI_t spi, uint8_t reg, uint8_t *data, uint16_t size
return BSP_SPI_Transmit(spi, data, size, true);
}
HAL_SPI_StateTypeDef BSP_SPI_GetState(BSP_SPI_t spi) {
if (spi >= BSP_SPI_NUM) return BSP_ERR;
SPI_HandleTypeDef *hspi = BSP_SPI_GetHandle(spi);
if (hspi == NULL) return BSP_ERR;
return HAL_SPI_GetState(hspi);
}
/* USER FUNCTION BEGIN */
/* USER FUNCTION END */

View File

@ -28,6 +28,7 @@ extern "C" {
/* SPI实体枚举与设备对应 */
typedef enum {
BSP_SPI_SX1281,
BSP_SPI_LCD,
BSP_SPI_NUM,
BSP_SPI_ERR,
} BSP_SPI_t;
@ -50,7 +51,6 @@ SPI_HandleTypeDef *BSP_SPI_GetHandle(BSP_SPI_t spi);
int8_t BSP_SPI_RegisterCallback(BSP_SPI_t spi, BSP_SPI_Callback_t type,
void (*callback)(void));
int8_t BSP_SPI_Transmit(BSP_SPI_t spi, uint8_t *data, uint16_t size, bool dma);
int8_t BSP_SPI_Receive(BSP_SPI_t spi, uint8_t *data, uint16_t size, bool dma);
int8_t BSP_SPI_TransmitReceive(BSP_SPI_t spi, uint8_t *txData, uint8_t *rxData,
@ -61,6 +61,7 @@ int8_t BSP_SPI_MemWriteByte(BSP_SPI_t spi, uint8_t reg, uint8_t data);
int8_t BSP_SPI_MemRead(BSP_SPI_t spi, uint8_t reg, uint8_t *data, uint16_t size);
int8_t BSP_SPI_MemWrite(BSP_SPI_t spi, uint8_t reg, uint8_t *data, uint16_t size);
HAL_SPI_StateTypeDef BSP_SPI_GetState(BSP_SPI_t spi);
/* USER FUNCTION BEGIN */
/* USER FUNCTION END */

View File

@ -1,13 +1,13 @@
#include "lcd.h"
#include "lcd_font.h"
#include <stdlib.h> // 添加标准库以使用 malloc 和 free
#include "bsp/spi.h"
// 写命令到LCD
static void LCD_WriteCommand(uint8_t cmd) {
LCD_DC_LOW();
LCD_CS_LOW();
HAL_SPI_Transmit(&hspi1, &cmd, 1, HAL_MAX_DELAY);
BSP_SPI_Transmit(BSP_SPI_LCD, &cmd, 1, false);
LCD_CS_HIGH();
}
@ -15,7 +15,7 @@ static void LCD_WriteCommand(uint8_t cmd) {
static void LCD_WriteData(uint8_t data) {
LCD_DC_HIGH();
LCD_CS_LOW();
HAL_SPI_Transmit(&hspi1, &data, 1, HAL_MAX_DELAY);
BSP_SPI_Transmit(BSP_SPI_LCD, &data, 1, false);
LCD_CS_HIGH();
}
@ -24,8 +24,8 @@ static void LCD_WriteData(uint8_t data) {
static void LCD_WriteDataBuffer_DMA(uint8_t *data, uint16_t size) {
LCD_DC_HIGH();
LCD_CS_LOW();
HAL_SPI_Transmit_DMA(&hspi1, data, size); // 使用 DMA 传输
while (HAL_SPI_GetState(&hspi1) != HAL_SPI_STATE_READY); // 等待传输完成
BSP_SPI_Transmit(BSP_SPI_LCD, data, size, false);
while(BSP_SPI_GetState(BSP_SPI_LCD) != HAL_SPI_STATE_READY)
LCD_CS_HIGH();
}
@ -36,7 +36,7 @@ static void LCD_WriteDataBuffer(uint8_t *data, uint16_t size) {
} else { // 否则使用普通传输
LCD_DC_HIGH();
LCD_CS_LOW();
HAL_SPI_Transmit(&hspi1, data, size, HAL_MAX_DELAY);
BSP_SPI_Transmit(BSP_SPI_LCD, data, size, false);
LCD_CS_HIGH();
}
}

View File

@ -5,11 +5,11 @@
#include "gpio.h"
// 屏幕分辨率
#define LCD_WIDTH 135
#define LCD_HEIGHT 240
#define LCD_WIDTH 135 //135
#define LCD_HEIGHT 240 //240
#define X_OFFSET 52
#define Y_OFFSET 40
#define X_OFFSET 52 //52
#define Y_OFFSET 40 //40
// 常用颜色定义