/* * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ #ifndef __HT16C21_H__ #define __HT16C21_H__ #ifdef __cplusplus extern "C" { #endif #include "driver/i2c.h" #include "i2c_bus.h" #define HT16C21_I2C_ADDRESS_DEFAULT (0x70) #define WRITE_BIT I2C_MASTER_WRITE /*!< I2C master write */ #define READ_BIT I2C_MASTER_READ /*!< I2C master read */ #define ACK_CHECK_EN 0x1 /*!< I2C master will check ack from slave*/ #define ACK_CHECK_DIS 0x0 /*!< I2C master will not check ack from slave */ #define ACK_VAL 0x0 /*!< I2C ack value */ #define NACK_VAL 0x1 /*!< I2C nack value */ typedef enum { HT16C21_CMD_IOOUT = 0x80, /*!< Command to set as configuration Display Data RAM*/ HT16C21_CMD_DRIMO = 0x82, /*!< Command to set as Configuration device mode*/ HT16C21_CMD_SYSMO = 0x84, /*!< Command to set as Configuration system mode*/ HT16C21_CMD_FRAME = 0x86, /*!< Command to set as Configuration frame frequency*/ HT16C21_CMD_BLINK = 0x88, /*!< Command to set as Configuration blinking frequency*/ HT16C21_CMD_IVA = 0x8a, /*!< Command to set as Configuration internal voltage adjustment (IVA) setting*/ } ht16c21_cmd_t; typedef enum { HT16C21_4DUTY_3BIAS = 0x00, /*!< The drive mode 1/4 duty output and 1/3 bias is selected.*/ HT16C21_4DUTY_4BIAS = 0x01, /*!< The drive mode 1/4 duty output and 1/4 bias is selected.*/ HT16C21_8DUTY_3BIAS = 0x02, /*!< The drive mode 1/8 duty output and 1/3 bias is selected.*/ HT16C21_8DUTY_4BIAS = 0x03, /*!< The drive mode 1/8 duty output and 1/4 bias is selected.*/ } ht16c21_duty_bias_t; typedef enum { HT16C21_OSCILLATOR_OFF_DISPLAY_OFF = 0x00, /*!< Display off and disable the internal system oscillator.*/ HT16C21_OSCILLATOR_ON_DISPLAY_OFF = 0x02, /*!< Display off and enable the internal system oscillator.*/ HT16C21_OSCILLATOR_ON_DISPLAY_ON = 0x03, /*!< Display on and enable the internal system oscillator.*/ } ht16c21_oscillator_display_t; typedef enum { HT16C21_FRAME_80HZ = 0x00, /*!< Frame frequency is set to 80Hz.*/ HT16C21_FRAME_160HZ = 0x01, /*!< Frame frequency is set to 160Hz.*/ } ht16c21_frame_frequency_t; typedef enum { HT16C21_BLINKING_OFF = 0x00, /*!< Blinking function is switched off.*/ HT16C21_BLINKING_2HZ = 0x01, /*!< Blinking function is set to 2HZ.*/ HT16C21_BLINKING_1HZ = 0x02, /*!< Blinking function is set to 1HZ.*/ HT16C21_BLINKING_5HZ = 0x03, /*!< Blinking function is set to 0.5HZ.*/ } ht16c21_blinking_frequency_t; typedef enum { HT16C21_VLCD_PIN_VOL_ADJ_OFF = 0x00, /*!< The Segment/VLCD pin is set as the VLCD pin. Disable the internal voltage adjustment function One external resister must be connected between VLCD pin and VDD pin to determine the bias voltage,and internal voltage follower (OP4) must be enabled by setting the DA3~DA0 bits as the value other than “0000”. If the VLCD pin is connected to the VDD pin, the internal voltage follower (OP4) must be disabled by setting the DA3~DA0 bits as “0000”..*/ HT16C21_VLCD_PIN_VOL_ADJ_ON = 0x10,/*!< The Segment/VLCD pin is set as the VLCD pin. Enable the internal voltage adjustment function. The VLCD pin is an output pin of which the voltage can be detected by the external MCU host.*/ HT16C21_SEGMENT_PIN_VOL_ADJ_OFF = 0x20, /*!< The Segment/VLCD pin is set as the Segment pin. Disable the internal voltage adjustment function. The bias voltage is supplied by the internal VDD power.The internal voltage-follower (OP4) is disabled automatically and DA3~DA0 don’t care.*/ HT16C21_SEGMENT_PIN_VOL_ADJ_ON = 0x30,/*!