key.h
755 Bytes
/*
* key.h
*
* Created on: Oct 28, 2019
* Author: Hope
*/
#ifndef INC_HARDWARE_KEY_H_
#define INC_HARDWARE_KEY_H_
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32f0xx_hal_gpio.h"
/* key scan defines --------------------------------------------------------*/
#define KEY1_read() HAL_GPIO_ReadPin(KEY1_GPIO_Port, KEY1_Pin)
#define KEY2_read() HAL_GPIO_ReadPin(KEY2_GPIO_Port, KEY2_Pin)
#define KEY1_UP 1
#define KEY1_DOWN !KEY1_UP
#define KEY2_UP 0
#define KEY2_DOWN !KEY2_UP
/* Exported functions --------------------------------------------------------*/
extern uint8_t KEY_Scan(uint8_t mode);
#endif /* INC_HARDWARE_KEY_H_ */