Skip to content
Snippets Groups Projects
Commit 25ef5649 authored by Flax's avatar Flax
Browse files

STM32L011K4 : Changed digit refresh delay management.

parent c51c371b
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,8 @@
#define cDISPMaxDigit (3U)
#define cDISPValueMax (999U)
#define cDISPSegSwitchDelay (10U)
// Division-less decade separation : https://www.baghli.com/hex2dec.php
#define cDISPDecadeSeparation100Num ((uint32_t)5243) // m
#define cDISPDecadeSeparation100Denom ((uint32_t)65536*8) // 2^s * 2^W
......@@ -50,6 +52,7 @@ const static uint8_t cDISPSevenSegmentTable_U8A[] =
static uint8_t DISPSevenSegBuffer_U8A [cDISPMaxDigit];
static uint8_t DISPSevenSegSelect_U8;
static bool DISPEnableDisplay_B;
static uint16_t DISPSegSwitchDelayCnt_U16;
// ===========================
// Local functions prototypes
......@@ -146,13 +149,21 @@ char DISPNumberToChar (uint8_t number_u8)
void DISPRefresh (void)
{
// Switch active digit
if (DISPSevenSegSelect_U8 < cDISPMaxDigit)
if (DISPSegSwitchDelayCnt_U16 < cDISPSegSwitchDelay)
{
DISPSevenSegSelect_U8++;
DISPSegSwitchDelayCnt_U16++;
}
else
{
DISPSevenSegSelect_U8 = 0U;
DISPSegSwitchDelayCnt_U16 = 0;
if (DISPSevenSegSelect_U8 < cDISPMaxDigit)
{
DISPSevenSegSelect_U8++;
}
else
{
DISPSevenSegSelect_U8 = 0U;
}
}
// Disable display before changing value
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment