chore: prefer wiringpi over orangepi functions

This commit is contained in:
Naxdy 2024-10-29 19:02:49 +01:00
parent 33b4f2d218
commit a223badc06
Signed by: Naxdy
GPG key ID: CC15075846BCE91B

View file

@ -150,7 +150,7 @@ impl Pin {
pub fn get_gpio_mode(&mut self) -> Result<PinMode, GpioError> { pub fn get_gpio_mode(&mut self) -> Result<PinMode, GpioError> {
ensure_library_setup!(); ensure_library_setup!();
self.pin_mode = unsafe { ffi::orangepi_get_gpio_mode(self.pin_id).try_into()? }; self.pin_mode = unsafe { ffi::getAlt(self.pin_id).try_into()? };
Ok(self.pin_mode) Ok(self.pin_mode)
} }
@ -174,7 +174,7 @@ impl Pin {
self.ensure_pin_mode(PinMode::Input)?; self.ensure_pin_mode(PinMode::Input)?;
unsafe { ffi::orangepi_digitalRead(self.pin_id).try_into() } unsafe { ffi::digitalRead(self.pin_id).try_into() }
} }
pub fn digital_write(&mut self, value: PinState) -> Result<bool, GpioError> { pub fn digital_write(&mut self, value: PinState) -> Result<bool, GpioError> {
@ -182,7 +182,7 @@ impl Pin {
self.ensure_pin_mode(PinMode::Output)?; self.ensure_pin_mode(PinMode::Output)?;
unsafe { Ok(ffi::orangepi_digitalWrite(self.pin_id, value.into()) == 0) } unsafe { Ok(ffi::digitalWrite(self.pin_id, value.into()) == 0) }
} }
pub fn pull_up_down_control(&mut self, mode: PullUpMode) { pub fn pull_up_down_control(&mut self, mode: PullUpMode) {