012def4ea9069a07c16d351fca6535feb41b6b94
[bertos.git] / drv / buzzerled.h
1 /**
2  * \file
3  * <!--
4  * Copyright 2004 Develer S.r.l. (http://www.develer.com/)
5  * Copyright 2004 Giovanni Bajo
6  * This file is part of DevLib - See README.devlib for information.
7  * -->
8  *
9  * \brief Generic library to handle buzzers and leds
10  *
11  * \version $Id$
12  *
13  * \author Giovanni Bajo <rasky@develer.com>
14  */
15
16 /*#*
17  *#* $Log$
18  *#* Revision 1.8  2006/07/19 12:56:25  bernie
19  *#* Convert to new Doxygen style.
20  *#*
21  *#* Revision 1.7  2005/11/04 16:20:02  bernie
22  *#* Fix reference to README.devlib in header.
23  *#*
24  *#* Revision 1.6  2005/04/11 19:10:27  bernie
25  *#* Include top-level headers from cfg/ subdir.
26  *#*
27  *#* Revision 1.5  2004/08/25 14:12:08  rasky
28  *#* Aggiornato il comment block dei log RCS
29  *#*
30  *#* Revision 1.4  2004/07/30 14:15:53  rasky
31  *#* Nuovo supporto unificato per detect della CPU
32  *#*
33  *#* Revision 1.3  2004/07/14 14:04:29  rasky
34  *#* Merge da SC: spostata bld_set inline perché si ottimizza parecchio tramite propagazione di costanti
35  *#*
36  *#* Revision 1.2  2004/06/03 11:27:09  bernie
37  *#* Add dual-license information.
38  *#*
39  *#* Revision 1.1  2004/05/23 18:36:05  bernie
40  *#* Import buzzerled driver.
41  *#*
42  *#*/
43
44 #ifndef DRV_BUZZERLED_H
45 #define DRV_BUZZERLED_H
46
47 #include <cfg/cpu.h>
48
49 /** Include hw.h. We expect hw.h to define enum BLD_DEVICE, which must contain
50  *  an enumarator for each device, plus a special symbol NUM_BLDS containing the
51  *  number of devices.
52  */
53 #include <hw.h>
54
55
56 /* Include hw-level implementation. This allows inlining of bld_set, which in turns
57  * should allow fast constant propagation for the common case (where the parameter
58  * device is a constant).
59  */
60 #include CPU_HEADER(buzzerled)
61
62
63 /** Initialize the buzzerled library.
64  *
65  * \note This function must be called before any other function in the library.
66  */
67 void bld_init(void);
68
69
70 /** Set or reset a device.
71  *
72  * \param device Device to be set
73  * \param enable Enable/disable status
74  */
75 #define bld_set(device, enable)  bld_hw_set(device, enable)
76
77
78 /** Enable a device for a certain interval of time
79  *
80  * \param device Device to be enabled
81  * \param duration Number of milliseconds the device must be enabled
82  *
83  * \note This function is non-blocking, so it will return immediately.
84  */
85 void bld_beep(enum BLD_DEVICE device, uint16_t duration);
86
87
88 /** Enable a device for a certain interval of time and wait.
89  *
90  * \param device Device to be enabled
91  * \param duration Number of milliseconds the device must be enabled
92  *
93  * \note This function is blocking, so it will return after the specified period of time.
94  */
95 void bld_beep_and_wait(enum BLD_DEVICE device, uint16_t duration);
96
97 #endif /* DRV_BUZZERLED_H */