SLVUCN6 February   2023 TPS274C65

 

  1.   Abstract
  2. 1Description
  3. 2Get Started
  4. 3Features
  5. 4Applications
  6. 5Introduction
  7. 6TPS274C65 Configurator Software
    1. 6.1 Software Usage
    2. 6.2 Header File
  8. 7Hardware Design Files
    1. 7.1 Schematics
    2. 7.2 PCB Layouts
  9. 8Bill of Materials (BOM)
  10. 9Additional Information
    1. 9.1 Trademarks

Header File

A header files written in C is available to use with TPS274C65 software development. This header file was generated from the register map of the TPS274C65's datasheet and allows the user to configure and control every bit in the TPS274C65's configuration space. This header file can be found on the TPS274C65's product page.

Each register address is defined using a #define with a description of the register. The SW_STATE example can be seen below:

/* --------- TPS274C65_SW_STATE (0x1D) ----------*/
/* DESCRIPTION: The register sets the switch state (ON/OFF) of each output 
 *             channel. The switch state bits in the SPI frame are ignored when a write 
 *             to this register is performed (only the contents of the DATA_IN field 
 *             of the SPI frame are used to update the switch state) */

#define TPS274C65_SW_STATE_REG 0x1D

Additionally, a union is defined for each register address that allows the user to access the register's contents either in bit-wise or byte-wise. The struct definition for the SW_STATE register can be seen below.

typedef union 
{
    uint8_t byte;
    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;
        /* Set this bit to 1 to turn on the FET and CH3 output ON */
        unsigned CH3_ON : 1;
        /* Set this bit to 1 to turn on the FET and CH4 output ON */
        unsigned CH4_ON : 1;
        /* Reserved */
        unsigned RESERVED_30 : 4;
    } bits;
} TPS274C65_SW_STATE;

An example of using the bit-wise operation to set CH1 to enabled can be seen below:

#include "tps274c65.h"
#include <stdio.h>

int main()
{
    TPS274C65_SW_STATE enableReg;
    
    enableReg.bits.CH1_ON = 1;

    printf("\nChannel Enable: 0x%x\n", enableReg.byte);

    return 0;
}

… while a byte-wise example can be seen below:

#include "tps274c65.h"
#include <stdio.h>

int main()
{
    TPS274C65_SW_STATE enableReg;
    
    enableReg.byte = 0x01;

    printf("\nChannel Enable: 0x%x\n", enableReg.byte);

    return 0;
}