diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2011-04-24 19:32:42 +0200 |
---|---|---|
committer | Sylvain Munaut <tnt@246tNt.com> | 2011-04-24 19:38:22 +0200 |
commit | d9639bb010d05a96a6cbced94668c5754a4f0de9 (patch) | |
tree | 0d300b732e20734abf8aaae2b10aac3db445f080 /src/target/firmware/include/calypso/buzzer.h | |
parent | 03ce0a402c543abd15d85c2cd82f2727b9daaa0a (diff) |
fw/calypso: Add a new driver for the buzzer control
Written-by: Jose Luis Pereira <onaips@gmail.com>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src/target/firmware/include/calypso/buzzer.h')
-rw-r--r-- | src/target/firmware/include/calypso/buzzer.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/target/firmware/include/calypso/buzzer.h b/src/target/firmware/include/calypso/buzzer.h new file mode 100644 index 00000000..dcfd3a30 --- /dev/null +++ b/src/target/firmware/include/calypso/buzzer.h @@ -0,0 +1,34 @@ +#ifndef _CAL_BUZZER_H +#define _CAL_BUZZER_H + +#define NOTE(n,oct) (n<<2 | (oct & 0x03)) + +#define NOTE_E 0x00 +#define NOTE_DIS 0x01 +#define NOTE_D 0x02 +#define NOTE_CIS 0x03 +#define NOTE_C 0x04 +#define NOTE_H 0x05 +#define NOTE_AIS 0x06 +#define NOTE_A 0x07 +#define NOTE_GIS 0x08 +#define NOTE_G 0x09 +#define NOTE_FIS 0x0A +#define NOTE_F 0x0B + +#define OCTAVE_5 OCTAVE(0x00) +#define OCTAVE_4 OCTAVE(0x01) +#define OCTAVE_3 OCTAVE(0x02) +#define OCTAVE_2 OCTAVE(0x03) +#define OCTAVE_1 OCTAVE(0x04) + +#define OCTAVE(m) (m>NOTE_C?m+1:m) + +/* Switch buzzer to PWT mode (or back) */ +void buzzer_mode_pwt(int on); +/* Set the buzzer level */ +void buzzer_volume(uint8_t level); +/* Set the buzzer note */ +void buzzer_note(uint8_t note); + +#endif /* _CAL_BUZZER_H */ |