comparison target-utils/buzplayer/melplay.c @ 81:8a200d65c6a0

buzplayer: play implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 27 Oct 2016 04:39:48 +0000
parents
children 158dd05fb9f9
comparison
equal deleted inserted replaced
80:eb5960dc258c 81:8a200d65c6a0
1 #include "types.h"
2 #include "melody.h"
3
4 extern struct melentry *melody_buf_start, *melody_buf_tailptr;
5
6 #define ARMIO_LOAD_TIM (*(volatile u16 *) 0xFFFE4808)
7 #define BUZZ_LIGHT_REG (*(volatile u16 *) 0xFFFE480E)
8
9 void
10 melody_play()
11 {
12 struct melentry *p;
13 int count;
14
15 wait_for_tdma_frame();
16 for (p = melody_buf_start; p < melody_buf_tailptr; p++) {
17 if (p->tone) {
18 ARMIO_LOAD_TIM = p->tone;
19 BUZZ_LIGHT_REG = 1;
20 } else
21 BUZZ_LIGHT_REG = 0;
22 for (count = p->dur; count; count--)
23 wait_for_tdma_frame();
24 BUZZ_LIGHT_REG = 0;
25 }
26 }