LibDriver TM1640
Loading...
Searching...
No Matches
tm1640 basic driver function

tm1640 basic driver modules More...

Collaboration diagram for tm1640 basic driver function:

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

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

Detailed Description

tm1640 basic driver modules

Macro Definition Documentation

◆ TM1640_COMMAND_DATA_DELAY

#define TM1640_COMMAND_DATA_DELAY   1

tm1640 command data delay definition

1us

Definition at line 63 of file driver_tm1640.h.

Typedef Documentation

◆ tm1640_handle_t

tm1640 handle structure definition

◆ tm1640_info_t

typedef struct tm1640_info_s tm1640_info_t

tm1640 information structure definition

Enumeration Type Documentation

◆ tm1640_address_mode_t

tm1640 address mode enumeration definition

Enumerator
TM1640_ADDRESS_MODE_INC 

auto increment 1 mode

TM1640_ADDRESS_MODE_FIX 

fixed address mode

Definition at line 69 of file driver_tm1640.h.

◆ tm1640_bool_t

tm1640 bool enumeration definition

Enumerator
TM1640_BOOL_FALSE 

false

TM1640_BOOL_TRUE 

true

Definition at line 78 of file driver_tm1640.h.

◆ tm1640_number_t

tm1640 number enumeration definition

Enumerator
TM1640_NUMBER_0 

0

TM1640_NUMBER_1 

1

TM1640_NUMBER_2 

2

TM1640_NUMBER_3 

3

TM1640_NUMBER_4 

4

TM1640_NUMBER_5 

5

TM1640_NUMBER_6 

6

TM1640_NUMBER_7 

7

TM1640_NUMBER_8 

8

TM1640_NUMBER_9 

9

Definition at line 102 of file driver_tm1640.h.

◆ tm1640_pulse_width_t

tm1640 pulse width enumeration definition

Enumerator
TM1640_PULSE_WIDTH_1_DIV_16 

1/16

TM1640_PULSE_WIDTH_2_DIV_16 

2/16

TM1640_PULSE_WIDTH_4_DIV_16 

4/16

TM1640_PULSE_WIDTH_10_DIV_16 

10/16

TM1640_PULSE_WIDTH_11_DIV_16 

11/16

TM1640_PULSE_WIDTH_12_DIV_16 

12/16

TM1640_PULSE_WIDTH_13_DIV_16 

13/16

TM1640_PULSE_WIDTH_14_DIV_16 

14/16

Definition at line 87 of file driver_tm1640.h.

Function Documentation

◆ tm1640_clear_segment()

uint8_t tm1640_clear_segment ( tm1640_handle_t * handle)

clear segment

Parameters
[in]*handlepointer to a tm1640 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 678 of file driver_tm1640.c.

◆ tm1640_deinit()

uint8_t tm1640_deinit ( tm1640_handle_t * handle)

close the chip

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

Definition at line 365 of file driver_tm1640.c.

◆ tm1640_get_address_mode()

uint8_t tm1640_get_address_mode ( tm1640_handle_t * handle,
tm1640_address_mode_t * mode )

get address mode

Parameters
[in]*handlepointer to a tm1640 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 587 of file driver_tm1640.c.

◆ tm1640_get_display()

uint8_t tm1640_get_display ( tm1640_handle_t * handle,
tm1640_bool_t * enable )

get display status

Parameters
[in]*handlepointer to a tm1640 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 522 of file driver_tm1640.c.

◆ tm1640_get_pulse_width()

uint8_t tm1640_get_pulse_width ( tm1640_handle_t * handle,
tm1640_pulse_width_t * width )

get pulse width

Parameters
[in]*handlepointer to a tm1640 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 457 of file driver_tm1640.c.

◆ tm1640_get_test_mode()

uint8_t tm1640_get_test_mode ( tm1640_handle_t * handle,
tm1640_bool_t * enable )

get test mode status

Parameters
[in]*handlepointer to a tm1640 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 652 of file driver_tm1640.c.

◆ tm1640_info()

uint8_t tm1640_info ( tm1640_info_t * info)

get chip's information

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

Definition at line 856 of file driver_tm1640.c.

◆ tm1640_init()

uint8_t tm1640_init ( tm1640_handle_t * handle)

initialize the chip

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

Definition at line 242 of file driver_tm1640.c.

◆ tm1640_set_address_mode()

uint8_t tm1640_set_address_mode ( tm1640_handle_t * handle,
tm1640_address_mode_t mode )

set address mode

Parameters
[in]*handlepointer to a tm1640 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 549 of file driver_tm1640.c.

◆ tm1640_set_display()

uint8_t tm1640_set_display ( tm1640_handle_t * handle,
tm1640_bool_t enable )

enable or disable display

Parameters
[in]*handlepointer to a tm1640 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 484 of file driver_tm1640.c.

◆ tm1640_set_pulse_width()

uint8_t tm1640_set_pulse_width ( tm1640_handle_t * handle,
tm1640_pulse_width_t width )

set pulse width

Parameters
[in]*handlepointer to a tm1640 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 419 of file driver_tm1640.c.

◆ tm1640_set_test_mode()

uint8_t tm1640_set_test_mode ( tm1640_handle_t * handle,
tm1640_bool_t enable )

enable or disable test mode

Parameters
[in]*handlepointer to a tm1640 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 614 of file driver_tm1640.c.

◆ tm1640_write_segment()

uint8_t tm1640_write_segment ( tm1640_handle_t * handle,
uint8_t addr,
uint8_t * data,
uint8_t len )

write segment

Parameters
[in]*handlepointer to a tm1640 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 > 16
Note
none

Definition at line 749 of file driver_tm1640.c.