BLE_TYQ_BJQ_CH32V303/bsp/inc/bsp_beep.h

91 lines
2.4 KiB
C
Raw Normal View History

2024-12-04 10:31:57 +08:00
/***
* @Author: mbw
* @Date: 2024-11-30 15:46:21
* @LastEditors: mbw && 1600520629@qq.com
* @LastEditTime: 2025-01-02 10:11:17
2024-12-04 10:31:57 +08:00
* @FilePath: \ble_bjq_ch303rct6_ml307\bsp\inc\bsp_beep.h
* @Description:
* @
* @Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
*/
2024-12-01 13:49:43 +08:00
#ifndef __BSP_BEEP__
#define __BSP_BEEP__
#include "board.h"
#include "drv_gpio.h"
#include "agile_led.h"
#define TEST_BSP_BEEP
extern agile_led_t *beep;
2024-12-04 10:31:57 +08:00
#define BEEP_PIN GET_PIN(C, 8)
2024-12-01 13:49:43 +08:00
#define BEEP_ON agile_led_on(beep)
#define BEEP_OFF agile_led_off(beep)
#define BEEP_START agile_led_start(beep)
#define BEEP_STOP \
do \
{ \
BEEP_OFF; \
agile_led_stop(beep); \
} while (0U)
#define BEEP_CTRL(light_mode, loop_cnt) \
do \
{ \
agile_led_dynamic_change_light_mode(beep, light_mode, loop_cnt); \
} while (0U)
/************************预设的一些鸣叫模式**************/
2024-12-01 15:31:07 +08:00
#define BEEP_CALIBRATION_OK \
do \
{ \
BEEP_CTRL("1000,100", 1); \
BEEP_START; \
} while (0U)
2024-12-01 13:49:43 +08:00
#define BEEP_PREAT_OK \
do \
{ \
BEEP_CTRL("400,10", 1); \
BEEP_START; \
} while (0U)
// 5s一次
#define BEEP_FAULT \
do \
{ \
BEEP_CTRL("200,4800", -1); \
BEEP_START; \
} while (0U)
#define BEEP_ALARM \
do \
{ \
BEEP_STOP; \
BEEP_CTRL("200,200", -1); \
BEEP_START; \
} while (0U)
// 3s
#define BEEP_SELF_CHECK \
do \
{ \
BEEP_CTRL("500,500", 1); \
2024-12-01 13:49:43 +08:00
BEEP_START; \
} while (0U)
// 寿命到期 20s一次
#define BEEP_END_OF_LIFE \
do \
{ \
BEEP_CTRL("200,19800", -1); \
BEEP_START; \
} while (0U)
int BSP_BEEP_Init(void);
#endif // !__BSP_BEEP__