FreeCalypso > hg > freecalypso-tools
annotate target-utils/buzplayer/melplay.c @ 752:c79aaed75bd8
compile-fc-batt: allow possible third field in source lines
Battery tables maintained in the fc-battery-conf repository will now
have a third field added, defining thresholds for the battery bars icon,
and there will be a new utility to compile them into the new
/etc/batterytab2 file read by the FC Tourmaline version of our
FCHG driver. For backward compatibility with the original Magnetite
version of FCHG, compile-fc-batt remains the tool for compiling the
original /etc/batterytab file format, and it needs to ignore the
newly added third field in battery table sources.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 05 Nov 2020 20:37:55 +0000 |
parents | 8a200d65c6a0 |
children | 158dd05fb9f9 |
rev | line source |
---|---|
81
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 #include "types.h" |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 #include "melody.h" |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 extern struct melentry *melody_buf_start, *melody_buf_tailptr; |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #define ARMIO_LOAD_TIM (*(volatile u16 *) 0xFFFE4808) |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #define BUZZ_LIGHT_REG (*(volatile u16 *) 0xFFFE480E) |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 void |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 melody_play() |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 { |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 struct melentry *p; |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 int count; |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 wait_for_tdma_frame(); |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 for (p = melody_buf_start; p < melody_buf_tailptr; p++) { |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 if (p->tone) { |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 ARMIO_LOAD_TIM = p->tone; |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 BUZZ_LIGHT_REG = 1; |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 } else |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 BUZZ_LIGHT_REG = 0; |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 for (count = p->dur; count; count--) |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 wait_for_tdma_frame(); |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 BUZZ_LIGHT_REG = 0; |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 } |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 } |