Merge pull request 'Added support STM32G0 Series' (#2) from Dev into main
Reviewed-on: http://domstudent.ru:3000/Library/DS_MAX7219/pulls/2
This commit is contained in:
@@ -1,8 +1,16 @@
|
|||||||
#ifndef DSMAX7219_H
|
#ifndef DSMAX7219_H
|
||||||
#define DSMAX7219_H
|
#define DSMAX7219_H
|
||||||
|
|
||||||
#include "stm32f0xx_hal.h"
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#ifdef STM32G030xx
|
||||||
|
#include "stm32g0xx_hal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef STM32F030xx
|
||||||
|
#include "stm32f0xx_hal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct DS_MAX7219
|
typedef struct DS_MAX7219
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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)
|
void DS_MAX7219_Print(DS_MAX7219* Display, int64_t Number)
|
||||||
{
|
{
|
||||||
|
|
||||||
//sprintf(Display->DisplayData, "%lld", Number);
|
|
||||||
|
|
||||||
|
|
||||||
if (Number<0)
|
if (Number<0)
|
||||||
{
|
{
|
||||||
Display->DisplayData[0] = '-';
|
Display->DisplayData[0] = '-';
|
||||||
@@ -171,7 +167,7 @@ void DS_MAX7219_UpdataDisplay(DS_MAX7219 *Display)
|
|||||||
for (uint8_t i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
HAL_GPIO_WritePin(Display->Port_CS, Display->Pin_CS, GPIO_PIN_RESET);
|
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_SPI_Transmit(Display->SPI, (uint8_t*) &Data, 1, 100);
|
||||||
HAL_GPIO_WritePin(Display->Port_CS, Display->Pin_CS, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(Display->Port_CS, Display->Pin_CS, GPIO_PIN_SET);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user