Write button code

This commit is contained in:
2020-02-25 21:01:34 +01:00
parent 0bc341c0aa
commit 9311d0b515
2 changed files with 49 additions and 3 deletions

View File

@@ -21,7 +21,6 @@
#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
@@ -29,7 +28,7 @@
#define BUTTON_SHORT_ON_TIME_MS 50
#define BUTTON_LONG_ON_TIME_MS 800
enum button_state {BUTTON_IDLE = 0, BUTTON_SHORT, BUTTON_LONG};
enum button_state {BUTTON_IDLE = 0, BUTTON_SHORT_RELEASED, BUTTON_LONG_RELEASED, BUTTON_SHORT, BUTTON_LONG};
void button_init();