boards: chronos: convert buzzer to use xtimer

This commit is contained in:
Kaspar Schleiser 2015-09-03 18:33:17 +02:00
parent 832539fc88
commit b0892c781f
2 changed files with 6 additions and 4 deletions

View File

@ -26,9 +26,9 @@
#include <cc430f6137.h> #include <cc430f6137.h>
#include "buzzer.h" #include "buzzer.h"
#include "hwtimer.h" #include "xtimer.h"
void buzzer_beep(uint8_t pitch, uint16_t duration) void buzzer_beep(uint8_t pitch, uint32_t duration)
{ {
// Reset TA1R, set up mode, TA1 runs from 32768Hz ACLK // Reset TA1R, set up mode, TA1 runs from 32768Hz ACLK
TA1CTL = TACLR | MC_1 | TASSEL__ACLK; TA1CTL = TACLR | MC_1 | TASSEL__ACLK;
@ -42,7 +42,7 @@ void buzzer_beep(uint8_t pitch, uint16_t duration)
// Allow buzzer PWM output on P2.7 // Allow buzzer PWM output on P2.7
P2SEL |= BIT7; P2SEL |= BIT7;
hwtimer_wait(duration); xtimer_usleep(duration);
// Stop PWM timer // Stop PWM timer
TA1CTL &= ~(BIT4 | BIT5); TA1CTL &= ~(BIT4 | BIT5);

View File

@ -9,11 +9,13 @@
#ifndef BUZZER_H_ #ifndef BUZZER_H_
#define BUZZER_H_ #define BUZZER_H_
#include <stdint.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void buzzer_beep(uint8_t pitch, uint16_t duration); void buzzer_beep(uint8_t pitch, uint32_t duration);
#ifdef __cplusplus #ifdef __cplusplus
} }