LibDriver TM1622
Loading...
Searching...
No Matches
driver_tm1622.c File Reference

driver tm1622 source file More...

#include "driver_tm1622.h"
Include dependency graph for driver_tm1622.c:

Go to the source code of this file.

Macros

#define CHIP_NAME   "Titan Micro Electronics TM1622"
 chip information definition
#define MANUFACTURER_NAME   "Titan Micro Electronics"
#define SUPPLY_VOLTAGE_MIN   2.7f
#define SUPPLY_VOLTAGE_MAX   5.2f
#define MAX_CURRENT   4.5f
#define TEMPERATURE_MIN   -20.0f
#define TEMPERATURE_MAX   85.0f
#define DRIVER_VERSION   1000
#define TM1622_COMMAND_SYS_DIS   0x00
 chip command definition
#define TM1622_COMMAND_SYS_EN   0x01
#define TM1622_COMMAND_LCD_OFF   0x02
#define TM1622_COMMAND_LCD_ON   0x03
#define TM1622_COMMAND_TIMER_DIS   0x04
#define TM1622_COMMAND_WDT_DIS   0x05
#define TM1622_COMMAND_TIMER_EN   0x06
#define TM1622_COMMAND_WDT_EN   0x07
#define TM1622_COMMAND_TONE_OFF   0x08
#define TM1622_COMMAND_TONE_ON   0x09
#define TM1622_COMMAND_CLR_TIMER   0x0D
#define TM1622_COMMAND_CLR_WDT   0x0F
#define TM1622_COMMAND_RC_32K   0x18
#define TM1622_COMMAND_EXT_32K   0x1C
#define TM1622_COMMAND_TONE_4K   0x40
#define TM1622_COMMAND_TONE_2K   0x60
#define TM1622_COMMAND_IRQ_DIS   0x80
#define TM1622_COMMAND_IRQ_EN   0x88
#define TM1622_COMMAND_F1   0xA0
#define TM1622_COMMAND_F2   0xA1
#define TM1622_COMMAND_F4   0xA2
#define TM1622_COMMAND_F8   0xA3
#define TM1622_COMMAND_F16   0xA4
#define TM1622_COMMAND_F32   0xA5
#define TM1622_COMMAND_F64   0xA6
#define TM1622_COMMAND_F128   0xA7
#define TM1622_COMMAND_TOPT   0xE0
#define TM1622_COMMAND_TNORMAL   0xE3

Functions

uint8_t tm1622_set_oscillator (tm1622_handle_t *handle, tm1622_bool_t enable)
 enable or disable oscillator
uint8_t tm1622_set_lcd_bias (tm1622_handle_t *handle, tm1622_bool_t enable)
 enable or disable lcd bias
uint8_t tm1622_set_timer (tm1622_handle_t *handle, tm1622_bool_t enable)
 enable or disable timer
uint8_t tm1622_set_watchdog (tm1622_handle_t *handle, tm1622_bool_t enable)
 enable or disable watchdog
uint8_t tm1622_set_tone (tm1622_handle_t *handle, tm1622_bool_t enable)
 enable or disable tone
uint8_t tm1622_set_irq (tm1622_handle_t *handle, tm1622_bool_t enable)
 enable or disable irq
uint8_t tm1622_clear_timer (tm1622_handle_t *handle)
 clear timer
uint8_t tm1622_clear_watchdog (tm1622_handle_t *handle)
 clear watchdog
uint8_t tm1622_set_mode (tm1622_handle_t *handle, tm1622_mode_t mode)
 set mode
uint8_t tm1622_set_clock (tm1622_handle_t *handle, tm1622_clock_t clk)
 set clock
uint8_t tm1622_set_freq (tm1622_handle_t *handle, tm1622_freq_t freq)
 set freq
uint8_t tm1622_set_tone_freq (tm1622_handle_t *handle, tm1622_tone_freq_t freq)
 set tone freq
uint8_t tm1622_init (tm1622_handle_t *handle)
 initialize the chip
uint8_t tm1622_deinit (tm1622_handle_t *handle)
 close the chip
uint8_t tm1622_write_segment (tm1622_handle_t *handle, uint8_t addr, uint8_t *data, uint8_t len)
 write segment
uint8_t tm1622_clear_segment (tm1622_handle_t *handle)
 clear segment
uint8_t tm1622_set_command (tm1622_handle_t *handle, uint16_t cmd)
 set command
uint8_t tm1622_set_data (tm1622_handle_t *handle, uint8_t addr, uint8_t *data, uint8_t len)
 set data
uint8_t tm1622_get_data (tm1622_handle_t *handle, uint8_t addr, uint8_t *data, uint8_t len)
 get data
uint8_t tm1622_read_modify_write (tm1622_handle_t *handle, uint8_t addr, void(*and_or)(uint8_t addr, uint8_t lsb_msb, uint8_t input, uint8_t *output), uint8_t len)
 read modify write
uint8_t tm1622_info (tm1622_info_t *info)
 get chip's information

Detailed Description

driver tm1622 source 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
2026-05-31

history

Date Version Author Description
2026/05/31 1.0 Shifeng Li first upload

Definition in file driver_tm1622.c.

Macro Definition Documentation

◆ CHIP_NAME

#define CHIP_NAME   "Titan Micro Electronics TM1622"

chip information definition

chip name

Definition at line 42 of file driver_tm1622.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_tm1622.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "Titan Micro Electronics"

manufacturer name

Definition at line 43 of file driver_tm1622.c.

