#include "beep.h"
uint8_t chan;
uint8_t bit_num;

void beep_init(uint8_t beep_chan, uint32_t beep_freq, uint8_t beep_bit_num)
{
    chan = beep_chan;
    bit_num = beep_bit_num;
    ledcSetup(chan, beep_freq , bit_num);
    ledcAttachPin(BEEP_PIN, chan);
    ledcWrite(chan, 0);
}

void beep_run( uint32_t freq,uint32_t duty)
{
    ledcSetup(chan, freq , bit_num);

    ledcWrite(chan, duty);
}
void beep_stop()
{
    ledcWrite(chan, 0);
}


//   beep_init(39,0,2000,10);
//   while (1)
//   {
//     beep_run(2000,512);
//     vTaskDelay(1000);
//     beep_stop();
//     vTaskDelay(1000);
//   }
//开机成功长响3秒
//光谱仪故障一直滴滴声
//温度异常报警快速滴滴声
//其他功能异常慢速滴滴声

