ZHCUBF4B August 2023 – January 2024 TPS2HCS10-Q1
Smart Fuse Configurator 附带 C 头文件,该文件是根据每个受支持的高侧开关的寄存器映射生成的。最初,这包括 TPS2HCS10-Q1 器件。头文件可在米6体育平台手机版_好二三四页面上找到,并包含以下功能:
此头文件旨在用于支持嵌入式 C 平台上的软件开发。SW_STATE 寄存器的摘录如下所示。
/* --------- TPS2HC10S_SW_STATE (0x07) ----------*/
/* DESCRIPTION: */
#define TPS2HC10S_SW_STATE_REG 0x07
typedef union
{
uint16_t bytes;
struct
{
/* Set this bit to 1 to turn on the FET and CH1 output ON */
unsigned CH1_ON : 1;
/* Set this bit to 1 to turn on the FET and CH2 output ON */
unsigned CH2_ON : 1;
/* Reserved */
unsigned RESERVED_14 : 14;
} bits;
} TPS2HC10S_SW_STATE;
#define TPS2HC10S_SW_STATE_CH1_ON_MASK 0x01
#define TPS2HC10S_SW_STATE_CH1_ON_OFS 0
typedef enum {
ch1_on_en_1_0x1 = 0x1,
ch1_on_en_2_0x3 = 0x3,
} ch1_on_t;
#define TPS2HC10S_SW_STATE_CH2_ON_MASK 0x02
#define TPS2HC10S_SW_STATE_CH2_ON_OFS 1
typedef enum {
ch2_on_en_1_0x1 = 0x2,
ch2_on_en_2_0x2 = 0x4,
} ch2_on_t;
使用按位操作将 CH1 设置为启用的示例如下所示。
int main()
{
TPS2HC10S_SW_STATE enableReg;
enableReg.bits.CH1_ON = 1;
printf("\nChannel Enable: 0x%x\n", enableReg.byte);
return 0;
}
按字节操作的示例如下所示。
#include "tps2hcs10.h"
#include <stdio.h>
int main()
{
TPS2HC10S_SW_STATE enableReg;
enableReg.byte = 0x01;
printf("\nChannel Enable: 0x%x\n", enableReg.byte);
return 0;
}