blk_box_tc/main/drivers/sseg.h
2025-08-21 19:32:27 -05:00

41 lines
1.2 KiB
C

#ifndef SSEG_H
#define SSEG_H
#include "TM1640/TM1640.h"
#include <esp_log.h>
#define SSEG_PIN_DATA GPIO_NUM_46
#define SSEG_PIN_CLK GPIO_NUM_48
extern TM1640* sseg;
/// Initializes the seven segment driver
void init_sseg();
/// @brief Sets the game seven segment to the value of `segments`.
///
/// the bits 0-6 map to segments A-G, and bit 7 is DP.
///
/// `digits` must have len >= 4.
void set_game_sseg_raw(const uint8_t* segments);
/// @brief Clears the game seven segment display.
void clear_game_sseg();
/// @brief Sets the module seven segment to the value of the `segments`.
///
/// the bits 0-6 map to segments A-G, and bit 7 is DP.
///
/// `digits` must have len >= 4.
void set_module_sseg_raw(const uint8_t* segments);
/// @brief Clears the game seven segment display.
void clear_module_sseg();
/// 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(uint32_t value, uint8_t 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(uint32_t value, uint8_t dot_pos);
#endif /* SSEG_H */