* Feature: set_digits() for setting VFD digits

This commit is contained in:
2022-03-07 17:17:16 +01:00
parent 17ec23023d
commit 6aaefc300f
3 changed files with 20 additions and 1 deletions

View File

@@ -58,6 +58,17 @@ void set_duty (uint8_t brightness)
{
brightness = 7;
}
uint8_t command = 0x50 | brightness;
const uint8_t command = 0x50 | brightness;
transmit_bytes (&command, 1);
}
void set_digits (uint8_t digit_count)
{
if (digit_count >= 16)
digit_count = 8; //we'll subtract 8 later from this number
if (digit_count < 9)
digit_count = 9;
digit_count -= 8;
const uint8_t command = 0x60 | digit_count;
transmit_bytes (&command, 1);
}

View File

@@ -37,6 +37,13 @@ void transmit_bytes (const uint8_t *payload, uint8_t size);
* --------------------------------------------------------- */
void set_ports (uint8_t gp1, uint8_t gp2);
/* ---------------------------------------------------------------------------------------
* Sets the number of digit_count the VFD has
* digit_count below 9 are interpreted as 9 and digit_count above 16 are interpreted as 16
* Handles the entire communication
* --------------------------------------------------------------------------------------- */
void set_digits(uint8_t digit_count);
/* -----------------------------------------------------------
* Sets duty cycle of controlled VFD
* Brightness between 0 and 7 are accepted, any higher means 7

1
main.c
View File

@@ -12,6 +12,7 @@ int main ()
{
PT6302_startup ();
set_ports (1, 1);
set_digits (12);
set_duty (7);
while (1)
{