feat: 蜂鸣器和旋钮适配

This commit is contained in:
bmy
2024-02-07 10:24:11 +08:00
parent 845ab06586
commit 5f29a9eca2
9 changed files with 78 additions and 120 deletions

View File

@@ -3,17 +3,6 @@
#include "by_imu.h"
uint8_t rotate_button;
void by_gpio_init(void)
{
gpio_init(E10, GPI, GPIO_HIGH, GPI_PULL_UP);
}
void by_exit_init(void)
{
exti_init(E9, EXTI_TRIGGER_FALLING);
exti_init(E11, EXTI_TRIGGER_BOTH);
}
/**
* @brief 查询旋钮状态 - 查询后状态归零
*
@@ -22,37 +11,16 @@ void by_exit_init(void)
uint8_t by_get_rb_status(void)
{
uint8_t temp_s = rotate_button;
rotate_button = 0;
rotate_button = rotate_button_none;
return temp_s;
}
void by_ips_show(void)
void by_rb_init(void)
{
ips200_show_string(0, 0, "button status:");
// ips200_show_uint(104, 0, by_get_rb_status(), 1);
switch (by_get_rb_status()) {
case 1:
ips200_show_string(104, 0, "press");
break;
case 2:
ips200_show_string(104, 0, "up ");
break;
case 3:
ips200_show_string(104, 0, "down ");
break;
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);
default:
ips200_show_string(104, 0, " ");
break;
}
// 按钮
ips200_show_string(0, 16, "imu:");
ips200_show_float(46, 32, eulerAngle.pitch, 3, 2);
ips200_show_float(46, 48, eulerAngle.roll, 3, 2);
ips200_show_float(46, 64, eulerAngle.yaw, 3, 2);
// ips200_show_float(46 , 32, icm_data.gyro_x, 2, 2);
// ips200_show_float(106, 32, icm_data.gyro_y, 2, 2);
// ips200_show_float(166, 32, icm_data.gyro_z, 2, 2);
ips200_show_float(46, 80, imu660ra_temperature, 2, 2);
// printf("%d,%d,%d\n", (int16_t)(icm_data.gyro_x * 10), (int16_t)(icm_data.gyro_y * 10), (int16_t)(icm_data.gyro_z * 10));
exti_init(E9, EXTI_TRIGGER_FALLING);
exti_init(E11, EXTI_TRIGGER_BOTH);
}