* the GNU General Public License.
*
* Copyright 2005 Develer S.r.l. (http://www.develer.com/)
- *
+ * All Rights Reserved.
* -->
*
* \brief Generic text LCD driver (impl.).
*
* \version $Id$
- * \author Bernardo Innocenti <bernie@develer.com>
+ * \author Bernie Innocenti <bernie@codewiz.org>
* \author Stefano Fedrigo <aleph@develer.com>
*/
#include "lcd_text.h"
#include "lcd_hd44.h"
-#include <drv/timer.h> // timer_delay()
-#include <mware/formatwr.h> // _formatted_write()
-#include <mware/list.h> // LIST_EMPTY()
+
#include <cfg/macros.h> // BV()
#include <cfg/debug.h>
+#include <drv/timer.h> // timer_delay()
+
+#include <mware/formatwr.h> // _formatted_write()
+#include <struct/list.h> // LIST_EMPTY()
+
#include <string.h> // strlen()
/** Maximum number of layers. */
#define LCD_LAYERS 6
-#if CONFIG_KERNEL
+#if CONFIG_KERN
+ #include <kern/sem.h>
/** Semaphore to arbitrate access to the display. */
static struct Semaphore lcd_semaphore;
#define LOCK_LCD sem_obtain(&lcd_semaphore)
#define UNLOCK_LCD sem_release(&lcd_semaphore)
-#else /* !CONFIG_KERNEL */
+#else /* !CONFIG_KERN */
#define LOCK_LCD do {} while (0)
#define UNLOCK_LCD do {} while (0)
-#endif /* !CONFIG_KERNEL */
+#endif /* !CONFIG_KERN */
DECLARE_LIST_TYPE(Layer);
layer->addr = addr;
}
-#if CONFIG_KERNEL
+#if CONFIG_KERN
void lcd_lock(void)
{
UNLOCK_LCD;
}
-#endif /* CONFIG_KERNEL */
+#endif /* CONFIG_KERN */
/**
#include <cfg/debug.h>
void lcd_init(void)
{
+ #if CONFIG_KERN
+ sem_init(&lcd_semaphore);
+ #endif
+
int i;
LIST_INIT(&lcd_Layers);
lcd_setCursor(0);
}
-#if CONFIG_TEST
-void lcd_test(void)
-{
- int i;
-
- for (i = 0; i < LCD_ROWS * LCD_COLS; ++i)
- {
- lcd_putCharUnlocked('0' + (i % 10), lcd_DefLayer);
- timer_delay(100);
- }
-}
-#endif /* CONFIG_TEST */