summaryrefslogtreecommitdiff
path: root/cesar/hal/leon/src/fatal_button.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/hal/leon/src/fatal_button.c')
-rw-r--r--cesar/hal/leon/src/fatal_button.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/cesar/hal/leon/src/fatal_button.c b/cesar/hal/leon/src/fatal_button.c
index 6b83574d8a..19a16e5151 100644
--- a/cesar/hal/leon/src/fatal_button.c
+++ b/cesar/hal/leon/src/fatal_button.c
@@ -17,6 +17,7 @@
#include <cyg/hal/drv_api.h>
#include "hal/leon/gpio.h"
+#include "hal/gpio/gpio.h"
#include "config/leon/fatal.h"
@@ -46,6 +47,16 @@ leon_fatal_button_dsr (cyg_vector_t vector, cyg_ucount32 count,
dbg_fatal ("fatal button pressed");
}
+/**
+ * Fatal Synchronisation, set LEON_FATAL_BUTTON GPIO to 0.
+ */
+static void
+leon_fatal_sync (void)
+{
+ GPIO_SETUP (LEON_FATAL_BUTTON, GPIO_DIRECTION_OUT);
+ GPIO_SET (LEON_FATAL_BUTTON, 0);
+}
+
void
leon_fatal_button_init (void)
{
@@ -63,6 +74,9 @@ leon_fatal_button_init (void)
LEON_GPIO_IT = LEON_GPIO_IT_CONFIG (CONFIG_LEON_FATAL_BUTTON_IT,
LEON_GPIO_IT_CONFIG_ENABLED
| LEON_GPIO_IT_CONFIG_EDGE
- | CONFIG_LEON_FATAL_BUTTON_GPIO);
+ | CONFIG_GPIO_LEON_FATAL_BUTTON_GPIO);
+ /* Register callback to dbg lib. */
+ dbg_assert (!dbg_fatal_cb[0]);
+ dbg_fatal_cb[0] = leon_fatal_sync;
}