altos/test: Adjust CRC error rate after FEC fix
[fw/altos] / src / kernel / ao_beep.h
1 /*
2  * Copyright © 2012 Keith Packard <keithp@keithp.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17  */
18
19 #ifndef _AO_BEEP_H_
20 #define _AO_BEEP_H_
21
22 /*
23  * ao_beep.c
24  */
25
26 /*
27  * Various pre-defined beep frequencies
28  *
29  * frequency = 1/2 (24e6/32) / beep
30  */
31
32 #ifndef AO_BEEP_MID_DEFAULT
33 #define AO_BEEP_MID_DEFAULT     94      /* 3989Hz */
34 #endif
35
36 #define AO_BEEP_MID     ((int) ao_config.mid_beep)
37
38 #define AO_BEEP_MID_PANIC       AO_BEEP_MID_DEFAULT
39
40 #ifndef AO_BEEP_MAKE_LOW
41 #define AO_BEEP_MAKE_LOW(m)     ((uint8_t) ((m) * 150 / 94))    /* 2500Hz */
42 #endif
43
44 #ifndef AO_BEEP_MAKE_HIGH
45 #define AO_BEEP_MAKE_HIGH(m)    ((uint8_t) ((m) * 75 / 94))     /* 5000Hz */
46 #endif
47
48 #define AO_BEEP_LOW     AO_BEEP_MAKE_LOW(AO_BEEP_MID)
49 #define AO_BEEP_HIGH    AO_BEEP_MAKE_HIGH(AO_BEEP_MID)
50
51 #define AO_BEEP_LOW_PANIC       AO_BEEP_MAKE_LOW(AO_BEEP_MID_PANIC)
52 #define AO_BEEP_HIGH_PANIC      AO_BEEP_MAKE_HIGH(AO_BEEP_MID_PANIC)
53
54 #define AO_BEEP_OFF     0       /* off */
55
56 #define AO_BEEP_g       240     /* 1562.5Hz */
57 #define AO_BEEP_gs      227     /* 1652Hz (1655Hz) */
58 #define AO_BEEP_aa      214     /* 1752Hz (1754Hz) */
59 #define AO_BEEP_bbf     202     /* 1856Hz (1858Hz) */
60 #define AO_BEEP_bb      190     /* 1974Hz (1969Hz) */
61 #define AO_BEEP_cc      180     /* 2083Hz (2086Hz) */
62 #define AO_BEEP_ccs     170     /* 2205Hz (2210Hz) */
63 #define AO_BEEP_dd      160     /* 2344Hz (2341Hz) */
64 #define AO_BEEP_eef     151     /* 2483Hz (2480Hz) */
65 #define AO_BEEP_ee      143     /* 2622Hz (2628Hz) */
66 #define AO_BEEP_ff      135     /* 2778Hz (2784Hz) */
67 #define AO_BEEP_ffs     127     /* 2953Hz (2950Hz) */
68 #define AO_BEEP_gg      120     /* 3125Hz */
69 #define AO_BEEP_ggs     113     /* 3319Hz (3311Hz) */
70 #define AO_BEEP_aaa     107     /* 3504Hz (3508Hz) */
71 #define AO_BEEP_bbbf    101     /* 3713Hz (3716Hz) */
72 #define AO_BEEP_bbb     95      /* 3947Hz (3937Hz) */
73 #define AO_BEEP_ccc     90      /* 4167Hz (4171Hz) */
74 #define AO_BEEP_cccs    85      /* 4412Hz (4419Hz) */
75 #define AO_BEEP_ddd     80      /* 4688Hz (4682Hz) */
76 #define AO_BEEP_eeef    76      /* 4934Hz (4961Hz) */
77 #define AO_BEEP_eee     71      /* 5282Hz (5256Hz) */
78 #define AO_BEEP_fff     67      /* 5597Hz (5568Hz) */
79 #define AO_BEEP_fffs    64      /* 5859Hz (5899Hz) */
80 #define AO_BEEP_ggg     60      /* 6250Hz */
81
82 /* Set the beeper to the specified tone */
83 void
84 ao_beep(uint8_t beep);
85
86 /* Turn on the beeper for the specified time */
87 void
88 ao_beep_for(uint8_t beep, AO_TICK_TYPE ticks);
89
90 /* Initialize the beeper */
91 void
92 ao_beep_init(void);
93
94 #endif /* _AO_BEEP_H_ */