napperley
03/08/2025, 10:12 PMStylianos Gakis
03/08/2025, 10:32 PMinstead to get one big block of code instead of this.
So you'd see this result instead:
```private fun toggleGpioPin(chip: CPointer<*>, line: CPointer<*>) {
var value = 0
while (true) {
sleep(1u)
value = if (value == 0) 1 else 0
if (gpiod_line_set_value(line.reinterpret(), value) == -1) {
gpiod_chip_close(chip.reinterpret())
throw IllegalStateException("Cannot set value for GPIO pin")
}
}
}
ephemient
03/09/2025, 3:39 AMephemient
03/09/2025, 3:39 AM