期末大作业-增加数码管

This commit is contained in:
2025-01-07 10:43:34 +08:00
parent 26b284daac
commit cc80d09aeb
15 changed files with 7250 additions and 45 deletions

View File

@@ -0,0 +1,21 @@
#include <stdint.h>
#ifndef __SEGLED_H
#define __SEGLED_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include "variable.h"
void Display(void);
void TimeToBuff(structTime *nstTime);
void DispToBuff(uint8_t val);
#ifdef __cplusplus
}
#endif
#endif /* __SEGLED_H */

View File

@@ -59,6 +59,16 @@ void Error_Handler(void);
/* Private defines -----------------------------------------------------------*/
#define TickLed_Pin GPIO_PIN_13
#define TickLed_GPIO_Port GPIOC
#define AddrA_Pin GPIO_PIN_0
#define AddrA_GPIO_Port GPIOC
#define AddrB_Pin GPIO_PIN_1
#define AddrB_GPIO_Port GPIOC
#define AddrC_Pin GPIO_PIN_2
#define AddrC_GPIO_Port GPIOC
#define OE_Pin GPIO_PIN_3
#define OE_GPIO_Port GPIOC
#define SegLedData_Pin GPIO_PIN_0
#define SegLedData_GPIO_Port GPIOA
#define LCD_RST_Pin GPIO_PIN_11
#define LCD_RST_GPIO_Port GPIOB
#define LCD_CS_Pin GPIO_PIN_12

View File

@@ -62,7 +62,7 @@
/*#define HAL_SMBUS_MODULE_ENABLED */
#define HAL_SPI_MODULE_ENABLED
/*#define HAL_SRAM_MODULE_ENABLED */
/*#define HAL_TIM_MODULE_ENABLED */
#define HAL_TIM_MODULE_ENABLED
/*#define HAL_UART_MODULE_ENABLED */
/*#define HAL_USART_MODULE_ENABLED */
/*#define HAL_WWDG_MODULE_ENABLED */

View File

@@ -55,6 +55,7 @@ void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void TIM3_IRQHandler(void);
/* USER CODE BEGIN EFP */
/* USER CODE END EFP */

View File

@@ -0,0 +1,52 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file tim.h
* @brief This file contains all the function prototypes for
* the tim.c file
******************************************************************************
* @attention
*
* Copyright (c) 2025 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 __TIM_H__
#define __TIM_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
extern TIM_HandleTypeDef htim3;
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */
void MX_TIM3_Init(void);
/* USER CODE BEGIN Prototypes */
/* USER CODE END Prototypes */
#ifdef __cplusplus
}
#endif
#endif /* __TIM_H__ */

View File

@@ -13,6 +13,16 @@ typedef struct {
uint8_t bTimeOk; // 秒标志位
} stSysTickTimer;
typedef struct {
uint8_t mSecond;
uint8_t mMinute;
uint8_t mHour;
uint8_t mTimeCount;
uint8_t bSecondIsOk;
uint8_t mTenMilCount;
uint8_t bTenMilIsOk;
} structTime;
#ifdef __cplusplus
}
#endif