aboutsummaryrefslogtreecommitdiff
path: root/ports/stm32/mboot/mphalport.h
diff options
context:
space:
mode:
Diffstat (limited to 'ports/stm32/mboot/mphalport.h')
-rw-r--r--ports/stm32/mboot/mphalport.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/ports/stm32/mboot/mphalport.h b/ports/stm32/mboot/mphalport.h
index 0c8cb91a6..56d18a9b0 100644
--- a/ports/stm32/mboot/mphalport.h
+++ b/ports/stm32/mboot/mphalport.h
@@ -28,6 +28,11 @@
#include "genhdr/pins.h"
+// For simplicity just convert all HAL errors to one errno.
+static inline int mp_hal_status_to_neg_errno(HAL_StatusTypeDef status) {
+ return status == HAL_OK ? 0 : -1;
+}
+
#define mp_hal_delay_us_fast(us) mp_hal_delay_us(us)
#define MP_HAL_PIN_MODE_INPUT (0)