Init Button. Interrupt still missing
This commit is contained in:
		@@ -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__ */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user