Class HalfBridge

Class Documentation

class btn99x0::HalfBridge

Public Functions

HalfBridge(ic_variant_t ic_variant, io_pins_t io_pins, hw_conf_t hw_conf)

BTN99x0 Half Bridge Constructor.

Parameters
  • ic_variant[in] IC product variant

  • io_pins[in] IC controller connected pins (inhibit, input and current sense)

  • hw_conf[in] Hardware configuration and experimental parameters

Pre

None

~HalfBridge()

BTN99x0 Half Bridge Destructor.

Pre

None

void begin()

Initializes the device.

Calculates the offset current on the current sense ADC input port

Pre

None

void disable()

Disables the device output setting it to high impedance.

Set the inhibit pin low

Pre

None

void enable()

Enables the device output.

Sets the inhibit pin high

Pre

None

void set_pwm(uint8_t duty)

Sets a PWM signal in the output for the given duty cycle.

The PWM signal is provided at the half-bridge input pin

Parameters

duty[in] Duty cycle in range from 0 to 255

Pre

None

void set_pwm_in_percentage(uint8_t duty_in_pct)

Sets a PWM signal in the output for the given duty cycle.

The PWM signal is provided at the half-bridge input pin

Parameters

duty_in_pct[in] Duty cycle in percentage from 0 % to 100 %

Pre

None

error_t set_slew_rate(slew_rate_level_t sr_level)

Sets slew rate level.

The slew level is configured by making a pulse sequence at the input pin while the inhibit pin is set to low. The number of pulses determine the level of the slew rate. Find more information in the section “4.4.2 Adjustable

slew rate” in page 23 of the BTN99x0 datasheet (Rev. 1.0)

Warning

The current operation requires the device to be in slew rate selection mode, meaning the INH pin to be set to low. The function operates the INPUT pin, any PWM value previously configured will be overwritten

Parameters

re_level[in] Slew rate level

Pre

begin() and disable() if the half bridge has been previously enabled

Returns

Error code

Returns

  • INVALID_OPERATION_ERROR – if the half bridge inhibit pin is not LOW

  • NO_ERROR – if the half-bridge is operating properly

void set_ktis(float ktis_amps_per_kelvin)

Sets the k_TIS constant.

The k_TIS constant is used to calculate the chip temperature. Find out more in the datasheet about how to experimentally measure the constant value for your system setup

Parameters

ktis_amps_per_kelvin[in] K_TIS experimental constant

Pre

None

void set_dk(uint16_t dk)

Sets the dk constant.

The dk constant is used to calculate the load current. Find out more in the datasheet about how to experimentally measure the constant value for your system setup

Parameters

dk[in] Differential current sense ratio

Pre

None

double get_load_current_in_amps()

Gets load current in amperes.

Returns

Load current in amperes

Pre

begin()

double get_temperature_in_kelvin()

Gets the device temperature in kelvin.

Warning

The current operation requires the device to be in slew rate selection mode, meaning the INH pin to be set to low. The function operates the INPUT pin, any PWM value previously configured will be overwritten

Pre

begin() and disable() if the half bridge has been previously enabled

Returns

Temperature in kelvin

Returns

Negative – value. INVALID_OPERATION_ERROR if the half bridge inhibit pin is not LOW

error_t get_diagnosis()

Checks if there is any failure in the half-bridge.

Check if the current at the sense resistor is above the fault current threshold. Find more information about extended diagnosis functionalities in the datasheet

Returns

Error code

Pre

begin()

Returns

  • FAULT_CURRENT_ERROR – if error

  • NO_ERROR – if the half-bridge is operating properly