MIKROE 4-20mA RT Click
T_Click Class Reference

Class to manage a MIKROE 4-20 mA T Click Board (MIKROE-1296). More...

#include <MIKROE_4_20mA_RT_Click.h>

Public Member Functions

 T_Click (uint8_t CS_pin, const RT_Click_Calibration calib)
 Construct a new T Click object. More...
 
void set_SPI_clock (uint32_t clk_freq_Hz)
 Adjust the initially set SPI clock frequency of 1 MHz to another frequency. More...
 
void begin ()
 Start SPI and set up the cable select pin. The output current will be set to 4 mA.
 
uint16_t mA2bitval (float mA)
 Transform the current [mA] into a bit value given the calibration parameters. More...
 
void set_mA (float mA)
 Set the output current of the T Click Board in mA. More...
 
uint16_t get_last_set_bitval ()
 Return the bit value belonging to the last set current by set_mA(). More...
 

Detailed Description

Class to manage a MIKROE 4-20 mA T Click Board (MIKROE-1296).

Constructor & Destructor Documentation

◆ T_Click()

T_Click::T_Click ( uint8_t  CS_pin,
const RT_Click_Calibration  calib 
)

Construct a new T Click object.

Parameters
CS_pinCable select SPI pin
calibStructure holding the [bitval] to [mA] calibration parameters

Member Function Documentation

◆ set_SPI_clock()

void T_Click::set_SPI_clock ( uint32_t  clk_freq_Hz)

Adjust the initially set SPI clock frequency of 1 MHz to another frequency.

The maximum SPI clock frequency listed by the datasheet of the MCP4921 DAC chip of the T Click Board is 20 MHz.

Parameters
clk_freq_HzThe SPI clock frequency in Hz

◆ mA2bitval()

uint16_t T_Click::mA2bitval ( float  mA)

Transform the current [mA] into a bit value given the calibration parameters.

Parameters
mAThe current in mA
Returns
The bit value

◆ set_mA()

void T_Click::set_mA ( float  mA)

Set the output current of the T Click Board in mA.

Parameters
mAThe current to output in mA

◆ get_last_set_bitval()

uint16_t T_Click::get_last_set_bitval ( )

Return the bit value belonging to the last set current by set_mA().

Returns
The bit value

The documentation for this class was generated from the following files: