chg-stn-motherboard-ti-mcu/TM1650_SDK/inc/ivec_TM1650.h

107 lines
3.1 KiB
C

/*
* ivec_TM1650.h
*
* Created on: 16-Jul-2024
* Author: Vecmocon Technology
*/
#ifndef IVEC_TM1650_H_
#define IVEC_TM1650_H_
#include <stdint.h>
#include <stdbool.h>
#if SEV_SEG_DB == 1
#define NUM_OF_DIGITS 3
#endif
/***********************Data Command Settings enumerations***********************/
typedef enum{
TM_1650_SYSTEM_CMD = 0x48,
TM_1650_READ_KEY_CMD = 0x4F,
}TM_1650_DataCommandSettings_t;
/********************************************************************************/
/***********************System parameter setting enumerations***********************/
typedef enum {
TM_1650_BRIGHT_1 = 0x10,
TM_1650_BRIGHT_2 = 0x20,
TM_1650_BRIGHT_3 = 0x30,
TM_1650_BRIGHT_4 = 0x40,
TM_1650_BRIGHT_5 = 0x50,
TM_1650_BRIGHT_6 = 0x60,
TM_1650_BRIGHT_7 = 0x70,
TM_1650_BRIGHT_8 = 0x00,
}TM_1650_Brightness_t;
typedef enum {
TM_1650_Segment_8 = 0x00,
TM_1650_Segment_7 = 0x08,
}TM_1650_Segement_t;
typedef enum {
TM_1650_Normal_Mode = 0x00,
TM_1650_Standby_Mode = 0x04,
}TM_1650_OperatingMode_t;
typedef enum {
TM_1650_Screen_OFF = 0x00,
TM_1650_Screen_ON = 0x01,
}TM_1650_SwitchMode_t;
/***********************************************************************************/
/****************************Memory address enumerations****************************/
typedef enum {
TM_1650_DIG_1 = 0x68,
TM_1650_DIG_2 = 0x6A,
TM_1650_DIG_3 = 0x6C,
TM_1650_DIG_4 = 0x6E,
}TM_1650_Digit_t;
typedef enum {
TM_1650_DISPLAY_0 = 0x3F,
TM_1650_DISPLAY_1 = 0x06,
}TM_1650_DisplayVal_t;
typedef struct {
TM_1650_Brightness_t brightness;
TM_1650_Segement_t segment;
TM_1650_OperatingMode_t opMode;
TM_1650_SwitchMode_t switchMode;
TM_1650_Digit_t digitsToUse;
void (*dat_set_fn)(uint8_t state);
void (*clk_set_fn)(uint8_t state);
uint8_t (*read_data_fn)(void);
} tm1650_drv_t;
typedef enum{
TM1650_SUCCESS = 0,
TM1650_ERROR = 1,
TM1650_OUT_OF_BOUNDS = 2,
}TM1650_Status_T;
/******************************__________API__________******************************/
TM1650_Status_T tm1650_Init(TM_1650_Brightness_t brightness, TM_1650_Segement_t segment, \
TM_1650_OperatingMode_t opMode, TM_1650_SwitchMode_t switchMode, \
TM_1650_Digit_t digits, void (*dataPin)(), void (*clkPin)(), uint8_t (*readData)());
TM1650_Status_T tm1650_changeBrightness(TM_1650_Brightness_t brightness);
TM1650_Status_T tm1650_changeOPMode(TM_1650_OperatingMode_t opMode);
TM1650_Status_T tm1650_changeSegmentMode(TM_1650_Segement_t segment);
TM1650_Status_T tm1650_displaySwitch(TM_1650_SwitchMode_t switchMode);
TM1650_Status_T tm1650_showNum(TM_1650_Digit_t digit, uint8_t num);
TM1650_Status_T tm1650_showAlphabet(TM_1650_Digit_t digit, char * alpha);
TM1650_Status_T tm1650_showDot(TM_1650_Digit_t digit, bool dotFlag);
TM1650_Status_T tm1650_removeDot(TM_1650_Digit_t digit);
/***********************************************************************************/
#endif /* IVEC_TM1650_H_ */