mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-19 01:52:35 -05:00
Clip: add backlight and buttonlight code
Revive lcd_enable() as well, and use it in _backlight_on/off() Don't update the lcd framebuffer if the display is off git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18952 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
ee593c95e2
commit
603a9c7c7d
34 changed files with 184 additions and 97 deletions
58
firmware/target/arm/as3525/sansa-clip/backlight-clip.c
Normal file
58
firmware/target/arm/as3525/sansa-clip/backlight-clip.c
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2008 Rafaël Carré
|
||||
*
|
||||
* 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 "backlight-target.h"
|
||||
#include "as3525.h"
|
||||
|
||||
/* TODO : backlight brightness */
|
||||
|
||||
/* XXX : xpd is used for SD/MCI interface
|
||||
* If interrupts are used to access this interface, they should be
|
||||
* disabled in _buttonlight_on/off ()
|
||||
*/
|
||||
|
||||
void _buttonlight_on(void)
|
||||
{
|
||||
int saved_ccu_io;
|
||||
|
||||
saved_ccu_io = CCU_IO; /* save XPD setting */
|
||||
|
||||
CCU_IO &= ~(3<<2); /* setup xpd as GPIO */
|
||||
|
||||
GPIOD_DIR |= (1<<7);
|
||||
GPIOD_PIN(7) = (1<<7); /* set pin d7 high */
|
||||
|
||||
CCU_IO = saved_ccu_io; /* restore the previous XPD setting */
|
||||
}
|
||||
|
||||
void _buttonlight_off(void)
|
||||
{
|
||||
int saved_ccu_io;
|
||||
|
||||
saved_ccu_io = CCU_IO; /* save XPD setting */
|
||||
|
||||
CCU_IO &= ~(3<<2); /* setup xpd as GPIO */
|
||||
|
||||
GPIOD_DIR |= (1<<7);
|
||||
GPIOD_PIN(7) = 0; /* set pin d7 low */
|
||||
|
||||
CCU_IO = saved_ccu_io; /* restore the previous XPD setting */
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2008 ??
|
||||
* Copyright © 2008 Rafaël Carré
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
@ -21,17 +21,23 @@
|
|||
#ifndef BACKLIGHT_TARGET_H
|
||||
#define BACKLIGHT_TARGET_H
|
||||
|
||||
static inline bool _backlight_init(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#include "stdbool.h"
|
||||
#include "lcd.h"
|
||||
#include "backlight.h"
|
||||
|
||||
#define _backlight_init() true
|
||||
|
||||
static inline void _backlight_on(void)
|
||||
{
|
||||
lcd_enable(true);
|
||||
}
|
||||
|
||||
static inline void _backlight_off(void)
|
||||
{
|
||||
lcd_enable(false);
|
||||
}
|
||||
|
||||
void _buttonlight_on(void);
|
||||
void _buttonlight_off(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -149,6 +149,9 @@ void lcd_set_flip(bool yesno)
|
|||
|
||||
void lcd_enable(bool enable)
|
||||
{
|
||||
if(display_on == enable)
|
||||
return;
|
||||
|
||||
if( (display_on = enable) ) /* simple '=' is not a typo ! */
|
||||
lcd_write_command(LCD_SET_DISPLAY_ON);
|
||||
else
|
||||
|
|
@ -240,6 +243,9 @@ void lcd_init_device(void)
|
|||
void lcd_blit_mono(const unsigned char *data, int x, int by, int width,
|
||||
int bheight, int stride)
|
||||
{
|
||||
if(!display_on)
|
||||
return;
|
||||
|
||||
/* Copy display bitmap to hardware */
|
||||
while (bheight--)
|
||||
{
|
||||
|
|
@ -258,6 +264,13 @@ void lcd_blit_mono(const unsigned char *data, int x, int by, int width,
|
|||
void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases,
|
||||
int x, int by, int width, int bheight, int stride)
|
||||
{
|
||||
/* TODO */
|
||||
|
||||
#if 0
|
||||
if(!display_on)
|
||||
return;
|
||||
#endif
|
||||
|
||||
(void)values;
|
||||
(void)phases;
|
||||
(void)x;
|
||||
|
|
@ -274,6 +287,9 @@ void lcd_update(void)
|
|||
{
|
||||
int y;
|
||||
|
||||
if(!display_on)
|
||||
return;
|
||||
|
||||
/* Copy display bitmap to hardware */
|
||||
for (y = 0; y < LCD_FBHEIGHT; y++)
|
||||
{
|
||||
|
|
@ -291,6 +307,9 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
{
|
||||
int ymax;
|
||||
|
||||
if(!display_on)
|
||||
return;
|
||||
|
||||
/* The Y coordinates have to work on even 8 pixel rows */
|
||||
ymax = (y + height-1) >> 3;
|
||||
y >>= 3;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue