LibDriver TM1638  1.0.0
TM1638 full-featured driver
tm1638 basic driver function

tm1638 basic driver modules More...

Data Structures

struct  tm1638_handle_s
 tm1638 handle structure definition More...
 
struct  tm1638_info_s
 tm1638 information structure definition 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...
 

Detailed Description

tm1638 basic driver modules

Typedef Documentation

◆ tm1638_handle_t

tm1638 handle structure definition

◆ tm1638_info_t

typedef struct tm1638_info_s tm1638_info_t

tm1638 information structure definition

Enumeration Type Documentation

◆ tm1638_address_mode_t

tm1638 address mode enumeration definition

Enumerator
TM1638_ADDRESS_MODE_INC 

auto increment 1 mode

TM1638_ADDRESS_MODE_FIX 

fixed address mode

Definition at line 62 of file driver_tm1638.h.

◆ tm1638_bool_t

tm1638 bool enumeration definition

Enumerator
TM1638_BOOL_FALSE 

false

TM1638_BOOL_TRUE 

true

Definition at line 71 of file driver_tm1638.h.

◆ tm1638_number_t

tm1638 number enumeration definition

Enumerator
TM1638_NUMBER_0 

0

TM1638_NUMBER_1 

1

TM1638_NUMBER_2 

2

TM1638_NUMBER_3 

3

TM1638_NUMBER_4 

4

TM1638_NUMBER_5 

5

TM1638_NUMBER_6 

6

TM1638_NUMBER_7 

7

TM1638_NUMBER_8 

8

TM1638_NUMBER_9 

9

Definition at line 95 of file driver_tm1638.h.

◆ tm1638_pulse_width_t

tm1638 pulse width enumeration definition

Enumerator
TM1638_PULSE_WIDTH_1_DIV_16 

1/16

TM1638_PULSE_WIDTH_2_DIV_16 

2/16

TM1638_PULSE_WIDTH_4_DIV_16 

4/16

TM1638_PULSE_WIDTH_10_DIV_16 

10/16

TM1638_PULSE_WIDTH_11_DIV_16 

11/16

TM1638_PULSE_WIDTH_12_DIV_16 

12/16

TM1638_PULSE_WIDTH_13_DIV_16 

13/16

TM1638_PULSE_WIDTH_14_DIV_16 

14/16

Definition at line 80 of file driver_tm1638.h.

Function Documentation

◆ tm1638_clear_segment()

uint8_t tm1638_clear_segment ( tm1638_handle_t handle)

clear segment

Parameters
[in]*handlepointer to a tm1638 handle structure
Returns
status code
  • 0 success
  • 1 clear segment failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 515 of file driver_tm1638.c.

◆ tm1638_deinit()

uint8_t tm1638_deinit ( tm1638_handle_t handle)

close the chip

Parameters
[in]*handlepointer to a tm1638 handle structure
Returns
status code
  • 0 success
  • 1 spi deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 power down failed
Note
none

Definition at line 209 of file driver_tm1638.c.

◆ tm1638_get_address_mode()

uint8_t tm1638_get_address_mode ( tm1638_handle_t handle,
tm1638_address_mode_t mode 
)

get address mode

Parameters
[in]*handlepointer to a tm1638 handle structure
[out]*modepointer to an address mode buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 424 of file driver_tm1638.c.

◆ tm1638_get_display()

uint8_t tm1638_get_display ( tm1638_handle_t handle,
tm1638_bool_t enable 
)

get display status

Parameters
[in]*handlepointer to a tm1638 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 359 of file driver_tm1638.c.

◆ tm1638_get_pulse_width()

uint8_t tm1638_get_pulse_width ( tm1638_handle_t handle,
tm1638_pulse_width_t width 
)

get pulse width

Parameters
[in]*handlepointer to a tm1638 handle structure
[out]*widthpointer to a pulse width buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 294 of file driver_tm1638.c.

◆ tm1638_get_test_mode()

uint8_t tm1638_get_test_mode ( tm1638_handle_t handle,
tm1638_bool_t enable 
)

get test mode status

Parameters
[in]*handlepointer to a tm1638 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 489 of file driver_tm1638.c.

◆ tm1638_info()

uint8_t tm1638_info ( tm1638_info_t info)

get chip's information

Parameters
[out]*infopointer to a tm1638 info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 801 of file driver_tm1638.c.

◆ tm1638_init()

uint8_t tm1638_init ( tm1638_handle_t handle)

initialize the chip

Parameters
[in]*handlepointer to a tm1638 handle structure
Returns
status code
  • 0 success
  • 1 spi initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
Note
none

Definition at line 144 of file driver_tm1638.c.

◆ tm1638_read_segment()

uint8_t tm1638_read_segment ( tm1638_handle_t handle,
uint8_t  segk[4] 
)

read segment

Parameters
[in]*handlepointer to a tm1638 handle structure
[out]*segkpointer to a segk buffer
Returns
status code
  • 0 success
  • 1 read segment failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 693 of file driver_tm1638.c.

◆ tm1638_set_address_mode()

uint8_t tm1638_set_address_mode ( tm1638_handle_t handle,
tm1638_address_mode_t  mode 
)

set address mode

Parameters
[in]*handlepointer to a tm1638 handle structure
[in]modeaddress mode
Returns
status code
  • 0 success
  • 1 set address mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 386 of file driver_tm1638.c.

◆ tm1638_set_display()

uint8_t tm1638_set_display ( tm1638_handle_t handle,
tm1638_bool_t  enable 
)

enable or disable display

Parameters
[in]*handlepointer to a tm1638 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set display failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 321 of file driver_tm1638.c.

◆ tm1638_set_pulse_width()

uint8_t tm1638_set_pulse_width ( tm1638_handle_t handle,
tm1638_pulse_width_t  width 
)

set pulse width

Parameters
[in]*handlepointer to a tm1638 handle structure
[in]widthpulse width
Returns
status code
  • 0 success
  • 1 set pulse width failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 256 of file driver_tm1638.c.

◆ tm1638_set_test_mode()

uint8_t tm1638_set_test_mode ( tm1638_handle_t handle,
tm1638_bool_t  enable 
)

enable or disable test mode

Parameters
[in]*handlepointer to a tm1638 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set test mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 451 of file driver_tm1638.c.

◆ tm1638_write_segment()

uint8_t tm1638_write_segment ( tm1638_handle_t handle,
uint8_t  addr,
uint16_t *  data,
uint8_t  len 
)

write segment

Parameters
[in]*handlepointer to a tm1638 handle structure
[in]addrstart address
[in]*datapointer to a data buffer
[in]lendata length
Returns
status code
  • 0 success
  • 1 write segment failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 addr + len > 8
Note
none

Definition at line 603 of file driver_tm1638.c.