LibDriver TM1638  1.0.0
TM1638 full-featured driver
driver_tm1638.h File Reference

driver tm1638 header file More...

#include <stdio.h>
#include <stdint.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  tm1638_handle_s
 tm1638 handle structure definition More...
 
struct  tm1638_info_s
 tm1638 information structure definition More...
 

Macros

#define DRIVER_TM1638_LINK_INIT(HANDLE, STRUCTURE)   memset(HANDLE, 0, sizeof(STRUCTURE))
 initialize tm1638_handle_t structure More...
 
#define DRIVER_TM1638_LINK_SPI_INIT(HANDLE, FUC)   (HANDLE)->spi_init = FUC
 link spi_init function More...
 
#define DRIVER_TM1638_LINK_SPI_DEINIT(HANDLE, FUC)   (HANDLE)->spi_deinit = FUC
 link spi_deinit function More...
 
#define DRIVER_TM1638_LINK_SPI_WRITE(HANDLE, FUC)   (HANDLE)->spi_write = FUC
 link spi_write function More...
 
#define DRIVER_TM1638_LINK_SPI_READ(HANDLE, FUC)   (HANDLE)->spi_read = FUC
 link spi_read function More...
 
#define DRIVER_TM1638_LINK_DELAY_MS(HANDLE, FUC)   (HANDLE)->delay_ms = FUC
 link delay_ms function More...
 
#define DRIVER_TM1638_LINK_DEBUG_PRINT(HANDLE, FUC)   (HANDLE)->debug_print = FUC
 link debug_print function More...
 

Typedefs

typedef struct tm1638_handle_s tm1638_handle_t
 tm1638 handle structure definition More...
 
typedef struct tm1638_info_s tm1638_info_t
 tm1638 information structure definition More...
 

Enumerations

enum  tm1638_address_mode_t { TM1638_ADDRESS_MODE_INC = 0x00 , TM1638_ADDRESS_MODE_FIX = 0x01 }
 tm1638 address mode enumeration definition More...
 
enum  tm1638_bool_t { TM1638_BOOL_FALSE = 0x00 , TM1638_BOOL_TRUE = 0x01 }
 tm1638 bool enumeration definition More...
 
enum  tm1638_pulse_width_t {
  TM1638_PULSE_WIDTH_1_DIV_16 = 0x00 , TM1638_PULSE_WIDTH_2_DIV_16 = 0x01 , TM1638_PULSE_WIDTH_4_DIV_16 = 0x02 , TM1638_PULSE_WIDTH_10_DIV_16 = 0x03 ,
  TM1638_PULSE_WIDTH_11_DIV_16 = 0x04 , TM1638_PULSE_WIDTH_12_DIV_16 = 0x05 , TM1638_PULSE_WIDTH_13_DIV_16 = 0x06 , TM1638_PULSE_WIDTH_14_DIV_16 = 0x07
}
 tm1638 pulse width enumeration definition More...
 
enum  tm1638_number_t {
  TM1638_NUMBER_0 = 0x003F , TM1638_NUMBER_1 = 0x0006 , TM1638_NUMBER_2 = 0x005B , TM1638_NUMBER_3 = 0x004F ,
  TM1638_NUMBER_4 = 0x0066 , TM1638_NUMBER_5 = 0x006D , TM1638_NUMBER_6 = 0x007D , TM1638_NUMBER_7 = 0x0007 ,
  TM1638_NUMBER_8 = 0x007F , TM1638_NUMBER_9 = 0x006F
}
 tm1638 number enumeration definition More...
 

Functions

uint8_t tm1638_info (tm1638_info_t *info)
 get chip's information More...
 
uint8_t tm1638_init (tm1638_handle_t *handle)
 initialize the chip More...
 
uint8_t tm1638_clear_segment (tm1638_handle_t *handle)
 clear segment More...
 
uint8_t tm1638_deinit (tm1638_handle_t *handle)
 close the chip More...
 
uint8_t tm1638_write_segment (tm1638_handle_t *handle, uint8_t addr, uint16_t *data, uint8_t len)
 write segment More...
 
uint8_t tm1638_read_segment (tm1638_handle_t *handle, uint8_t segk[4])
 read segment More...
 
uint8_t tm1638_set_pulse_width (tm1638_handle_t *handle, tm1638_pulse_width_t width)
 set pulse width More...
 
uint8_t tm1638_get_pulse_width (tm1638_handle_t *handle, tm1638_pulse_width_t *width)
 get pulse width More...
 
uint8_t tm1638_set_display (tm1638_handle_t *handle, tm1638_bool_t enable)
 enable or disable display More...
 
uint8_t tm1638_get_display (tm1638_handle_t *handle, tm1638_bool_t *enable)
 get display status More...
 
uint8_t tm1638_set_address_mode (tm1638_handle_t *handle, tm1638_address_mode_t mode)
 set address mode More...
 
uint8_t tm1638_get_address_mode (tm1638_handle_t *handle, tm1638_address_mode_t *mode)
 get address mode More...
 
uint8_t tm1638_set_test_mode (tm1638_handle_t *handle, tm1638_bool_t enable)
 enable or disable test mode More...
 
uint8_t tm1638_get_test_mode (tm1638_handle_t *handle, tm1638_bool_t *enable)
 get test mode status More...
 
uint8_t tm1638_set_reg (tm1638_handle_t *handle, uint8_t cmd, uint8_t *data, uint8_t len)
 set the chip register More...
 
uint8_t tm1638_get_reg (tm1638_handle_t *handle, uint8_t cmd, uint8_t *data, uint8_t len)
 get the chip register More...
 

Detailed Description

driver tm1638 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
2024-03-31

history

Date Version Author Description
2024/03/31 1.0 Shifeng Li first upload

Definition in file driver_tm1638.h.