10 #include "../../../tests/catch2/catch.hpp"
12 #include "../xtChannels.hpp"
19 SCENARIO(
"Setting channels from registers",
"[xtChannels]" )
21 GIVEN(
"A set of input registers read from the device")
25 WHEN(
"Individual channels set")
29 uint16_t registers[4];
32 memset(registers,0,
sizeof(registers));
54 memset(registers,0,
sizeof(registers));
76 memset(registers,0,
sizeof(registers));
98 memset(registers,0,
sizeof(registers));
120 memset(registers,0,
sizeof(registers));
142 memset(registers,0,
sizeof(registers));
164 memset(registers,0,
sizeof(registers));
186 memset(registers,0,
sizeof(registers));
208 memset(registers,0,
sizeof(registers));
230 memset(registers,0,
sizeof(registers));
252 memset(registers,0,
sizeof(registers));
274 memset(registers,0,
sizeof(registers));
296 memset(registers,0,
sizeof(registers));
318 memset(registers,0,
sizeof(registers));
340 memset(registers,0,
sizeof(registers));
362 memset(registers,0,
sizeof(registers));
384 WHEN(
"Multiple channels set")
388 uint16_t registers[4];
391 memset(registers,0,
sizeof(registers));
414 memset(registers,0,
sizeof(registers));
437 memset(registers,0,
sizeof(registers));
460 memset(registers,0,
sizeof(registers));
483 memset(registers,0,
sizeof(registers));
506 memset(registers,0,
sizeof(registers));
529 memset(registers,0,
sizeof(registers));
553 memset(registers,0,
sizeof(registers));
581 SCENARIO(
"Setting registers from channels",
"[xtChannels]" )
583 GIVEN(
"A set of input registers to send to the device")
587 WHEN(
"Individual channels set, all able to output")
591 uint16_t registers[4];
597 memset(registers,0,
sizeof(registers));
609 memset(registers,0,
sizeof(registers));
622 memset(registers,0,
sizeof(registers));
634 memset(registers,0,
sizeof(registers));
646 memset(registers,0,
sizeof(registers));
658 memset(registers,0,
sizeof(registers));
670 memset(registers,0,
sizeof(registers));
682 memset(registers,0,
sizeof(registers));
694 memset(registers,0,
sizeof(registers));
706 memset(registers,0,
sizeof(registers));
718 memset(registers,0,
sizeof(registers));
730 memset(registers,0,
sizeof(registers));
742 memset(registers,0,
sizeof(registers));
754 memset(registers,0,
sizeof(registers));
766 memset(registers,0,
sizeof(registers));
778 memset(registers,0,
sizeof(registers));
788 WHEN(
"Multiple channels set, all able to output")
792 uint16_t registers[4];
799 memset(registers,0,
sizeof(registers));
812 memset(registers,0,
sizeof(registers));
825 memset(registers,0,
sizeof(registers));
838 memset(registers,0,
sizeof(registers));
852 memset(registers,0,
sizeof(registers));
861 WHEN(
"Individual channels set, some input only")
869 uint16_t registers[4];
875 memset(registers,0,
sizeof(registers));
887 memset(registers,0,
sizeof(registers));
900 memset(registers,0,
sizeof(registers));
912 memset(registers,0,
sizeof(registers));
924 memset(registers,0,
sizeof(registers));
936 memset(registers,0,
sizeof(registers));
948 memset(registers,0,
sizeof(registers));
960 memset(registers,0,
sizeof(registers));
972 memset(registers,0,
sizeof(registers));
984 memset(registers,0,
sizeof(registers));
996 memset(registers,0,
sizeof(registers));
1008 memset(registers,0,
sizeof(registers));
1020 memset(registers,0,
sizeof(registers));
1032 memset(registers,0,
sizeof(registers));
1044 memset(registers,0,
sizeof(registers));
1056 memset(registers,0,
sizeof(registers));
1065 WHEN(
"Multiple channels set, some input only")
1073 uint16_t registers[4];
1080 memset(registers,0,
sizeof(registers));
1093 memset(registers,0,
sizeof(registers));
1106 memset(registers,0,
sizeof(registers));
1119 memset(registers,0,
sizeof(registers));
1133 memset(registers,0,
sizeof(registers));
SCENARIO("Setting channels from registers", "[xtChannels]")
Utility class for managing Acromag xt12XX digital I/O channels.
int setRegisters(uint16_t registers[numRegisters])
Set registers based on current channel states.
int setChannel(size_t chNo)
Set a channel to true.
int channel(size_t chNo)
Gets the current state of a channel.
int clearAll()
Clear all channels.
int setInputOnly(size_t chNo)
Set a channel to be input only.
int readRegisters(uint16_t registers[numRegisters])
Read channel states from the registers.