pub fn gpio_get(resource: u32, io: u8) -> StatusExpand description
Get the value of a given GPIO for a device identified by its handle
§description
This syscall allows to get back the value of a GPIO identifier associated to the corresponding pinmux declared in the device tree.
Considering the following device tree content:
&i2c1 {
status = "okay";
outpost,owner = <0xC001F001>;
pinctrl-0 = <&i2c1_sda>;
}
i2c1_sda: i2c_sda_pb9 {
label = "sda";
pinmux = <&gpiob 9 STM32_DT_PIN_MODE_ALTFUNC(4)>;
pincfg = <STM32_OTYPER_OPEN_DRAIN \
STM32_OSPEEDR_VERY_HIGH_SPEED \
STM32_PUPDR_PULL_UP>;
};The task-level i2c1 table generated would then hold a one entry vector with the Sda index named identified explicitly, targeting the lonely vector cell.
This identifier can be used as-is for the io input value.
This syscall returns Status::Invalid if the io does not exist for the given device handle or if the device handle itself is invalid or not owned. This syscall returns Status::Ok if the GPIO has been read, and the GPIO value can be acceded in the SVC_Exchange area.
§Example
ⓘ
gpio_get(devh, Sda);