|
MAVRK Embedded Software 0.91
Software Libraries for the MAVRK motherboard and related components
|
Perform interactions with the TMP103 via the I2C bus. More...
#include "MAVRK_Arch.h"#include "stdef.h"#include "F5137_system.h"#include "F5137_usci.h"#include "PC_Interface.h"#include "F5137_Modular_EVM_IO.h"#include "F5438_system.h"#include "F5438_usci_Defs.h"#include "F5438_usci.h"#include "F5438_ProMB_Modular_EVM_IO.h"#include "TMP103_Temp_Sensor.h"#include "I2C_Functions.h"#include "MAVRK_Return_Error_Codes.h"Functions | |
| unsigned char | mvk_Read_TMP103_register (unsigned char pointer, unsigned char *read_data, unsigned char device_slot, unsigned int I2C_device_address) |
| Reads values out of the indicated hardware register on the TMP103 Temp Sensor at the given I2C slave address. | |
| unsigned char | mvk_Write_TMP103_register (unsigned char pointer, unsigned char *write_data, unsigned char device_slot, unsigned int I2C_device_address) |
| Write a value to an I2C register in the TMP103 Keypad Scan Device. | |
| unsigned char | mvk_Init_TMP103 (unsigned char device_slot, unsigned int I2C_device_address) |
| Intialize TMP103 Temp Sensor Device. | |
| unsigned char | mvk_Set_TMP103_Low_Level_Alert_Temperature (signed char low_level_alert_temp, unsigned char device_slot, unsigned int I2C_device_address) |
| Set the TMP103 Temp Sensor Device Low Level Temperature Alert value. | |
| unsigned char | mvk_Get_TMP103_Low_Level_Alert_Temperature (signed char *low_level_alert_temp, unsigned char device_slot, unsigned int I2C_device_address) |
| Gets the TMP103 Temp Sensor Device Low Level Alert Temperature value. | |
| unsigned char | mvk_Set_TMP103_High_Level_Alert_Temperature (signed char high_level_alert_temp, unsigned char device_slot, unsigned int I2C_device_address) |
| Set the TMP103 Temp Sensor Device High Level Temperature Alert value. | |
| unsigned char | mvk_Get_TMP103_High_Level_Alert_Temperature (signed char *high_level_alert_temp, unsigned char device_slot, unsigned int I2C_device_address) |
| Gets the TMP103 Temp Sensor Device High Level Alert Temperature value. | |
| unsigned char | mvk_Set_TMP103_Operational_Mode (unsigned char operational_mode, unsigned char device_slot, unsigned int I2C_device_address) |
| Set the operational mode of the TMP103 Temp Sensor. | |
| unsigned char | mvk_Get_TMP103_Mode (unsigned char *operational_mode, unsigned char device_slot, unsigned int I2C_device_address) |
| Get the TMP103 Temp Sensor operational mode. | |
| unsigned char | mvk_Trigger_TMP103_One_Shot_Temperature_Measurement (unsigned char device_slot, unsigned int I2C_device_address) |
| Initiates a single(one-shot) TMP103 temperature measurement. | |
| unsigned char | mvk_Set_TMP103_Conversion_Rate (unsigned char conversion_rate, unsigned char device_slot, unsigned int I2C_device_address) |
| Set the TMP103 temp sensor conversion rate. | |
| unsigned char | mvk_Get_TMP103_Conversion_Rate (unsigned char *conversion_rate, unsigned char device_slot, unsigned int I2C_device_address) |
| Get the TMP103 Temp Sensor conversion rate. | |
| unsigned char | mvk_Set_TMP103_Sleep_Enable (unsigned char mode, unsigned char device_slot, unsigned int I2C_device_address) |
| Sets the TMP103 Sleep Function. | |
| unsigned char | mvk_Read_TMP103_Temperature (unsigned char *temperature, unsigned char device_slot, unsigned int I2C_device_address) |
| Read the TMP103 Temp Sensor temperature register. | |
| signed char | mvk_Convert_To_Celsius (signed int data) |
| Convert an TMP103 register temperature value into degrees Celsius. | |
| unsigned int | mvk_Convert_Celsius_To_Fahrenheit (unsigned int data) |
| Convert an integer Celsius vlaue into an interger Farenheit value. | |
| signed char | mvk_Convert_TMP103_Celsius_Temperature_To_Threshold (signed char temp_data) |
| Convert a celsius temperature into a threshold value used in the TMP103 Temp Sensor. | |
| void | mvk_Format_TMP103_Temperature_To_PrintF (signed int temp_data, signed char *temp_result_pointer) |
| Convert a celsius temperature from the TMP103 Temp Sensor register into ASCII string. | |
| signed char | mvk_Convert_TMP103_ASCII_Number (unsigned char *ASCII_number) |
| Converts a string of ASCII values into a signed char. | |
Variables | |
| volatile unsigned char | TMP103_Configuration = 0000 |
| volatile TMP103_Configuration_register_type * | TMP103_Configuration_register = (TMP103_Configuration_register_type*) &TMP103_Configuration |
| I2C_Device_Parameter_type | TMP103_I2C_Device_Default_Settings = {I2C_100_KHZ, I2C_7_BIT_ADDRESS, NULL} |
| volatile unsigned char | TMP103_Last_Operational_Mode |
Perform interactions with the TMP103 via the I2C bus.
The TMP103_Temp_Sensor functions initialize and configure the various settings in the TMP112 Temp Sensor devices.
| unsigned int mvk_Convert_Celsius_To_Fahrenheit | ( | unsigned int | data | ) |
Convert an integer Celsius vlaue into an interger Farenheit value.
| [in] | data | Temperature value in celsius (in degrees) |
| signed char mvk_Convert_TMP103_ASCII_Number | ( | unsigned char * | ASCII_number | ) |
Converts a string of ASCII values into a signed char.
This function converts a three character string of ASCII value into a signed char without requiring the string functions.
| [in] | ASCII_number | ASCII string to convert. (-99 to 999) |
| signed char mvk_Convert_TMP103_Celsius_Temperature_To_Threshold | ( | signed char | temp_data | ) |
Convert a celsius temperature into a threshold value used in the TMP103 Temp Sensor.
This function takes a celsius input and converts the value into a configuration used by the TMP103 Temperateure Sensors register setting.
| [in] | temp_data | Temperature setting for the threshold in celsius (1 degree LSB) |
| signed char mvk_Convert_To_Celsius | ( | signed int | data | ) |
Convert an TMP103 register temperature value into degrees Celsius.
| [in] | data | Temperature value from a TMP103 register with temperature present |
| void mvk_Format_TMP103_Temperature_To_PrintF | ( | signed int | temp_data, |
| signed char * | temp_result_pointer | ||
| ) |
Convert a celsius temperature from the TMP103 Temp Sensor register into ASCII string.
This function takes a TMP103 Temp Sensor register setting and converts it into a celsius value (LSB 1 degree) with a + or - sign in the first character position as appropriate. The reusltant value (3 bytes) is written to the output pointer position.
| [in] | temp_data | Temperature setting for the threshold in celsius (1 degree LSB) |
| [out] | temp_result_pointer | Pointer to a 3 byte string to place the sign and 2 ASCII numbers for degrees celsius |
| unsigned char mvk_Get_TMP103_Conversion_Rate | ( | unsigned char * | conversion_rate, |
| unsigned char | device_slot, | ||
| unsigned int | I2C_device_address | ||
| ) |
Get the TMP103 Temp Sensor conversion rate.
This function reads the TMP103 Temperateure Sensor continuous conversion rate register value.
| [out] | conversion_rate | TMP103 rate of temperature conversions ( _POINT_25_HZ_RATE, _1_HZ_RATE, _4_HZ_RATE, _8_HZ_RATE) |
| [in] | device_slot | Defines slot where TMP103 device is located |
| [in] | I2C_device_address | TMP103 I2C slave address |
| unsigned char mvk_Get_TMP103_High_Level_Alert_Temperature | ( | signed char * | high_level_alert_temp, |
| unsigned char | device_slot, | ||
| unsigned int | I2C_device_address | ||
| ) |
Gets the TMP103 Temp Sensor Device High Level Alert Temperature value.
This function reads the register containing the high level alert temperature value. When the TMP103 senses a temperateure lower than the high level alert value, the high level alert flag is set in the TMP103 configuration/status register
| [out] | high_level_alert_temp | Temperature value(celsius) below which triggers a TMP103 high temp alert flag |
| [in] | device_slot | Defines slot where TMP103 device is located |
| [in] | I2C_device_address | TMP103 I2C slave address |
| unsigned char mvk_Get_TMP103_Low_Level_Alert_Temperature | ( | signed char * | low_level_alert_temp, |
| unsigned char | device_slot, | ||
| unsigned int | I2C_device_address | ||
| ) |
Gets the TMP103 Temp Sensor Device Low Level Alert Temperature value.
This function reads the register containing the low level alert temperature value. When the TMP103 senses a temperateure lower than the low level alert value, the low level alert flag is set in the TMP103 configuration/status register
| [out] | low_level_alert_temp | Temperature value(celsius) below which triggers a TMP103 low temp alert flag |
| [in] | device_slot | Defines slot where TMP103 device is located |
| [in] | I2C_device_address | TMP103 I2C slave address |
| unsigned char mvk_Get_TMP103_Mode | ( | unsigned char * | operational_mode, |
| unsigned char | device_slot, | ||
| unsigned int | I2C_device_address | ||
| ) |
Get the TMP103 Temp Sensor operational mode.
This function reads the TMP103 Temperature Sensor operational mode register value.
| [out] | operational_mode | Operational mode of TMP103 device (TMP103_SHUTDOWN, TMP103_CONTINUOUS_CONVERSION) |
| [in] | device_slot | Defines slot where TMP103 device is located |
| [in] | I2C_device_address | TMP103 I2C slave address |
| unsigned char mvk_Init_TMP103 | ( | unsigned char | device_slot, |
| unsigned int | I2C_device_address | ||
| ) |
Intialize TMP103 Temp Sensor Device.
This function writes all required TMP103 registers with configuration data to enable operation of the TMP103 Temperateure Sensors.
| [in] | device_slot | Defines slot where TMP103 device is located |
| [in] | I2C_device_address | TMP103 I2C slave address |
| unsigned char mvk_Read_TMP103_register | ( | unsigned char | pointer, |
| unsigned char * | read_data, | ||
| unsigned char | device_slot, | ||
| unsigned int | I2C_device_address | ||
| ) |
Reads values out of the indicated hardware register on the TMP103 Temp Sensor at the given I2C slave address.
The function will handle the I2C Communications to read a register out of the TMP103 devices
| [in] | pointer | TMP103 register address to be read |
| [out] | read_data | Pointer to variable where data read from TMP103 register is stored |
| [in] | device_slot | Defines slot where TMP103 device is located on the MB-PRO-MVK motherboard |
| [in] | I2C_device_address | TMP103 I2C slave address |
| unsigned char mvk_Read_TMP103_Temperature | ( | unsigned char * | temperature, |
| unsigned char | device_slot, | ||
| unsigned int | I2C_device_address | ||
| ) |
Read the TMP103 Temp Sensor temperature register.
This function reads the TMP103 temperature register
| [out] | temperature | Pointer to the location to place the temperature value from the TMP103 |
| [in] | device_slot | Defines slot where TMP103 device is located |
| [in] | I2C_device_address | TMP103 I2C slave address |
| unsigned char mvk_Set_TMP103_Conversion_Rate | ( | unsigned char | conversion_rate, |
| unsigned char | device_slot, | ||
| unsigned int | I2C_device_address | ||
| ) |
Set the TMP103 temp sensor conversion rate.
This function writes the register used to set the temperature conversion rate.
| [in] | conversion_rate | Rate of TMP103 temperature conversions ( _POINT_25_HZ_RATE, _1_HZ_RATE, _4_HZ_RATE, _8_HZ_RATE) |
| [in] | device_slot | Defines slot where TMP103 device is located |
| [in] | I2C_device_address | TMP103 I2C slave address |
| unsigned char mvk_Set_TMP103_High_Level_Alert_Temperature | ( | signed char | high_level_alert_temp, |
| unsigned char | device_slot, | ||
| unsigned int | I2C_device_address | ||
| ) |
Set the TMP103 Temp Sensor Device High Level Temperature Alert value.
This function writes the register containing the high level alert temperature value. When the TMP103 senses a temperateure greater than the high level alert value, the high level alert flag is set in the TMP103 configuration/status register
| [in] | high_level_alert_temp | Temperature value(celsius) above which triggers a TMP103 high temp alert flag |
| [in] | device_slot | Defines slot where TMP103 device is located |
| [in] | I2C_device_address | TMP103 I2C slave address |
| unsigned char mvk_Set_TMP103_Low_Level_Alert_Temperature | ( | signed char | low_level_alert_temp, |
| unsigned char | device_slot, | ||
| unsigned int | I2C_device_address | ||
| ) |
Set the TMP103 Temp Sensor Device Low Level Temperature Alert value.
This function writes the register containing the low level alert temperature value. When the TMP103 senses a temperateure lower than the low level alert value, the low level alert flag is set in the TMP103 configuration/status register
| [in] | low_level_alert_temp | Temperature value(celsius) below which triggers a TMP103 low temp alert flag |
| [in] | device_slot | Defines slot where TMP103 device is located |
| [in] | I2C_device_address | TMP103 I2C slave address |
| unsigned char mvk_Set_TMP103_Operational_Mode | ( | unsigned char | operational_mode, |
| unsigned char | device_slot, | ||
| unsigned int | I2C_device_address | ||
| ) |
Set the operational mode of the TMP103 Temp Sensor.
This function writes the TMP103 Temperature operational mode register. TMP103_SHUTDOWN mode conserves power by shutting down all device functionality except the serial interface. TMP103_CONTINUOUS_CONVERSION mode continuously measures temperature at the rate defined by the Configuration Register Conversion Rate value.
| [in] | operational_mode | Operational Mode of TMP103 (TMP103_SHUTDOWN, TMP103_CONTINUOUS_CONVERSION) |
| [in] | device_slot | Defines slot where TMP103 device is located |
| [in] | I2C_device_address | TMP103 I2C slave address |
| unsigned char mvk_Set_TMP103_Sleep_Enable | ( | unsigned char | mode, |
| unsigned char | device_slot, | ||
| unsigned int | I2C_device_address | ||
| ) |
Sets the TMP103 Sleep Function.
This function enables or disables the TMP103 sleep mode setting
| [in] | mode | Sleep Mode setting (ENABLE or DISABLE) |
| [in] | device_slot | Defines slot where TMP103 device is located |
| [in] | I2C_device_address | TMP103 I2C slave address |
| unsigned char mvk_Trigger_TMP103_One_Shot_Temperature_Measurement | ( | unsigned char | device_slot, |
| unsigned int | I2C_device_address | ||
| ) |
Initiates a single(one-shot) TMP103 temperature measurement.
This command initiates a single TMP103 temperature mesurement only when the current TMP103 operation mode is TMP_SHUTDOWN. This feature is useful for reducing power consumption in the TMP103 when continuous temperature monitoring is not required. A single conversion typically takes 26ms and a read can take place in less than 20ìs. When using One-Shot mode, 30 or more conversions per second are possible.
| [in] | device_slot | Defines slot where TMP103 device is located |
| [in] | I2C_device_address | TMP103 I2C slave address |
| unsigned char mvk_Write_TMP103_register | ( | unsigned char | pointer, |
| unsigned char * | write_data, | ||
| unsigned char | device_slot, | ||
| unsigned int | I2C_device_address | ||
| ) |
Write a value to an I2C register in the TMP103 Keypad Scan Device.
The function will write a value to an I2C register in the TMP103 Temp Sensor Device.
| [in] | pointer | TMP103 register address to be written |
| [in] | write_data | Pointer to value to be written to the specified TMP103 register |
| [in] | device_slot | Defines slot where TMP103 device is located on the MB-PRO-MVK motherboard |
| [in] | I2C_device_address | TMP103 I2C slave address |
| volatile unsigned char TMP103_Configuration = 0000 |
| volatile TMP103_Configuration_register_type* TMP103_Configuration_register = (TMP103_Configuration_register_type*) &TMP103_Configuration |
| I2C_Device_Parameter_type TMP103_I2C_Device_Default_Settings = {I2C_100_KHZ, I2C_7_BIT_ADDRESS, NULL} |
| volatile unsigned char TMP103_Last_Operational_Mode |
1.7.3