*
* \brief Generic text LCD driver (impl.).
*
- * \version $Id$
* \author Bernie Innocenti <bernie@codewiz.org>
* \author Stefano Fedrigo <aleph@develer.com>
*/
void lcd_setAddr(Layer *layer, lcdpos_t addr)
{
/* Sanity check: wrap around to display limits */
- while (addr >= LCD_ROWS * LCD_COLS)
- addr -= LCD_ROWS * LCD_COLS;
+ while (addr >= CONFIG_LCD_ROWS * CONFIG_LCD_COLS)
+ addr -= CONFIG_LCD_ROWS * CONFIG_LCD_COLS;
layer->addr = addr;
}
layer->buf[addr] = c;
/* Move to next character */
- if (++layer->addr >= LCD_COLS * LCD_ROWS)
+ if (++layer->addr >= CONFIG_LCD_COLS * CONFIG_LCD_ROWS)
layer->addr = 0;
/* Do not write on LCD if layer is hidden. */
LOCK_LCD;
lcd_setAddr(layer, 0);
- for (i = 0; i < LCD_COLS * LCD_ROWS; i++)
+ for (i = 0; i < CONFIG_LCD_COLS * CONFIG_LCD_ROWS; i++)
lcd_putCharUnlocked(c, layer);
UNLOCK_LCD;
}
LOCK_LCD;
lcd_setAddr(layer, LCD_POS(0, y));
- for (i = 0; i < LCD_COLS; i++)
+ for (i = 0; i < CONFIG_LCD_COLS; i++)
lcd_putCharUnlocked(0, layer);
UNLOCK_LCD;
}
* NOTE: calculating the string lenght BEFORE it gets
* printf()-formatted. Real lenght may differ.
*/
- pad = (LCD_COLS - strlen(format)) / 2;
+ pad = (CONFIG_LCD_COLS - strlen(format)) / 2;
while (pad--)
lcd_putCharUnlocked(' ', layer);
}
len = _formatted_write(format, (void (*)(char, void *))lcd_putCharUnlocked, layer, ap);
if (mode & (LCD_FILL | LCD_CENTER))
- while (layer->addr % LCD_COLS)
+ while (layer->addr % CONFIG_LCD_COLS)
lcd_putCharUnlocked(' ', layer);
/*
layer = (Layer *)LIST_HEAD(&lcd_FreeLayers);
layer->addr = 0;
- memset(layer->buf, 0, LCD_ROWS * LCD_COLS);
+ memset(layer->buf, 0, CONFIG_LCD_ROWS * CONFIG_LCD_COLS);
lcd_enqueueLayer(layer, pri);
lcdpos_t addr;
Layer *l;
- for (addr = 0; addr < LCD_ROWS * LCD_COLS; ++addr)
+ for (addr = 0; addr < CONFIG_LCD_ROWS * CONFIG_LCD_COLS; ++addr)
{
FOREACH_NODE(l, &lcd_Layers)
{
lcdpos_t addr;
/* Repair damage on underlaying layers */
- for (addr = 0; addr < LCD_ROWS * LCD_COLS; ++addr)
+ for (addr = 0; addr < CONFIG_LCD_ROWS * CONFIG_LCD_COLS; ++addr)
{
/* If location was covered by us */
if (layer->buf[addr])
#include <cfg/debug.h>
void lcd_init(void)
{
+ #if CONFIG_KERN
+ sem_init(&lcd_semaphore);
+ #endif
+
int i;
LIST_INIT(&lcd_Layers);