mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
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:
parent
ecd4394f62
commit
a7f4e1f1c5
9 changed files with 172 additions and 66 deletions
|
@ -76,6 +76,8 @@
|
||||||
#define HAVE_BACKLIGHT_BRIGHTNESS
|
#define HAVE_BACKLIGHT_BRIGHTNESS
|
||||||
/* Which backlight fading type? */
|
/* Which backlight fading type? */
|
||||||
#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_HW_REG
|
#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 this if you have a software controlled poweroff */
|
||||||
#define HAVE_SW_POWEROFF
|
#define HAVE_SW_POWEROFF
|
||||||
|
@ -133,9 +135,6 @@
|
||||||
|
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
|
|
||||||
/* Define this if your LCD can be enabled/disabled */
|
|
||||||
#define HAVE_LCD_ENABLE
|
|
||||||
|
|
||||||
/* Define this if you have a Motorola SCF5249 */
|
/* Define this if you have a Motorola SCF5249 */
|
||||||
#define CONFIG_CPU MCF5249
|
#define CONFIG_CPU MCF5249
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,10 @@
|
||||||
#define HAVE_BACKLIGHT
|
#define HAVE_BACKLIGHT
|
||||||
#define HAVE_BACKLIGHT_BRIGHTNESS
|
#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 */
|
/* We can fade the backlight by using PWM */
|
||||||
#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM
|
#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM
|
||||||
|
|
||||||
|
@ -208,9 +212,6 @@
|
||||||
#define HAVE_SERIAL
|
#define HAVE_SERIAL
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#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 */
|
/* The same code may also be used when shutting down the iPod */
|
||||||
#define HAVE_LCD_SHUTDOWN
|
#define HAVE_LCD_SHUTDOWN
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -90,6 +90,15 @@
|
||||||
|
|
||||||
#define HAVE_BUTTONLIGHT_BRIGHTNESS
|
#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 */
|
#define BATTERY_CAPACITY_DEFAULT 720 /* default battery capacity */
|
||||||
|
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
|
@ -132,14 +141,6 @@
|
||||||
#define MAX_CONTRAST_SETTING 40
|
#define MAX_CONTRAST_SETTING 40
|
||||||
#define DEFAULT_CONTRAST_SETTING 20
|
#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 */
|
/* We're able to shut off power to the HDD */
|
||||||
#define HAVE_ATA_POWER_OFF
|
#define HAVE_ATA_POWER_OFF
|
||||||
|
|
|
@ -9,4 +9,5 @@ sim_icons.c
|
||||||
sim_tasks.c
|
sim_tasks.c
|
||||||
stubs.c
|
stubs.c
|
||||||
powermgmt-sim.c
|
powermgmt-sim.c
|
||||||
|
backlight-sim.c
|
||||||
|
|
||||||
|
|
84
uisimulator/common/backlight-sim.c
Normal file
84
uisimulator/common/backlight-sim.c
Normal 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 */
|
|
@ -5,9 +5,8 @@
|
||||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
* \/ \/ \/ \/ \/
|
* \/ \/ \/ \/ \/
|
||||||
* $Id$
|
* $Id:$
|
||||||
*
|
*
|
||||||
* Copyright (C) 2002 by Linus Nielsen Feltzing
|
|
||||||
* Copyright (C) 2009 by Thomas Martitz
|
* Copyright (C) 2009 by Thomas Martitz
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -19,50 +18,31 @@
|
||||||
* KIND, either express or implied.
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifdef SIMULATOR
|
|
||||||
|
|
||||||
static inline void _backlight_on(void)
|
#ifndef BACKLIGHT_SIM_H
|
||||||
{
|
#define BACKLIGHT_SIM_H
|
||||||
sim_backlight(100);
|
|
||||||
}
|
#include "config.h"
|
||||||
|
|
||||||
|
void _backlight_on(void);
|
||||||
|
void _backlight_off(void);
|
||||||
|
|
||||||
static inline void _backlight_off(void)
|
|
||||||
{
|
|
||||||
sim_backlight(0);
|
|
||||||
}
|
|
||||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||||
static inline void _backlight_set_brightness(int val)
|
void _backlight_set_brightness(int val);
|
||||||
{
|
|
||||||
(void)val;
|
|
||||||
}
|
|
||||||
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
|
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
|
||||||
#ifdef HAVE_BUTTON_LIGHT
|
#ifdef HAVE_BUTTON_LIGHT
|
||||||
static inline void _buttonlight_on(void)
|
void _buttonlight_on(void);
|
||||||
{
|
void _buttonlight_off(void);
|
||||||
}
|
|
||||||
|
|
||||||
static inline void _buttonlight_off(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
|
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
|
||||||
static inline void _buttonlight_set_brightness(int val)
|
void _buttonlight_set_brightness(int val);
|
||||||
{
|
|
||||||
(void)val;
|
|
||||||
}
|
|
||||||
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
|
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
|
||||||
#endif /* HAVE_BUTTON_LIGHT */
|
#endif /* HAVE_BUTTON_LIGHT */
|
||||||
|
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
static inline void _remote_backlight_on(void)
|
void _remote_backlight_on(void);
|
||||||
{
|
void _remote_backlight_off(void);
|
||||||
sim_remote_backlight(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void _remote_backlight_off(void)
|
|
||||||
{
|
|
||||||
sim_remote_backlight(0);
|
|
||||||
}
|
|
||||||
#endif /* HAVE_REMOTE_LCD */
|
#endif /* HAVE_REMOTE_LCD */
|
||||||
|
|
||||||
#endif /* SIMULATOR */
|
|
||||||
|
#endif /* BACKLIGHT_SIM_H */
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,15 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include "lcd.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)
|
void lcd_set_flip(bool yesno)
|
||||||
{
|
{
|
||||||
|
@ -64,3 +71,49 @@ void lcd_remote_set_invert_display(bool invert)
|
||||||
(void)invert;
|
(void)invert;
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
||||||
|
|
|
@ -202,19 +202,6 @@ bool headphones_inserted(void)
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
#ifdef HAVE_SPDIF_POWER
|
||||||
void spdif_power_enable(bool on)
|
void spdif_power_enable(bool on)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,7 @@ $(SIMLIB): $$(SIMOBJ) $(UIBMP)
|
||||||
$(SILENT)$(shell rm -f $@)
|
$(SILENT)$(shell rm -f $@)
|
||||||
$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null
|
$(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)
|
$(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(LDOPTS)
|
||||||
|
|
||||||
$(BUILDDIR)/uisimulator/%.o: $(ROOTDIR)/uisimulator/%.c
|
$(BUILDDIR)/uisimulator/%.o: $(ROOTDIR)/uisimulator/%.c
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue