51 #include <iothinx/iothinxio.h> 54 int main(
int argc,
char **
const argv)
57 uint32_t rtd_slot = 5;
58 uint8_t rtd_channel = 0;
61 float rtd_calibration_temperature = 0.0f;
64 while (-1 != (rc = getopt(argc, argv,
"c:e:hs:t:")))
69 rtd_channel = atoi(optarg);
72 rtd_calibration_temperature = atof(optarg);
75 rtd_slot = atoi(optarg);
78 rtd_type = atoi(optarg);
82 printf(
"RTD calibration sample program.\n\n");
83 printf(
"Usage: ./rtd_calibration [OPTIONS]\n\n");
85 printf(
"\t%-8s Slot of RTD module. Default slot = %d\n",
"-s", rtd_slot);
86 printf(
"\t%-8s RTD channel. Default channel = %d\n",
"-c", rtd_channel);
87 printf(
"\t%-8s RTD type. Default type = %d\n",
"-t", rtd_type);
88 printf(
"\t%-8s Setting temperature. Default temperature = %.3f\n",
"-e", rtd_calibration_temperature);
94 printf(
"RTD slot = %lu\n", rtd_slot);
95 printf(
"RTD channel = %u\n", rtd_channel);
96 printf(
"RTD type = %d\n", rtd_type);
97 printf(
"calibration temperature = %.3f\n", rtd_calibration_temperature);
103 printf(
"ioThinx_IO_Client_Init() = %d\n", rc);
111 printf(
"ioThinx_RTD_Config_SetSensorTypes() = %d\n", rc);
119 printf(
"ioThinx_IO_Config_Reload() = %d\n", rc);
122 printf(
"\nAfter executing this program, a non-volatile offset will be set for the selected channel.\n");
123 printf(
"1. Ensure the sensor is connected.\n");
124 printf(
"2. Ensure the channel and its sensor type is correctly selected.\n");
125 printf(
"3. Put the sensor into a glass that contains a mixture of ice and water.\n");
126 printf(
"4. Do not remove the sensor from the ice water during calibration...\n");
127 printf(
"Continue ? (y/n): ");
135 printf(
"ioThinx_RTD_GetValues() = %d\n", rc);
139 printf(
"RTD value before calibration: %.3f\n", rtd_value);
146 printf(
"ioThinx_RTD_SetCalibrations() = %d\n", rc);
150 printf(
"Calibrating...\n");
157 printf(
"ioThinx_RTD_GetValues() = %d\n", rc);
161 printf(
"RTD value after calibration: %.3f\n", rtd_value);
IOTHINX_ERR ioThinx_RTD_SetCalibrations(uint32_t slot, uint8_t start, uint8_t count, float buf[])
int main(int argc, char **const argv)
IOTHINX_ERR ioThinx_RTD_Config_SetSensorTypes(uint32_t slot, uint8_t start, uint8_t count, uint8_t buf[])
IOTHINX_ERR ioThinx_RTD_GetValues(uint32_t slot, uint8_t start, uint8_t count, float buf[])
IOTHINX_ERR ioThinx_IO_Config_Reload(void)
#define RTD_SENSOR_TYPE_PT100
IOTHINX_ERR ioThinx_IO_Client_Init(void)