feat: 完成按键、屏幕和蜂鸣器适配
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
#include "by_buzzer.h"
|
||||
#include "by_rt_button.h"
|
||||
|
||||
#include "zf_common_headfile.h"
|
||||
#include <string.h>
|
||||
#include "zf_common_headfile.h"
|
||||
|
||||
#define BUZZER_QUEUE_LENGTH 40
|
||||
|
||||
uint16_t queue_long = 0;
|
||||
uint32_t a[40] = {0};
|
||||
|
||||
uint16_t queue_long = 0;
|
||||
const uint32_t max_long = 40;
|
||||
uint32_t a[40];
|
||||
void queue_init(void)
|
||||
{
|
||||
memset(a, 0, sizeof(a));
|
||||
@@ -14,7 +15,7 @@ void queue_init(void)
|
||||
|
||||
void queue_add_element(int element)
|
||||
{
|
||||
if (queue_long < max_long) {
|
||||
if (queue_long < BUZZER_QUEUE_LENGTH) {
|
||||
a[queue_long] = element;
|
||||
queue_long += 1;
|
||||
}
|
||||
@@ -38,5 +39,15 @@ void queue_pop_read(void)
|
||||
|
||||
void by_buzzer_init(void)
|
||||
{
|
||||
queue_init();
|
||||
pwm_init(BUZZER_PIN, 2000, 0);
|
||||
|
||||
by_buzzer_add(1250);
|
||||
by_buzzer_add(1500);
|
||||
by_buzzer_add(1750);
|
||||
}
|
||||
|
||||
void by_buzzer_add(uint16_t tone)
|
||||
{
|
||||
queue_add_element(tone);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user