Questions and discussions about the software that runs on the TD RF module itself.
dandavid3000
 
Posts: 24
Joined: Fri Oct 28, 2016 12:30 pm

Functions to setup Buzzer attributes

by dandavid3000 Thu Jun 08, 2017 10:11 am

Hi,

I'd like to use a buzzer instead of a LED (I use the same gpio TIM2 for both LED, and buzzer) . I took a look at "td_tools_led.c" and "td_tools_led.h". There is a function named
Code: Select all
int TD_TOOLS_LED_SetPWM(uint8_t id,uint8_t period, uint8_t value);
, and I think it's a function to set up value (frequency), and period for the buzzer. However, when I tried this function I didn't success in managing the buzzer :( .

Is it the correct function ? If not, which functions of from the SDK can be use to manage the buzzer ?

Thank you,
Dan
omlu
 
Posts: 46
Joined: Tue Oct 06, 2015 8:27 am

Re: Functions to setup Buzzer attributes

by omlu Thu Jun 29, 2017 1:25 pm

dandavid3000 wrote:Hi,

I'd like to use a buzzer instead of a LED (I use the same gpio TIM2 for both LED, and buzzer) . I took a look at "td_tools_led.c" and "td_tools_led.h". There is a function named
Code: Select all
int TD_TOOLS_LED_SetPWM(uint8_t id,uint8_t period, uint8_t value);
, and I think it's a function to set up value (frequency), and period for the buzzer. However, when I tried this function I didn't success in managing the buzzer :( .

Is it the correct function ? If not, which functions of from the SDK can be use to manage the buzzer ?

Thank you,
Dan


Hi,

I also used a buzzer in my circuit (TD1208). But I didn't use PWM to play different tones. I simply used GPIO's function like "ON" or "OFF"
Code: Select all
void buzzerInit(void) {
   GPIO_PinModeSet(ADC0_PORT, ADC0_BIT, gpioModePushPull, 1);
   GPIO_PinOutClear(ADC0_PORT, ADC0_BIT);
}

void buzzerBeep (void) {
   GPIO_PinOutSet(ADC0_PORT, ADC0_BIT);
   TD_RTC_Delay(T50MS);
   GPIO_PinOutClear(ADC0_PORT, ADC0_BIT);
}
Return to Firmware

Who is online

Users browsing this forum: No registered users and 7 guests