1
0
Fork 0
forked from len0rd/rockbox

Simulate lcd_enable and lcd_sleep in the simulator. Therefore, turn backlight-sim.h into a .c too.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20829 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-04-29 22:24:40 +00:00
parent ecd4394f62
commit a7f4e1f1c5
9 changed files with 172 additions and 66 deletions

View file

@ -76,6 +76,8 @@
#define HAVE_BACKLIGHT_BRIGHTNESS
/* Which backlight fading type? */
#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_HW_REG
/* Define this if your LCD can be enabled/disabled */
#define HAVE_LCD_ENABLE
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
@ -133,9 +135,6 @@
#ifndef SIMULATOR
/* Define this if your LCD can be enabled/disabled */
#define HAVE_LCD_ENABLE
/* Define this if you have a Motorola SCF5249 */
#define CONFIG_CPU MCF5249

View file

@ -91,6 +91,10 @@
#define HAVE_BACKLIGHT
#define HAVE_BACKLIGHT_BRIGHTNESS
/* Support for LCD sleep/BCM shutdown */
#define HAVE_LCD_SLEEP
#define HAVE_LCD_SLEEP_SETTING
/* We can fade the backlight by using PWM */
#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM
@ -208,9 +212,6 @@
#define HAVE_SERIAL
#ifndef BOOTLOADER
/* Support for LCD sleep/BCM shutdown */
#define HAVE_LCD_SLEEP
#define HAVE_LCD_SLEEP_SETTING
/* The same code may also be used when shutting down the iPod */
#define HAVE_LCD_SHUTDOWN
#endif

View file

@ -90,6 +90,15 @@
#define HAVE_BUTTONLIGHT_BRIGHTNESS
/* Define this if your LCD can be enabled/disabled */
/* TODO: #define HAVE_LCD_ENABLE */
/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
* should be defined as well.
* We can currently put the lcd to sleep but it won't wake up properly */
/*TODO: #define HAVE_LCD_SLEEP*/
/*TODO: #define HAVE_LCD_SLEEP_SETTING <= optional */
#define BATTERY_CAPACITY_DEFAULT 720 /* default battery capacity */
#ifndef SIMULATOR
@ -132,14 +141,6 @@
#define MAX_CONTRAST_SETTING 40
#define DEFAULT_CONTRAST_SETTING 20
/* Define this if your LCD can be enabled/disabled */
/* TODO: #define HAVE_LCD_ENABLE */
/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
* should be defined as well.
* We can currently put the lcd to sleep but it won't wake up properly */
/*TODO: #define HAVE_LCD_SLEEP*/
/*TODO: #define HAVE_LCD_SLEEP_SETTING <= optional */
/* We're able to shut off power to the HDD */
#define HAVE_ATA_POWER_OFF

View file

@ -9,4 +9,5 @@ sim_icons.c
sim_tasks.c
stubs.c
powermgmt-sim.c
backlight-sim.c

View file

@ -0,0 +1,84 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2009 by Thomas Martitz
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include <stdbool.h>
#include "config.h"
#include "backlight.h"
#include "lcd.h"
#ifdef HAVE_LCD_SLEEP
extern void lcd_awake(void);
#endif
/* in uisimulator/sdl/lcd-bitmap.c and lcd-charcell.c */
extern void sim_backlight(int value);
void _backlight_on(void)
{
sim_backlight(100);
#if defined(HAVE_LCD_ENABLE)
lcd_enable(true);
#elif defined(HAVE_LCD_SLEEP)
lcd_awake();
#endif
}
void _backlight_off(void)
{
sim_backlight(0);
#ifdef HAVE_LCD_ENABLE
lcd_enable(false);
#endif
}
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
void _backlight_set_brightness(int val)
{
(void)val;
}
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
#ifdef HAVE_BUTTON_LIGHT
void _buttonlight_on(void)
{
}
void _buttonlight_off(void)
{
}
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
void _buttonlight_set_brightness(int val)
{
(void)val;
}
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
#endif /* HAVE_BUTTON_LIGHT */
#ifdef HAVE_REMOTE_LCD
void _remote_backlight_on(void)
{
sim_remote_backlight(100);
}
void _remote_backlight_off(void)
{
sim_remote_backlight(0);
}
#endif /* HAVE_REMOTE_LCD */

