Skip to main content

pamoja_gpio_line_open_output

Function pamoja_gpio_line_open_output 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_gpio_line_open_output( chip: *const c_char, line: u32, initial: PamojaPinLevel, out_line: *mut *mut PamojaGpioLine, ) -> PamojaStatus
Expand description

Opens a line on a Linux board as an output, driving initial from the moment it is taken.

§Arguments

  • chip - the GPIO chip’s device file, such as /dev/gpiochip0.
  • line - the line’s number on that chip, the GPIO or BCM number on a Raspberry Pi.
  • initial - the level to drive as soon as the line is taken; an active-low relay is opened high so it stays off.
  • out_line - receives the line, or null when opening fails.

§Returns

PamojaStatus::Ok with the line in out_line; PamojaStatus::Unsupported on any platform but Linux; PamojaStatus::InvalidArgument for a null or non-UTF-8 argument; or PamojaStatus::Io when the chip or the line cannot be opened. The last error message names the chip and the line.

§Safety

chip must be a null-terminated string or null, and out_line a writable pointer or null.