mirror of
https://github.com/Derisis13/AT-VFD.git
synced 2025-12-06 19:32:49 +01:00
* Feature: set_digits() for setting VFD digits
This commit is contained in:
13
PT6302.c
13
PT6302.c
@@ -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);
|
||||
}
|
||||
|
||||
7
PT6302.h
7
PT6302.h
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user