Nuovo supporto unificato per detect della CPU
[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 devlib/README 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.4  2004/07/30 14:15:53  rasky
19  * Nuovo supporto unificato per detect della CPU
20  *
21  * Revision 1.3  2004/07/14 14:04:29  rasky
22  * Merge da SC: spostata bld_set inline perché si ottimizza parecchio tramite propagazione di costanti
23  *
24  * Revision 1.2  2004/06/03 11:27:09  bernie
25  * Add dual-license information.
26  *
27  * Revision 1.1  2004/05/23 18:36:05  bernie
28  * Import buzzerled driver.
29  *
30  */
31
32 #ifndef DRV_BUZZERLED_H
33 #define DRV_BUZZERLED_H
34
35 #include <cpu.h>
36
37 /*! Include hw.h. We expect hw.h to define enum BLD_DEVICE, which must contain
38  *  an enumarator for each device, plus a special symbol NUM_BLDS containing the
39  *  number of devices.
40  */
41 #include <hw.h>
42
43
44 /* Include hw-level implementation. This allows inlining of bld_set, which in turns
45  * should allow fast constant propagation for the common case (where the parameter
46  * device is a constant).
47  */
48 #include CPU_HEADER(buzzerled)
49
50
51 /*! Initialize the buzzerled library.
52  *
53  * \note This function must be called before any other function in the library.
54  */
55 void bld_init(void);
56
57
58 /*! Set or reset a device.
59  *
60  * \param device Device to be set
61  * \param enable Enable/disable status
62  */
63 #define bld_set(device, enable)  bld_hw_set(device, enable)
64
65
66 /*! Enable a device for a certain interval of time
67  *
68  * \param device Device to be enabled
69  * \param duration Number of milliseconds the device must be enabled
70  *
71  * \note This function is non-blocking, so it will return immediately.
72  */
73 void bld_beep(enum BLD_DEVICE device, uint16_t duration);
74
75
76 /*! Enable a device for a certain interval of time and wait.
77  *
78  * \param device Device to be enabled
79  * \param duration Number of milliseconds the device must be enabled
80  *
81  * \note This function is blocking, so it will return after the specified period of time.
82  */
83 void bld_beep_and_wait(enum BLD_DEVICE device, uint16_t duration);
84
85 #endif /* DRV_BUZZERLED_H */