blk_box_tc/main/drivers/sseg.h
2024-08-06 17:17:38 -05:00

35 lines
1008 B
C

#ifndef SSEG_H
#define SSEG_H
#include "TM1640/TM1640.h"
#include <esp_log.h>
#define SSEG_PIN_DATA GPIO_NUM_10
#define SSEG_PIN_CLK GPIO_NUM_11
extern TM1640* sseg;
/// Initializes the seven segment driver
void init_sseg();
/// sets the game seven segment to the value of the digits
///
/// the bits 0-6 map to segments A-G, and bit 7 is DP.
///
/// `digits` must have len >= 4.
void set_game_sseg_raw(uint8_t* digits);
/// sets the module seven segment to the value of the digits
///
/// the bits 0-6 map to segments A-G, and bit 7 is DP.
///
/// `digits` must have len >= 4.
void set_module_sseg_raw(uint8_t* digits);
/// sets the game timer to the given number, with the dot at position `dot_pos` from the right (0 => right-most digit).
void set_game_sseg_num(unsigned int value, int dot_pos);
/// sets the module timer to the given number, with the dot at position `dot_pos` from the right (0 => right-most digit).
void set_module_sseg_num(unsigned int value, int dot_pos);
#endif /* SSEG_H */