From ace707c10dffa4df8f081e5afed3e4789a950f7d Mon Sep 17 00:00:00 2001 From: Mikhail Date: Tue, 21 May 2024 01:28:53 +0300 Subject: [PATCH] Added support STM32G0 Series --- Inc/DS_MAX7219.h | 10 +++++++++- Src/DS_MAX7219.c | 6 +----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Inc/DS_MAX7219.h b/Inc/DS_MAX7219.h index b7a7134..df8921a 100644 --- a/Inc/DS_MAX7219.h +++ b/Inc/DS_MAX7219.h @@ -1,8 +1,16 @@ #ifndef DSMAX7219_H #define DSMAX7219_H -#include "stm32f0xx_hal.h" #include +#ifdef STM32G030xx + #include "stm32g0xx_hal.h" +#endif + +#ifdef STM32F030xx + #include "stm32f0xx_hal.h" +#endif + + typedef struct DS_MAX7219 { diff --git a/Src/DS_MAX7219.c b/Src/DS_MAX7219.c index b33e25f..e442a1b 100644 --- a/Src/DS_MAX7219.c +++ b/Src/DS_MAX7219.c @@ -24,10 +24,6 @@ void DS_MAX7219_Init(DS_MAX7219* Display, SPI_HandleTypeDef* SPI, GPIO_TypeDef* void DS_MAX7219_Print(DS_MAX7219* Display, int64_t Number) { - - //sprintf(Display->DisplayData, "%lld", Number); - - if (Number<0) { Display->DisplayData[0] = '-'; @@ -171,7 +167,7 @@ void DS_MAX7219_UpdataDisplay(DS_MAX7219 *Display) for (uint8_t i = 0; i < 8; i++) { HAL_GPIO_WritePin(Display->Port_CS, Display->Pin_CS, GPIO_PIN_RESET); - uint16_t Data = (i+1<<8) + __DS_MAX7219_ConvertSymbol(Display->DisplayData[7-i]); + uint16_t Data = ((i+1)<<8) + __DS_MAX7219_ConvertSymbol(Display->DisplayData[7-i]); HAL_SPI_Transmit(Display->SPI, (uint8_t*) &Data, 1, 100); HAL_GPIO_WritePin(Display->Port_CS, Display->Pin_CS, GPIO_PIN_SET); } -- 2.39.5