buzzerled.c
Go to the documentation of this file.00001
00052 #include "buzzerled.h"
00053
00054 #warning FIXME:This drive is obsolete, you must refactor it.
00055
00056 #if 0
00057 #include "cfg/cfg_buzzerled.h"
00058 #include <drv/timer.h>
00059
00060 static struct Timer timers[CONFIG_NUM_BLDS];
00061 static bool timer_go[CONFIG_NUM_BLDS];
00062
00063 INLINE enum BLD_DEVICE hook_parm_to_device(void* parm)
00064 {
00065 struct Timer* t = (struct Timer*)parm;
00066 int num_bld = t - &timers[0];
00067
00068 ASSERT(num_bld >= 0);
00069 ASSERT(num_bld < NUM_BLDS);
00070
00071 return (enum BLD_DEVICE)num_bld;
00072 }
00073
00074 static void hook_turn_off(void* parm)
00075 {
00076 enum BLD_DEVICE num_bld = hook_parm_to_device(parm);
00077 bld_set(num_bld, false);
00078 }
00079
00080 void bld_init(void)
00081 {
00082 bld_hw_init();
00083 }
00084
00085 void bld_beep(enum BLD_DEVICE device, uint16_t duration)
00086 {
00087
00088 struct Timer *t = &timers[device];
00089 timer_set_delay(t, duration);
00090 timer_set_event_softint(t, hook_turn_off, t);
00091 timer_add(t);
00092
00093 bld_set(device, true);
00094 }
00095
00096 void bld_beep_and_wait(enum BLD_DEVICE device, uint16_t duration)
00097 {
00098 bld_set(device, true);
00099 timer_delay(duration);
00100 bld_set(device, false);
00101 }
00102 #endif
00103