LibDriver TM1640
Loading...
Searching...
No Matches
driver_tm1640.h File Reference

driver tm1640 header file More...

#include <stdio.h>
#include <stdint.h>
#include <string.h>
Include dependency graph for driver_tm1640.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  tm1640_handle_s
 tm1640 handle structure definition More...
struct  tm1640_info_s
 tm1640 information structure definition More...

Macros

#define TM1640_COMMAND_DATA_DELAY   1
 tm1640 command data delay definition
#define DRIVER_TM1640_LINK_INIT(HANDLE, STRUCTURE)
 initialize tm1640_handle_t structure
#define DRIVER_TM1640_LINK_SCLK_GPIO_INIT(HANDLE, FUC)
 link sclk_gpio_init function
#define DRIVER_TM1640_LINK_SCLK_GPIO_DEINIT(HANDLE, FUC)
 link sclk_gpio_deinit function
#define DRIVER_TM1640_LINK_SCLK_GPIO_WRITE(HANDLE, FUC)
 link sclk_gpio_write function
#define DRIVER_TM1640_LINK_DIN_GPIO_INIT(HANDLE, FUC)
 link din_gpio_init function
#define DRIVER_TM1640_LINK_DIN_GPIO_DEINIT(HANDLE, FUC)
 link din_gpio_deinit function
#define DRIVER_TM1640_LINK_DIN_GPIO_WRITE(HANDLE, FUC)
 link din_gpio_write function
#define DRIVER_TM1640_LINK_DELAY_US(HANDLE, FUC)
 link delay_us function
#define DRIVER_TM1640_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_TM1640_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function

Typedefs

typedef struct tm1640_handle_s tm1640_handle_t
 tm1640 handle structure definition
typedef struct tm1640_info_s tm1640_info_t
 tm1640 information structure definition

Enumerations

enum  tm1640_address_mode_t { TM1640_ADDRESS_MODE_INC = 0x00 , TM1640_ADDRESS_MODE_FIX = 0x01 }
 tm1640 address mode enumeration definition More...
enum  tm1640_bool_t { TM1640_BOOL_FALSE = 0x00 , TM1640_BOOL_TRUE = 0x01 }
 tm1640 bool enumeration definition More...
enum  tm1640_pulse_width_t {
  TM1640_PULSE_WIDTH_1_DIV_16 = 0x00 , TM1640_PULSE_WIDTH_2_DIV_16 = 0x01 , TM1640_PULSE_WIDTH_4_DIV_16 = 0x02 , TM1640_PULSE_WIDTH_10_DIV_16 = 0x03 ,
  TM1640_PULSE_WIDTH_11_DIV_16 = 0x04 , TM1640_PULSE_WIDTH_12_DIV_16 = 0x05 , TM1640_PULSE_WIDTH_13_DIV_16 = 0x06 , TM1640_PULSE_WIDTH_14_DIV_16 = 0x07
}
 tm1640 pulse width enumeration definition More...
enum  tm1640_number_t {
  TM1640_NUMBER_0 = 0x3F , TM1640_NUMBER_1 = 0x06 , TM1640_NUMBER_2 = 0x5B , TM1640_NUMBER_3 = 0x4F ,
  TM1640_NUMBER_4 = 0x66 , TM1640_NUMBER_5 = 0x6D , TM1640_NUMBER_6 = 0x7D , TM1640_NUMBER_7 = 0x07 ,
  TM1640_NUMBER_8 = 0x7F , TM1640_NUMBER_9 = 0x6F
}
 tm1640 number enumeration definition More...

Functions

uint8_t tm1640_info (tm1640_info_t *info)
 get chip's information
uint8_t tm1640_init (tm1640_handle_t *handle)
 initialize the chip
uint8_t tm1640_deinit (tm1640_handle_t *handle)
 close the chip
uint8_t tm1640_clear_segment (tm1640_handle_t *handle)
 clear segment
uint8_t tm1640_write_segment (tm1640_handle_t *handle, uint8_t addr, uint8_t *data, uint8_t len)
 write segment
uint8_t tm1640_set_pulse_width (tm1640_handle_t *handle, tm1640_pulse_width_t width)
 set pulse width
uint8_t tm1640_get_pulse_width (tm1640_handle_t *handle, tm1640_pulse_width_t *width)
 get pulse width
uint8_t tm1640_set_display (tm1640_handle_t *handle, tm1640_bool_t enable)
 enable or disable display
uint8_t tm1640_get_display (tm1640_handle_t *handle, tm1640_bool_t *enable)
 get display status
uint8_t tm1640_set_address_mode (tm1640_handle_t *handle, tm1640_address_mode_t mode)
 set address mode
uint8_t tm1640_get_address_mode (tm1640_handle_t *handle, tm1640_address_mode_t *mode)
 get address mode
uint8_t tm1640_set_test_mode (tm1640_handle_t *handle, tm1640_bool_t enable)
 enable or disable test mode
uint8_t tm1640_get_test_mode (tm1640_handle_t *handle, tm1640_bool_t *enable)
 get test mode status
uint8_t tm1640_set_reg (tm1640_handle_t *handle, uint8_t cmd, uint8_t *data, uint8_t len)
 set the chip register

Detailed Description

driver tm1640 header file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2025-10-31

history

Date Version Author Description
2025/10/31 1.0 Shifeng Li first upload

Definition in file driver_tm1640.h.