45 #include <iothinx/iothinxio.h> 48 int main(
int argc,
char **
const argv)
51 uint32_t misc_slot = 0;
52 uint32_t module_slot = 1;
53 uint32_t module_count = 0;
56 uint8_t pbtn_state = 0;
57 uint8_t led_state = 0;
60 while (-1 != (rc = getopt(argc, argv,
"hs:")))
65 module_slot = atoi(optarg);
69 printf(
"Miscellaneous sample program.\n\n");
70 printf(
"Usage: ./misc [OPTIONS]\n\n");
72 printf(
"\t%-8s Slot of the module. Default slot = %d\n",
"-s", module_slot);
82 printf(
"ioThinx_IO_Client_Init() = %d\n", rc);
90 printf(
"ioThinx_Misc_GetModuleCount() = %d\n", rc);
92 printf(
"Module count = %lu\n", module_count);
93 printf(
"Module slot = %lu\n", module_slot);
97 printf(
"ioThinx_Misc_GetModuleInfo() = %d\n", rc);
101 printf(
"Slot %d Module Information:\n", module_slot);
102 printf(
"Model Name: %s, ", module_info.
model_name);
110 printf(
"ioThinx_Misc_SetLocateState() = %d\n", rc);
114 printf(
"Slot %d: Locating...\n", module_slot);
116 printf(
"Press enter to stop locate.");
121 printf(
"ioThinx_Misc_SetLocateState() = %d\n", rc);
128 printf(
"ioThinx_Misc_GetRotarySwitchState() = %d\n", rc);
132 printf(
"Rotary switch state = %d\n", rs_state);
139 printf(
"ioThinx_Misc_GetPushButtonState() = %d\n", rc);
143 printf(
"Push button state = %d\n", pbtn_state);
150 printf(
"ioThinx_Misc_SetUserLedState() = %d\n", rc);
154 printf(
"Set LED U1 to GREEN\n");
159 printf(
"ioThinx_Misc_SetUserLedState() = %d\n", rc);
163 printf(
"Set LED U2 to RED\n");
165 printf(
"Press enter to clear.");
169 printf(
"Press enter to continue.");
IOTHINX_ERR ioThinx_Misc_GetRotarySwitchState(uint32_t slot, uint8_t *p_state)
IOTHINX_ERR ioThinx_Misc_GetPushButtonState(uint32_t slot, uint8_t *p_state)
uint8_t serial_number[13]
IOTHINX_ERR ioThinx_Misc_GetModuleCount(uint32_t *p_module_count)
IOTHINX_ERR ioThinx_Misc_SetUserLedState(uint32_t slot, uint8_t channel, uint8_t state)
IOTHINX_ERR ioThinx_Misc_GetModuleInfo(uint8_t slot, struct MODULE_INFO *p_module_info)
int main(int argc, char **const argv)
IOTHINX_ERR ioThinx_IO_Client_Init(void)
IOTHINX_ERR ioThinx_Misc_SetLocateState(uint32_t slot, uint8_t state)