51 #include <iothinx/iothinxio.h> 54 int main(
int argc,
char **
const argv)
58 uint8_t tc_channel = 0;
61 float tc_calibration_temperature = 0.0f;
64 while (-1 != (rc = getopt(argc, argv,
"c:e:hs:t:")))
69 tc_channel = atoi(optarg);
72 tc_calibration_temperature = atof(optarg);
75 tc_slot = atoi(optarg);
78 tc_type = atoi(optarg);
82 printf(
"TC calibration sample program.\n\n");
83 printf(
"Usage: ./tc_calibration [OPTIONS]\n\n");
85 printf(
"\t%-8s Slot of TC module. Default slot = %d\n",
"-s", tc_slot);
86 printf(
"\t%-8s TC channel. Default channel = %d\n",
"-c", tc_channel);
87 printf(
"\t%-8s TC type. Default type = %d\n",
"-t", tc_type);
88 printf(
"\t%-8s Setting temperature. Default temperature = %.3f\n",
"-e", tc_calibration_temperature);
94 printf(
"TC slot = %lu\n", tc_slot);
95 printf(
"TC channel = %u\n", tc_channel);
96 printf(
"TC type = %d\n", tc_type);
97 printf(
"calibration temperature = %.3f\n", tc_calibration_temperature);
103 printf(
"ioThinx_IO_Client_Init() = %d\n", rc);
111 printf(
"ioThinx_TC_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_TC_GetValues() = %d\n", rc);
139 printf(
"TC value before calibration: %.3f\n", tc_value);
146 printf(
"ioThinx_TC_SetCalibrations() = %d\n", rc);
150 printf(
"Calibrating...\n");
157 printf(
"ioThinx_TC_GetValues() = %d\n", rc);
161 printf(
"TC value after calibration: %.3f\n", tc_value);
int main(int argc, char **const argv)
IOTHINX_ERR ioThinx_TC_GetValues(uint32_t slot, uint8_t start, uint8_t count, float buf[])
IOTHINX_ERR ioThinx_TC_Config_SetSensorTypes(uint32_t slot, uint8_t start, uint8_t count, uint8_t buf[])
IOTHINX_ERR ioThinx_TC_SetCalibrations(uint32_t slot, uint8_t start, uint8_t count, float buf[])
IOTHINX_ERR ioThinx_IO_Config_Reload(void)
IOTHINX_ERR ioThinx_IO_Client_Init(void)