◆ MAX_CURRENT

#define MAX_CURRENT   4.5f

chip max current

Definition at line 46 of file driver_tm1622.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   5.2f

chip max supply voltage

Definition at line 45 of file driver_tm1622.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   2.7f

chip min supply voltage

Definition at line 44 of file driver_tm1622.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   85.0f

chip max operating temperature

Definition at line 48 of file driver_tm1622.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -20.0f

chip min operating temperature

Definition at line 47 of file driver_tm1622.c.

◆ TM1622_COMMAND_CLR_TIMER

#define TM1622_COMMAND_CLR_TIMER   0x0D

clear timer command

Definition at line 64 of file driver_tm1622.c.

◆ TM1622_COMMAND_CLR_WDT

#define TM1622_COMMAND_CLR_WDT   0x0F

clear wdt command

Definition at line 65 of file driver_tm1622.c.

◆ TM1622_COMMAND_EXT_32K

#define TM1622_COMMAND_EXT_32K   0x1C

ext 32k command

Definition at line 67 of file driver_tm1622.c.

◆ TM1622_COMMAND_F1

#define TM1622_COMMAND_F1   0xA0

f1 command

Definition at line 72 of file driver_tm1622.c.

◆ TM1622_COMMAND_F128

#define TM1622_COMMAND_F128   0xA7

f128 command

Definition at line 79 of file driver_tm1622.c.

◆ TM1622_COMMAND_F16

#define TM1622_COMMAND_F16   0xA4

f16 command

Definition at line 76 of file driver_tm1622.c.

◆ TM1622_COMMAND_F2

#define TM1622_COMMAND_F2   0xA1

f2 command

Definition at line 73 of file driver_tm1622.c.

◆ TM1622_COMMAND_F32

#define TM1622_COMMAND_F32   0xA5

f32 command

Definition at line 77 of file driver_tm1622.c.

◆ TM1622_COMMAND_F4

#define TM1622_COMMAND_F4   0xA2

f4 command

Definition at line 74 of file driver_tm1622.c.

◆ TM1622_COMMAND_F64

#define TM1622_COMMAND_F64   0xA6

f64 command

Definition at line 78 of file driver_tm1622.c.

◆ TM1622_COMMAND_F8

#define TM1622_COMMAND_F8   0xA3

f8 command

Definition at line 75 of file driver_tm1622.c.

◆ TM1622_COMMAND_IRQ_DIS

#define TM1622_COMMAND_IRQ_DIS   0x80

irq disable command

Definition at line 70 of file driver_tm1622.c.

◆ TM1622_COMMAND_IRQ_EN

#define TM1622_COMMAND_IRQ_EN   0x88

irq enable command

Definition at line 71 of file driver_tm1622.c.

◆ TM1622_COMMAND_LCD_OFF

#define TM1622_COMMAND_LCD_OFF   0x02

lcd off command

Definition at line 56 of file driver_tm1622.c.

◆ TM1622_COMMAND_LCD_ON

#define TM1622_COMMAND_LCD_ON   0x03

lcd on command

Definition at line 57 of file driver_tm1622.c.

◆ TM1622_COMMAND_RC_32K

#define TM1622_COMMAND_RC_32K   0x18

rc 32k command

Definition at line 66 of file driver_tm1622.c.

◆ TM1622_COMMAND_SYS_DIS

#define TM1622_COMMAND_SYS_DIS   0x00

chip command definition

system disable command

Definition at line 54 of file driver_tm1622.c.

◆ TM1622_COMMAND_SYS_EN

#define TM1622_COMMAND_SYS_EN   0x01

system enable command

Definition at line 55 of file driver_tm1622.c.

◆ TM1622_COMMAND_TIMER_DIS

#define TM1622_COMMAND_TIMER_DIS   0x04

timer disable command

Definition at line 58 of file driver_tm1622.c.

◆ TM1622_COMMAND_TIMER_EN

#define TM1622_COMMAND_TIMER_EN   0x06

timer enable command

Definition at line 60 of file driver_tm1622.c.

◆ TM1622_COMMAND_TNORMAL

#define TM1622_COMMAND_TNORMAL   0xE3

normal command

Definition at line 81 of file driver_tm1622.c.

◆ TM1622_COMMAND_TONE_2K

#define TM1622_COMMAND_TONE_2K   0x60

tone 2k command

Definition at line 69 of file driver_tm1622.c.

◆ TM1622_COMMAND_TONE_4K

#define TM1622_COMMAND_TONE_4K   0x40

tone 4k command

Definition at line 68 of file driver_tm1622.c.

◆ TM1622_COMMAND_TONE_OFF

#define TM1622_COMMAND_TONE_OFF   0x08

tone off command

Definition at line 62 of file driver_tm1622.c.

◆ TM1622_COMMAND_TONE_ON

#define TM1622_COMMAND_TONE_ON   0x09

tone on command

Definition at line 63 of file driver_tm1622.c.

◆ TM1622_COMMAND_TOPT

#define TM1622_COMMAND_TOPT   0xE0

test command

Definition at line 80 of file driver_tm1622.c.

◆ TM1622_COMMAND_WDT_DIS

#define TM1622_COMMAND_WDT_DIS   0x05

wdt disable command

Definition at line 59 of file driver_tm1622.c.

◆ TM1622_COMMAND_WDT_EN

#define TM1622_COMMAND_WDT_EN   0x07

wdt enable command

Definition at line 61 of file driver_tm1622.c.