Go to the source code of this file.
|
| TMP42x_Status | __TMP42x_readByte (TMP42x *self, uint8_t MemAddress) |
| | Read a byte of data from TMP42x and stores in the tmp42x::_reg8::raw_data.
|
| |
| TMP42x_Status | __TMP42x_writeByte (TMP42x *self, uint8_t MemAddress) |
| | Write a byte of data to TMP42x from the tmp42x::_reg8::raw_data.
|
| |
| TMP42x_Status | __TMP42x_readTwoBytes (TMP42x *self, uint8_t MemAddress) |
| | Read two bytes of data from TMP42x and stores in the tmp42x::_reg16::raw_data.
|
| |
| TMP42x_Status | TMP42x_init (TMP42x *self, TMP42x_Type type, I2C_HandleTypeDef *hi2c, uint8_t I2C_ADDR, TMP42x_Shutdown shutdown, TMP42x_Range range, TMP42x_ConversionRate conversion_rate, float n_eff1, float n_eff2, float n_eff3) |
| | Initialize the TMP42x with the given config.
|
| |
| double | TMP42x_getRemoteTemp (TMP42x *self, uint8_t channel_number) |
| | Reads the full (floating-point) remote temperature from a specified channel.
|
| |
| int8_t | TMP42x_getRemoteTemp_Int (TMP42x *self, uint8_t channel_number) |
| | Reads the integer part of the remote temperature from a specified channel.
|
| |
| double | TMP42x_getLocalTemp (TMP42x *self) |
| | Reads the full (floating-point) local temperature from a specified channel.
|
| |
| int8_t | TMP42x_getLocalTemp_Int (TMP42x *self) |
| | Reads the integer part of the local temperature.
|
| |
| TMP42x_Status | TMP42x_oneShotStart (TMP42x *self) |
| | Starts a single conversion if the device is in shutdown mode.
|
| |
| TMP42x_Status | TMP42x_softwareReset (TMP42x *self) |
| | Resets the device.
|
| |
| uint8_t | TMP42x_getManID (TMP42x *self) |
| | Get the manufacturer ID.
|
| |
| uint8_t | TMP42x_getDevID (TMP42x *self) |
| | Get the device ID.
|
| |
◆ __TMP42x_readByte()
Read a byte of data from TMP42x and stores in the tmp42x::_reg8::raw_data.
- Parameters
-
| self | Pointer to a TMP42x structure representing the sensor instance. |
| MemAddress | Address of the target register |
- Returns
- The status of initialization
- Return values
-
Definition at line 48 of file TMP42x.c.
◆ __TMP42x_readTwoBytes()
Read two bytes of data from TMP42x and stores in the tmp42x::_reg16::raw_data.
- Parameters
-
| self | Pointer to a TMP42x structure representing the sensor instance. |
| MemAddress | Address of the target register |
- Returns
- The status of initialization
- Return values
-
Definition at line 82 of file TMP42x.c.
◆ __TMP42x_writeByte()
Write a byte of data to TMP42x from the tmp42x::_reg8::raw_data.
- Parameters
-
| self | Pointer to a TMP42x structure representing the sensor instance. |
| MemAddress | Address of the target register |
- Returns
- The status of initialization
- Return values
-
Definition at line 65 of file TMP42x.c.
◆ TMP42x_getDevID()
| uint8_t TMP42x_getDevID |
( |
TMP42x * | self | ) |
|
Get the device ID.
- Parameters
-
| self | Pointer to a TMP42x structure representing the sensor instance. |
- Returns
- a 8bit device ID
Definition at line 331 of file TMP42x.c.
◆ TMP42x_getLocalTemp()
| double TMP42x_getLocalTemp |
( |
TMP42x * | self | ) |
|
Reads the full (floating-point) local temperature from a specified channel.
This function retrieves the temperature (in degrees Celsius) from the TMP42x sensor series. The returned value includes both integer and fractional parts.
- Parameters
-
| self | Pointer to a TMP42x structure representing the sensor instance. |
- Returns
- Temperature value in degrees Celsius as a floating-point number if successful.
Definition at line 262 of file TMP42x.c.
◆ TMP42x_getLocalTemp_Int()
| int8_t TMP42x_getLocalTemp_Int |
( |
TMP42x * | self | ) |
|
Reads the integer part of the local temperature.
This function retrieves the temperature (in degrees Celsius) from the TMP42x sensor series. It only returns the integer part of the temperature.
- Parameters
-
| self | Pointer to a TMP42x structure representing the sensor instance. |
- Returns
- Temperature value (integer part only) in degrees Celsius if successful.
Definition at line 279 of file TMP42x.c.
◆ TMP42x_getManID()
| uint8_t TMP42x_getManID |
( |
TMP42x * | self | ) |
|
Get the manufacturer ID.
- Parameters
-
| self | Pointer to a TMP42x structure representing the sensor instance. |
- Returns
- a 8bit manufacturer ID
Definition at line 320 of file TMP42x.c.
◆ TMP42x_getRemoteTemp()
| double TMP42x_getRemoteTemp |
( |
TMP42x * | self, |
|
|
uint8_t | channel_number ) |
Reads the full (floating-point) remote temperature from a specified channel.
This function retrieves the temperature (in degrees Celsius) from a specified remote channel of the TMP42x sensor series. The returned value includes both integer and fractional parts.
- Parameters
-
| self | Pointer to a TMP42x structure representing the sensor instance. |
| channel_number | Index of the remote channel to read from. Valid values are:
1 : Channel 1
2 : Channel 2 (only available on TMP422 or TMP423)
3 : Channel 3 (only available on TMP423)
|
- Returns
- Temperature value in degrees Celsius as a floating-point number if successful.
- Return values
-
| -999 | Returned if the requested channel number does not exist for the device type. |
Definition at line 217 of file TMP42x.c.
◆ TMP42x_getRemoteTemp_Int()
| int8_t TMP42x_getRemoteTemp_Int |
( |
TMP42x * | self, |
|
|
uint8_t | channel_number ) |
Reads the integer part of the remote temperature from a specified channel.
This function retrieves the temperature (in degrees Celsius) from a specified remote channel of the TMP42x sensor series. It only returns the integer part of the temperature.
- Parameters
-
| self | Pointer to a TMP42x structure representing the sensor instance. |
| channel_number | Index of the remote channel to read from. Valid values are:
1 : Channel 1
2 : Channel 2 (only available on TMP422 or TMP423)
3 : Channel 3 (only available on TMP423)
|
- Returns
- Temperature value (integer part only) in degrees Celsius if successful.
- Return values
-
| -128 | Returned if the requested channel number does not exist for the device type. |
Definition at line 244 of file TMP42x.c.
◆ TMP42x_init()
Initialize the TMP42x with the given config.
- Parameters
-
| self | Pointer to a TMP42x structure representing the sensor instance. |
| type | Chip part number.
|
| hi2c | A pointer to the I2C handler that is connected to TMP42x |
| I2C_ADDR | The I2C address of the TMP42x. It depends on the state of A0 and A1 of the chip (TMP421), DXx pins status (TMP422), or the part number (TMP423) |
| shutdown | Operating mode:
|
| range | Temperature range:
|
| conversion_rate | Rate of the temperature conversion:
- TMP42x_0_0625 0.0625 conversions per second (each 16 seconds)
- TMP42x_0_125 0.125 conversions per second (each 8 seconds)
- TMP42x_0_25 0.25 conversions per second (each 4 seconds)
- TMP42x_0_5 0.5 conversions per second (each 1 seconds)
- TMP42x_1 1 conversion per second (each second)
- TMP42x_2 2 conversions per second (each 0.5 seconds)
- TMP42x_4 4 conversions per second (each 0.25 seconds) NOTE: Conversion rate shown is for only one or two enabled measurement channels. When three channels are enabled, the conversion rate is 2 and 2/3 conversions-per-second. When four channels are enabled, the conversion rate is 2 per second.
- TMP42x_8 8 conversions per second (each 0.125 seconds) NOTE: Conversion rate shown is for only one enabled measurement channel. When two channels are enabled, the conversion rate is 4 conversions-per-second. When three channels are enabled, the conversion rate is 2 and 2/3 conversions-per-second. When four channels are enabled, the conversion rate is 2 conversions-per-second.
|
| n_eff1 | Effective n value for channel1. From 0.706542 to 1.747977. |
| n_eff2 | Effective n value for channel2 (TMP422 or TMP423). From 0.706542 to 1.747977. |
| n_eff3 | Effective n value for channel3 (TMP423). From 0.706542 to 1.747977. |
- Returns
- The status of initialization
- Return values
-
Definition at line 138 of file TMP42x.c.
◆ TMP42x_oneShotStart()
Starts a single conversion if the device is in shutdown mode.
- Parameters
-
| self | Pointer to a TMP42x structure representing the sensor instance. |
- Returns
- The status of start
- Return values
-
Definition at line 294 of file TMP42x.c.
◆ TMP42x_softwareReset()
Resets the device.
- Parameters
-
| self | Pointer to a TMP42x structure representing the sensor instance. |
- Returns
- The status of start
- Return values
-
Definition at line 309 of file TMP42x.c.