Furi: more gpio checks in HAL (#2549)

* Furi: more gpio checks in HAL
* Nfc: do not spawn service thread if it is already spawned

Co-authored-by: Sergey Gavrilov <who.just.the.doctor@gmail.com>
This commit is contained in:
あく
2023-04-06 10:19:39 +08:00
committed by GitHub
parent 4c488bd970
commit 2a26680acb
2 changed files with 15 additions and 12 deletions

View File

@@ -53,8 +53,8 @@ void furi_hal_gpio_init(
const GpioPull pull,
const GpioSpeed speed) {
// we cannot set alternate mode in this function
furi_assert(mode != GpioModeAltFunctionPushPull);
furi_assert(mode != GpioModeAltFunctionOpenDrain);
furi_check(mode != GpioModeAltFunctionPushPull);
furi_check(mode != GpioModeAltFunctionOpenDrain);
furi_hal_gpio_init_ex(gpio, mode, pull, speed, GpioAltFnUnused);
}
@@ -178,7 +178,7 @@ void furi_hal_gpio_add_int_callback(const GpioPin* gpio, GpioExtiCallback cb, vo
FURI_CRITICAL_ENTER();
uint8_t pin_num = furi_hal_gpio_get_pin_num(gpio);
furi_assert(gpio_interrupt[pin_num].callback == NULL);
furi_check(gpio_interrupt[pin_num].callback == NULL);
gpio_interrupt[pin_num].callback = cb;
gpio_interrupt[pin_num].context = ctx;
gpio_interrupt[pin_num].ready = true;