feat: 增加LED状态指示
This commit is contained in:
29
app/by_led.c
Normal file
29
app/by_led.c
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#include "by_led.h"
|
||||||
|
|
||||||
|
#include "zf_common_headfile.h"
|
||||||
|
|
||||||
|
#define LED_WARN_PIN E9
|
||||||
|
#define LED_INFO_PIN E8
|
||||||
|
|
||||||
|
uint8_t led_warn_status = 1;
|
||||||
|
uint8_t led_info_status = 1;
|
||||||
|
|
||||||
|
// TODO 将队列抽象出去,具有 blink 属性的设备均可使用
|
||||||
|
|
||||||
|
void by_led_init(void)
|
||||||
|
{
|
||||||
|
gpio_init(LED_WARN_PIN, GPO, 0, GPO_PUSH_PULL);
|
||||||
|
gpio_init(LED_INFO_PIN, GPO, 0, GPO_PUSH_PULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void by_led_warn_blink(void)
|
||||||
|
{
|
||||||
|
led_warn_status = !led_warn_status;
|
||||||
|
gpio_set_level(LED_WARN_PIN, led_warn_status);
|
||||||
|
}
|
||||||
|
|
||||||
|
void by_led_info_blink(void)
|
||||||
|
{
|
||||||
|
led_info_status = !led_info_status;
|
||||||
|
gpio_set_level(LED_INFO_PIN, led_info_status);
|
||||||
|
}
|
||||||
8
app/by_led.h
Normal file
8
app/by_led.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#ifndef _BY_LED_H__
|
||||||
|
#define _BY_LED_H__
|
||||||
|
|
||||||
|
extern void by_led_init(void);
|
||||||
|
extern void by_led_warn_blink(void);
|
||||||
|
extern void by_led_info_blink(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#include "by_rt_button.h"
|
|
||||||
#include "zf_common_headfile.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 查询旋钮状态 - 查询后状态归零
|
|
||||||
*
|
|
||||||
* @return uint8_t 当前旋钮状态
|
|
||||||
*/
|
|
||||||
uint8_t by_get_rb_status(void)
|
|
||||||
{
|
|
||||||
uint8_t temp_s = rotate_button;
|
|
||||||
rotate_button = 0;
|
|
||||||
return temp_s;
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#ifndef _BY_RT_BUTTON_H__
|
|
||||||
#define _BY_RT_BUTTON_H__
|
|
||||||
|
|
||||||
#include "stdio.h"
|
|
||||||
#include "ch32v30x.h"
|
|
||||||
|
|
||||||
typedef enum rotate_button_event {
|
|
||||||
rotate_button_press_short = 1,
|
|
||||||
rotate_button_press_long = 2,
|
|
||||||
rotate_button_forward = 3,
|
|
||||||
rotate_button_backward = 4,
|
|
||||||
} rotate_button_event;
|
|
||||||
|
|
||||||
extern uint8_t rotate_button;
|
|
||||||
|
|
||||||
extern void by_exit_init(void);
|
|
||||||
extern void by_gpio_init(void);
|
|
||||||
extern uint8_t by_get_rb_status(void);
|
|
||||||
extern void by_ips_show(void);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -34,7 +34,6 @@
|
|||||||
********************************************************************************************************************/
|
********************************************************************************************************************/
|
||||||
|
|
||||||
#include "zf_common_headfile.h"
|
#include "zf_common_headfile.h"
|
||||||
#include "by_rt_button.h"
|
|
||||||
#include "by_button.h"
|
#include "by_button.h"
|
||||||
#include "by_buzzer.h"
|
#include "by_buzzer.h"
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "./page/page.h"
|
#include "./page/page.h"
|
||||||
#include "jj_param.h"
|
#include "jj_param.h"
|
||||||
#include "by_buzzer.h"
|
#include "by_buzzer.h"
|
||||||
|
#include "by_led.h"
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -34,8 +35,11 @@ int main(void)
|
|||||||
// mt9v03x_init();
|
// mt9v03x_init();
|
||||||
ips200_init(IPS200_TYPE_SPI);
|
ips200_init(IPS200_TYPE_SPI);
|
||||||
usb_cdc_init();
|
usb_cdc_init();
|
||||||
|
|
||||||
|
by_led_init();
|
||||||
by_buzzer_init();
|
by_buzzer_init();
|
||||||
by_button_init();
|
by_button_init();
|
||||||
|
|
||||||
// while (imu660ra_init())
|
// while (imu660ra_init())
|
||||||
// ;
|
// ;
|
||||||
// jj_param_eeprom_init();
|
// jj_param_eeprom_init();
|
||||||
@@ -51,7 +55,7 @@ int main(void)
|
|||||||
// adaptiveThreshold((uint8_t*)mt9v03x_image_copy, (uint8_t*)mt9v03x_image_copy, 188, 120, 7, 17);
|
// adaptiveThreshold((uint8_t*)mt9v03x_image_copy, (uint8_t*)mt9v03x_image_copy, 188, 120, 7, 17);
|
||||||
// ips200_show_gray_image(0, 0, mt9v03x_image_copy[0], MT9V03X_W, MT9V03X_H, MT9V03X_W, MT9V03X_H, 0);
|
// ips200_show_gray_image(0, 0, mt9v03x_image_copy[0], MT9V03X_W, MT9V03X_H, MT9V03X_W, MT9V03X_H, 0);
|
||||||
mt9v03x_finish_flag = 0;
|
mt9v03x_finish_flag = 0;
|
||||||
|
by_led_info_blink();
|
||||||
state_type = COMMON_STATE;
|
state_type = COMMON_STATE;
|
||||||
img_processing();
|
img_processing();
|
||||||
get_corners();
|
get_corners();
|
||||||
|
|||||||
Reference in New Issue
Block a user