diff --git a/stm-firmware/button.c b/stm-firmware/button.c
index 8933eff..0e402b3 100644
--- a/stm-firmware/button.c
+++ b/stm-firmware/button.c
@@ -18,4 +18,28 @@
* If not, see .
*/
+#include
#include
+#include
+#include
+
+static volatile uint64_t to_active_timestamp;
+
+void button_init()
+{
+ rcc_manager_enable_clock(&RCC->AHB1ENR, BITMASK_TO_BITNO(BUTTON_RCC_MASK));
+ BUTTON_PORT->MODER &= MODER_DELETE(BUTTON_PIN);
+ BUTTON_PORT->PUPDR &= PUPDR_DELETE(BUTTON_PIN);
+ BUTTON_PORT->PUPDR |= PULLUP(BUTTON_PIN);
+
+
+}
+
+enum button_state button_read_event();
+
+void button_deinit()
+{
+ BUTTON_PORT->MODER &= MODER_DELETE(BUTTON_PIN);
+ BUTTON_PORT->PUPDR &= PUPDR_DELETE(BUTTON_PIN);
+ rcc_manager_disable_clock(&RCC->AHB1ENR, BITMASK_TO_BITNO(BUTTON_RCC_MASK));
+}
diff --git a/stm-firmware/include/reflow-controller/button.h b/stm-firmware/include/reflow-controller/button.h
index 8a2175e..e5a72b7 100644
--- a/stm-firmware/include/reflow-controller/button.h
+++ b/stm-firmware/include/reflow-controller/button.h
@@ -21,4 +21,21 @@
#ifndef __BUTTON_H__
#define __BUTTON_H__
+#define BUTTON_ACTIVE_LEVEL 0
+#define BUTTON_PORT GPIOD
+#define BUTTON_RCC_MASK RCC_AHB1ENR_GPIODEN
+#define BUTTON_PIN 4
+
+#define BUTTON_SHORT_ON_TIME_MS 50
+#define BUTTON_LONG_ON_TIME_MS 800
+
+enum button_state {BUTTON_IDLE = 0, BUTTON_SHORT, BUTTON_LONG};
+
+void button_init();
+
+enum button_state button_read_event();
+
+void button_deinit();
+
+
#endif /* __BUTTON_H__ */