Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/MahdaSystem/TM1638
TM1638 driver for AVR (ATmega32), STM32 (HAL) and ESP32 (esp-idf)
https://github.com/MahdaSystem/TM1638
atmega32 avr esp-idf esp32 esp32-idf seven-segment seven-segment-decoder seven-segment-display seven-segments-display sevensegment-library stm32 stm32-hal tm1638 tm1638display
Last synced: about 2 months ago
JSON representation
TM1638 driver for AVR (ATmega32), STM32 (HAL) and ESP32 (esp-idf)
- Host: GitHub
- URL: https://github.com/MahdaSystem/TM1638
- Owner: MahdaSystem
- License: mit
- Created: 2021-02-04T21:44:48.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-05-15T18:21:03.000Z (7 months ago)
- Last Synced: 2024-08-02T15:26:42.093Z (5 months ago)
- Topics: atmega32, avr, esp-idf, esp32, esp32-idf, seven-segment, seven-segment-decoder, seven-segment-display, seven-segments-display, sevensegment-library, stm32, stm32-hal, tm1638, tm1638display
- Language: C
- Homepage:
- Size: 70.3 KB
- Stars: 16
- Watchers: 1
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TM1638 Library
Library for handling TM1638 LED display driver.## Library Features
- Support for both Common Anode and Common Cathode Seven-segment displays
- Support for dimming display
- Support for scan Keypad## Hardware Support
It is easy to port this library to any platform. But now it is ready for use in:
- AVR (ATmega32)
- STM32 (HAL)
- ESP32 (esp-idf)## How To Use
1. Add `TM1638.h`, `TM1638_config.h` and `TM1638.c` files to your project. It is optional to use `TM1638_platform.h` and `TM1638_platform.c` files (open and config `TM1638_platform.h` file).
2. Initialize platform-dependent part of handler.
4. Call `TM1638_Init()`.
5. Call `TM1638_ConfigDisplay()` to config display.
6. Call other functions and enjoy.## Example
Using TM1638_platform files
```c
#include
#include "TM1638.h"
#include "TM1638_platform.h"int main(void)
{
TM1638_Handler_t Handler;TM1638_Platform_Init(&Handler);
TM1638_Init(&Handler, TM1638DisplayTypeComCathode);
TM1638_ConfigDisplay(&Handler, 7, TM1638DisplayStateON);while (1)
{
// Display the number 8 and Decimal Point in the SEG1
TM1638_SetSingleDigit_HEX(&Handler, 8 | TM1638DecimalPoint, 0);
}TM1638_DeInit(&Handler);
return 0;
}
```Without using TM1638_platform files (AVR)
```c
#include
#include
#define F_CPU 8000000
#include
#include "TM1638.h"#define TM1638_DIO_DDR DDRA
#define TM1638_DIO_PORT PORTA
#define TM1638_DIO_PIN PINA
#define TM1638_DIO_NUM 0#define TM1638_CLK_DDR DDRA
#define TM1638_CLK_PORT PORTA
#define TM1638_CLK_NUM 1#define TM1638_STB_DDR DDRA
#define TM1638_STB_PORT PORTA
#define TM1638_STB_NUM 2static void
TM1638_PlatformInit(void)
{
TM1638_CLK_DDR |= (1<