Exemple #1
0
void buzzer_play (uint16_t frequency, uint16_t duration)
{
  buzzer_pwm_set_frequency(frequency);
  buzzer_pwm_start();
  
  StartSlowTimer (&buzzerTimer, duration, buzzerTimerCallback); 
}
Exemple #2
0
void buzzer_play_sync (uint16_t frequency, uint32_t duration)
{
  buzzer_pwm_set_frequency(frequency);
  buzzer_pwm_start();
  
  while (duration--)
    delay_us (1000);
  buzzer_pwm_stop();
}
Exemple #3
0
static void buzzer_pwm_set(struct buzzer_t * buzzer, int frequency)
{
	struct buzzer_pwm_pdata_t * pdat = (struct buzzer_pwm_pdata_t *)buzzer->priv;

	if(pdat->frequency != frequency)
	{
		buzzer_pwm_set_frequency(pdat, frequency);
		pdat->frequency = frequency;
	}
}
Exemple #4
0
static void buzzer_pwm_resume(struct device_t * dev)
{
	struct buzzer_t * buzzer = (struct buzzer_t *)dev->priv;
	struct buzzer_pwm_pdata_t * pdat = (struct buzzer_pwm_pdata_t *)buzzer->priv;
	buzzer_pwm_set_frequency(pdat, pdat->frequency);
}
Exemple #5
0
static void buzzer_pwm_suspend(struct device_t * dev)
{
	struct buzzer_t * buzzer = (struct buzzer_t *)dev->priv;
	struct buzzer_pwm_pdata_t * pdat = (struct buzzer_pwm_pdata_t *)buzzer->priv;
	buzzer_pwm_set_frequency(pdat, 0);
}