2024-01-04 22:07:13 +08:00
|
|
|
#include "by_rt_button.h"
|
2023-12-13 21:54:20 +08:00
|
|
|
#include "zf_common_headfile.h"
|
2023-12-22 15:24:39 +08:00
|
|
|
#include "by_imu.h"
|
2024-01-04 22:07:13 +08:00
|
|
|
uint8_t rotate_button;
|
2023-12-22 15:24:39 +08:00
|
|
|
|
2024-01-04 22:07:13 +08:00
|
|
|
/**
|
|
|
|
|
* @brief 查询旋钮状态 - 查询后状态归零
|
|
|
|
|
*
|
|
|
|
|
* @return uint8_t 当前旋钮状态
|
|
|
|
|
*/
|
|
|
|
|
uint8_t by_get_rb_status(void)
|
2023-12-13 21:54:20 +08:00
|
|
|
{
|
2024-01-04 22:07:13 +08:00
|
|
|
uint8_t temp_s = rotate_button;
|
2024-02-07 10:24:11 +08:00
|
|
|
rotate_button = rotate_button_none;
|
2023-12-13 21:54:20 +08:00
|
|
|
return temp_s;
|
2023-12-15 21:42:43 +08:00
|
|
|
}
|
|
|
|
|
|
2024-02-07 10:24:11 +08:00
|
|
|
void by_rb_init(void)
|
2023-12-15 21:42:43 +08:00
|
|
|
{
|
2024-02-07 10:24:11 +08:00
|
|
|
gpio_init(E9, GPI, GPIO_HIGH, GPI_PULL_UP);
|
|
|
|
|
gpio_init(E10, GPI, GPIO_HIGH, GPI_PULL_UP);
|
|
|
|
|
gpio_init(E11, GPI, GPIO_HIGH, GPI_PULL_UP);
|
2023-12-22 15:24:39 +08:00
|
|
|
|
2024-02-07 10:24:11 +08:00
|
|
|
exti_init(E9, EXTI_TRIGGER_FALLING);
|
|
|
|
|
exti_init(E11, EXTI_TRIGGER_BOTH);
|
2023-12-22 15:24:39 +08:00
|
|
|
}
|