View file

@ -5,9 +5,8 @@
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
* $Id:$
*
* Copyright (C) 2002 by Linus Nielsen Feltzing
* Copyright (C) 2009 by Thomas Martitz
*
* This program is free software; you can redistribute it and/or
@ -19,50 +18,31 @@
* KIND, either express or implied.
*
****************************************************************************/
#ifdef SIMULATOR
static inline void _backlight_on(void)
{
sim_backlight(100);
}
#ifndef BACKLIGHT_SIM_H
#define BACKLIGHT_SIM_H
#include "config.h"
void _backlight_on(void);
void _backlight_off(void);
static inline void _backlight_off(void)
{
sim_backlight(0);
}
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
static inline void _backlight_set_brightness(int val)
{
(void)val;
}
void _backlight_set_brightness(int val);
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
#ifdef HAVE_BUTTON_LIGHT
static inline void _buttonlight_on(void)
{
}
static inline void _buttonlight_off(void)
{
}
void _buttonlight_on(void);
void _buttonlight_off(void);
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
static inline void _buttonlight_set_brightness(int val)
{
(void)val;
}
void _buttonlight_set_brightness(int val);
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
#endif /* HAVE_BUTTON_LIGHT */
#ifdef HAVE_REMOTE_LCD
static inline void _remote_backlight_on(void)
{
sim_remote_backlight(100);
}
static inline void _remote_backlight_off(void)
{
sim_remote_backlight(0);
}
void _remote_backlight_on(void);
void _remote_backlight_off(void);
#endif /* HAVE_REMOTE_LCD */
#endif /* SIMULATOR */
#endif /* BACKLIGHT_SIM_H */

View file

@ -22,8 +22,15 @@
*
****************************************************************************/
#include "config.h"
#include "lcd.h"
#include "lcd-sdl.h"
#ifdef HAVE_LCD_ENABLE
static bool lcd_enabled = false;
#endif
#ifdef HAVE_LCD_SLEEP
static bool lcd_sleeping = true;
#endif
void lcd_set_flip(bool yesno)
{
@ -64,3 +71,49 @@ void lcd_remote_set_invert_display(bool invert)
(void)invert;
}
#endif
#ifdef HAVE_LCD_SLEEP
void lcd_sleep(void)
{
lcd_sleeping = true;
}
void lcd_awake(void)
{
if (lcd_sleeping)
{
lcd_activation_call_hook();
lcd_sleeping = false;
}
}
#endif
#ifdef HAVE_LCD_ENABLE
void lcd_enable(bool on)
{
if (on && !lcd_enabled)
{
#ifdef HAVE_LCD_SLEEP
/* lcd_awake will handle the activation call */
lcd_awake();
#else
lcd_activation_call_hook();
#endif
}
lcd_enabled = on;
}
#endif
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
bool lcd_active(void)
{
bool retval = false;
#ifdef HAVE_LCD_ENABLE
retval = lcd_enabled;
#endif
#ifdef HAVE_LCD_SLEEP
if (!retval)
retval = !lcd_sleeping;
#endif
return retval;
}
#endif

View file

@ -202,19 +202,6 @@ bool headphones_inserted(void)
}
#endif
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
bool lcd_active(void)
{
return true;
}
#endif
#ifdef HAVE_LCD_SLEEP
void lcd_sleep(void)
{
}
#endif
#ifdef HAVE_SPDIF_POWER
void spdif_power_enable(bool on)
{

View file

@ -28,7 +28,7 @@ $(SIMLIB): $$(SIMOBJ) $(UIBMP)
$(SILENT)$(shell rm -f $@)
$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null
$(BUILDDIR)/$(BINARY): $$(OBJ) $(SIMLIB) $(VOICESPEEXLIB) $(FIRMLIB)
$(BUILDDIR)/$(BINARY): $$(OBJ) $(FIRMLIB) $(SIMLIB) $(VOICESPEEXLIB)
$(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(LDOPTS)
$(BUILDDIR)/uisimulator/%.o: $(ROOTDIR)/uisimulator/%.c