#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <iothinx/iothinxio.h>
int main(
int argc,
char **
const argv)
{
int32_t rc;
uint32_t rtd_slot = 5;
uint8_t rtd_channel_start = 0;
uint8_t rtd_channel_count = 2;
uint8_t rtd_types[8];
float rtd_values[8];
uint8_t rtd_statuss[8];
int32_t i;
char ch;
while (-1 != (rc = getopt(argc, argv, "c:n:hs:")))
{
switch (rc)
{
case 's':
rtd_slot = atoi(optarg);
break;
case 'c':
rtd_channel_start = atoi(optarg);
break;
case 'n':
rtd_channel_count = atoi(optarg);
break;
case 'h':
default:
printf("RTD sample program.\n\n");
printf("Usage: ./rtd [OPTIONS]\n\n");
printf("Options:\n");
printf("\t%-8s Slot of RTD module. Default slot = %d\n", "-s", rtd_slot);
printf("\t%-8s RTD start channel. Default channel = %d\n", "-c", rtd_channel_start);
printf("\t%-8s RTD channel count. Default count = %d\n", "-n", rtd_channel_count);
printf("\n");
return 0;
}
}
printf("RTD slot = %lu\n", rtd_slot);
printf("RTD start channel = %u\n", rtd_channel_start);
printf("RTD channel count = %u\n", rtd_channel_count);
{
printf("ioThinx_IO_Client_Init() = %d\n", rc);
return -1;
}
for (i = 0; i < rtd_channel_count; i++)
{
}
{
printf("ioThinx_RTD_Config_SetSensorTypes() = %d\n", rc);
}
{
printf("ioThinx_IO_Config_Reload() = %d\n", rc);
}
do
{
{
printf("ioThinx_RTD_GetValues() = %d\n", rc);
break;
}
{
printf("ioThinx_RTD_GetStatuss() = %d\n", rc);
break;
}
for (i = 0; i < rtd_channel_count; i++)
{
printf("[%lu:%u] value = %.2f, status = %d\n", rtd_slot, rtd_channel_start+i, rtd_values[i], rtd_statuss[i]);
}
ch = getchar();
}
while (ch != 'q');
return 0;
}
54 uint32_t rtd_slot = 5;
55 uint8_t rtd_channel_start = 0;
56 uint8_t rtd_channel_count = 2;
59 uint8_t rtd_statuss[8];
63 while (-1 != (rc = getopt(argc, argv,
"c:n:hs:")))
68 rtd_slot = atoi(optarg);
71 rtd_channel_start = atoi(optarg);
74 rtd_channel_count = atoi(optarg);
78 printf(
"RTD sample program.\n\n");
79 printf(
"Usage: ./rtd [OPTIONS]\n\n");
81 printf(
"\t%-8s Slot of RTD module. Default slot = %d\n",
"-s", rtd_slot);
82 printf(
"\t%-8s RTD start channel. Default channel = %d\n",
"-c", rtd_channel_start);
83 printf(
"\t%-8s RTD channel count. Default count = %d\n",
"-n", rtd_channel_count);
89 printf(
"RTD slot = %lu\n", rtd_slot);
90 printf(
"RTD start channel = %u\n", rtd_channel_start);
91 printf(
"RTD channel count = %u\n", rtd_channel_count);
97 printf(
"ioThinx_IO_Client_Init() = %d\n", rc);
102 for (i = 0; i < rtd_channel_count; i++)
109 printf(
"ioThinx_RTD_Config_SetSensorTypes() = %d\n", rc);
116 printf(
"ioThinx_IO_Config_Reload() = %d\n", rc);
125 printf(
"ioThinx_RTD_GetValues() = %d\n", rc);
131 printf(
"ioThinx_RTD_GetStatuss() = %d\n", rc);
134 for (i = 0; i < rtd_channel_count; i++)
136 printf(
"[%lu:%u] value = %.2f, status = %d\n", rtd_slot, rtd_channel_start+i, rtd_values[i], rtd_statuss[i]);
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_RTD_GetStatuss(uint32_t slot, uint8_t start, uint8_t count, uint8_t buf[])
IOTHINX_ERR ioThinx_IO_Config_Reload(void)
#define RTD_SENSOR_TYPE_PT100
IOTHINX_ERR ioThinx_IO_Client_Init(void)