Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ESP-IDF examples and config files #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add ESP-IDF examples and config files
ESP32 MCU code examples for the TM1638 chip.
  • Loading branch information
hayschan committed Aug 31, 2023
commit 54f343dbec5bd4557dbc04b24cbed2aff07a3048
3 changes: 3 additions & 0 deletions CMakelists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
idf_component_register(SRCS "tm1638.c" "TM1638_platform.c"
INCLUDE_DIRS "."
REQUIRES driver)
8 changes: 8 additions & 0 deletions examples/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)

set(EXTRA_COMPONENT_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../../)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(tm1638)
2 changes: 2 additions & 0 deletions examples/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
idf_component_register(SRCS "main.c"
INCLUDE_DIRS "")
19 changes: 19 additions & 0 deletions examples/esp32/main/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "TM1638.h"
#include "TM1638_platform.h"

void app_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);
}
11 changes: 11 additions & 0 deletions idf_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: "2.0.0"

description: TM1638 driver for AVR (ATmega32), STM32 (HAL) and ESP32 (esp-idf)
url: https://github.com/MahdaSystem/TM1638
repository: https://github.com/MahdaSystem/TM1638.git
documentation: https://github.com/MahdaSystem/TM1638#readme
issues: https://github.com/MahdaSystem/TM1638/issues

dependencies:
# Required IDF version
idf: ">=4.2"