flipperzero-firmware/firmware/targets/f6/furi-hal/furi-hal-ibutton.c

25 lines
600 B
C
Raw Normal View History

2021-08-08 18:03:25 +00:00
#include <furi-hal-ibutton.h>
#include <furi-hal-resources.h>
2021-08-08 18:03:25 +00:00
void furi_hal_ibutton_start() {
furi_hal_ibutton_pin_high();
hal_gpio_init(&ibutton_gpio, GpioModeOutputOpenDrain, GpioSpeedLow, GpioPullNo);
}
2021-08-08 18:03:25 +00:00
void furi_hal_ibutton_stop() {
furi_hal_ibutton_pin_high();
hal_gpio_init(&ibutton_gpio, GpioModeAnalog, GpioSpeedLow, GpioPullNo);
}
2021-08-08 18:03:25 +00:00
void furi_hal_ibutton_pin_low() {
hal_gpio_write(&ibutton_gpio, false);
}
2021-08-08 18:03:25 +00:00
void furi_hal_ibutton_pin_high() {
hal_gpio_write(&ibutton_gpio, true);
}
2021-08-08 18:03:25 +00:00
bool furi_hal_ibutton_pin_get_level() {
return hal_gpio_read(&ibutton_gpio);
}