forked from len0rd/rockbox
Get rid of stupid _backlight_* function names
_remote_backlight_* and _buttonlight_* are cleaned as well Change-Id: I73653752831bbe170c26ba95d3bc04c2e3a5cf30
This commit is contained in:
parent
2a3e1628a5
commit
89ba7e818c
148 changed files with 679 additions and 687 deletions
|
|
@ -24,13 +24,13 @@
|
|||
#include "backlight.h"
|
||||
#include "backlight-target.h"
|
||||
|
||||
void _backlight_on(void)
|
||||
void backlight_hw_on(void)
|
||||
{
|
||||
LCD1_CONTROL |= 0x02;
|
||||
lcd_set_backlight_inversion(true);
|
||||
}
|
||||
|
||||
void _backlight_off(void)
|
||||
void backlight_hw_off(void)
|
||||
{
|
||||
LCD1_CONTROL &= ~0x02;
|
||||
lcd_set_backlight_inversion(false);
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
#ifndef BACKLIGHT_TARGET_H
|
||||
#define BACKLIGHT_TARGET_H
|
||||
|
||||
#define _backlight_init() false
|
||||
void _backlight_on(void);
|
||||
void _backlight_off(void);
|
||||
#define backlight_hw_init() false
|
||||
void backlight_hw_on(void);
|
||||
void backlight_hw_off(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@
|
|||
#include "backlight.h"
|
||||
#include "backlight-target.h"
|
||||
|
||||
void _backlight_on(void)
|
||||
void backlight_hw_on(void)
|
||||
{
|
||||
LCD1_CONTROL |= 0x02;
|
||||
}
|
||||
|
||||
void _backlight_off(void)
|
||||
void backlight_hw_off(void)
|
||||
{
|
||||
LCD1_CONTROL &= ~0x02;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@ static unsigned char log_brightness[32] = {
|
|||
static unsigned brightness = 100; /* 1 to 255 */
|
||||
static bool enabled = false;
|
||||
|
||||
/* Handling B03 in _backlight_on() and _backlight_off() makes backlight go off
|
||||
/* Handling B03 in backlight_hw_on() and backlight_hw_off() makes backlight go off
|
||||
* without delay. Not doing that does a short (fixed) fade out. Opt for the
|
||||
* latter. */
|
||||
|
||||
void _backlight_on(void)
|
||||
void backlight_hw_on(void)
|
||||
{
|
||||
/* brightness full */
|
||||
outl(0x80000000 | (brightness << 16), 0x7000a010);
|
||||
|
|
@ -56,27 +56,27 @@ void _backlight_on(void)
|
|||
enabled = true;
|
||||
}
|
||||
|
||||
void _backlight_off(void)
|
||||
void backlight_hw_off(void)
|
||||
{
|
||||
outl(0x80000000, 0x7000a010);
|
||||
GPIO_CLEAR_BITWISE(GPIOB_OUTPUT_VAL, 0x08);
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
void _backlight_set_brightness(int val)
|
||||
void backlight_hw_brightness(int val)
|
||||
{
|
||||
brightness = log_brightness[val];
|
||||
if (enabled)
|
||||
outl(0x80000000 | (brightness << 16), 0x7000a010);
|
||||
}
|
||||
|
||||
bool _backlight_init(void)
|
||||
bool backlight_hw_init(void)
|
||||
{
|
||||
GPIO_SET_BITWISE(GPIOB_ENABLE, 0x0c); /* B02 and B03 enable */
|
||||
GPIO_SET_BITWISE(GPIOB_OUTPUT_VAL, 0x08); /* B03 = 1 */
|
||||
GPO32_ENABLE &= ~0x2000000; /* D01 disable, so pwm takes over */
|
||||
DEV_EN |= DEV_PWM; /* PWM enable */
|
||||
|
||||
_backlight_on();
|
||||
backlight_hw_on();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ static int brightness = 1; /* 1 to 32 */
|
|||
static int current_dim = 16; /* default after enabling the backlight dimmer */
|
||||
static bool enabled = false;
|
||||
|
||||
void _backlight_set_brightness(int val)
|
||||
void backlight_hw_brightness(int val)
|
||||
{
|
||||
int oldlevel;
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ void _backlight_hw_enable(bool on)
|
|||
GPIO_SET_BITWISE(GPIOD_OUTPUT_VAL, 0x80);
|
||||
sleep(HZ/100);
|
||||
current_dim = 16;
|
||||
_backlight_set_brightness(brightness);
|
||||
backlight_hw_brightness(brightness);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -116,7 +116,7 @@ void _backlight_led_off(void)
|
|||
GPIO_CLEAR_BITWISE(GPIOL_OUTPUT_VAL, 0x80);
|
||||
}
|
||||
|
||||
bool _backlight_init(void)
|
||||
bool backlight_hw_init(void)
|
||||
{
|
||||
GPIO_SET_BITWISE(GPIOB_ENABLE, 0x08);
|
||||
GPIO_SET_BITWISE(GPIOB_OUTPUT_EN, 0x08);
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
#if defined(IPOD_VIDEO) || defined(IPOD_NANO)
|
||||
|
||||
bool _backlight_init(void);
|
||||
void _backlight_set_brightness(int val);
|
||||
bool backlight_hw_init(void);
|
||||
void backlight_hw_brightness(int val);
|
||||
void _backlight_led_on(void);
|
||||
void _backlight_led_off(void);
|
||||
void _backlight_hw_enable(bool on);
|
||||
|
|
@ -34,48 +34,48 @@ void lcd_awake(void);
|
|||
#endif
|
||||
|
||||
#ifdef BOOTLOADER
|
||||
#define _backlight_on() do { _backlight_hw_enable(true); \
|
||||
#define backlight_hw_on() do { _backlight_hw_enable(true); \
|
||||
_backlight_led_on(); } while(0)
|
||||
#define _backlight_off() do { _backlight_led_off(); \
|
||||
#define backlight_hw_off() do { _backlight_led_off(); \
|
||||
_backlight_hw_enable(false); } while(0)
|
||||
#else /* !BOOTLOADER */
|
||||
#define _backlight_on_isr() _backlight_led_on()
|
||||
#define _backlight_off_isr() _backlight_led_off()
|
||||
#define _backlight_on_normal() do { _backlight_hw_enable(true); \
|
||||
#define backlight_hw_on_isr() _backlight_led_on()
|
||||
#define backlight_hw_off_isr() _backlight_led_off()
|
||||
#define backlight_hw_on_normal() do { _backlight_hw_enable(true); \
|
||||
_backlight_led_on(); } while(0)
|
||||
#define _backlight_off_normal() do { _backlight_led_off(); \
|
||||
#define backlight_hw_off_normal() do { _backlight_led_off(); \
|
||||
_backlight_hw_enable(false); } while(0)
|
||||
#define _BACKLIGHT_FADE_ENABLE
|
||||
#endif /* !BOOTLOADER */
|
||||
|
||||
#elif defined(IPOD_4G) || defined(IPOD_COLOR)
|
||||
|
||||
bool _backlight_init(void);
|
||||
void _backlight_on(void);
|
||||
void _backlight_off(void);
|
||||
void _backlight_set_brightness(int val);
|
||||
bool backlight_hw_init(void);
|
||||
void backlight_hw_on(void);
|
||||
void backlight_hw_off(void);
|
||||
void backlight_hw_brightness(int val);
|
||||
|
||||
#elif defined(IPOD_MINI) || defined(IPOD_MINI2G)
|
||||
|
||||
#define _backlight_init() true
|
||||
#define backlight_hw_init() true
|
||||
void _backlight_hw_on(void);
|
||||
void _backlight_hw_off(void);
|
||||
|
||||
#ifdef BOOTLOADER
|
||||
#define _backlight_on() _backlight_hw_on()
|
||||
#define _backlight_off() _backlight_hw_off()
|
||||
#define backlight_hw_on() _backlight_hw_on()
|
||||
#define backlight_hw_off() _backlight_hw_off()
|
||||
#else
|
||||
#define _backlight_on_isr() _backlight_hw_on()
|
||||
#define _backlight_off_isr() _backlight_hw_off()
|
||||
#define _backlight_on_normal() _backlight_hw_on()
|
||||
#define _backlight_off_normal() _backlight_hw_off()
|
||||
#define backlight_hw_on_isr() _backlight_hw_on()
|
||||
#define backlight_hw_off_isr() _backlight_hw_off()
|
||||
#define backlight_hw_on_normal() _backlight_hw_on()
|
||||
#define backlight_hw_off_normal() _backlight_hw_off()
|
||||
#endif
|
||||
|
||||
#elif defined(IPOD_1G2G) || defined(IPOD_3G)
|
||||
|
||||
#define _backlight_init() true
|
||||
void _backlight_on(void);
|
||||
void _backlight_off(void);
|
||||
#define backlight_hw_init() true
|
||||
void backlight_hw_on(void);
|
||||
void backlight_hw_off(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ static void handle_scroll_wheel(int new_scroll)
|
|||
static int prev_scroll = -1;
|
||||
static int direction = 0;
|
||||
static int count = 0;
|
||||
static long next_backlight_on = 0;
|
||||
static long nextbacklight_hw_on = 0;
|
||||
|
||||
static unsigned long last_wheel_usec = 0;
|
||||
static unsigned long wheel_delta = 1ul << 24;
|
||||
|
|
@ -96,10 +96,10 @@ static void handle_scroll_wheel(int new_scroll)
|
|||
}
|
||||
|
||||
/* poke backlight every 1/4s of activity */
|
||||
if (TIME_AFTER(current_tick, next_backlight_on)) {
|
||||
if (TIME_AFTER(current_tick, nextbacklight_hw_on)) {
|
||||
backlight_on();
|
||||
reset_poweroff_timer();
|
||||
next_backlight_on = current_tick + HZ/4;
|
||||
nextbacklight_hw_on = current_tick + HZ/4;
|
||||
}
|
||||
|
||||
/* has wheel travelled far enough? */
|
||||
|
|
@ -152,7 +152,7 @@ static void handle_scroll_wheel(int new_scroll)
|
|||
wheel_velocity = v;
|
||||
/* ensure backlight never gets stuck for an extended period if tick
|
||||
* wrapped such that next poke is very far ahead */
|
||||
next_backlight_on = current_tick - 1;
|
||||
nextbacklight_hw_on = current_tick - 1;
|
||||
}
|
||||
else {
|
||||
/* some velocity filtering to smooth things out */
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ static void handle_scroll_wheel(int new_scroll)
|
|||
static int prev_scroll = -1;
|
||||
static int direction = 0;
|
||||
static int count = 0;
|
||||
static long next_backlight_on = 0;
|
||||
static long nextbacklight_hw_on = 0;
|
||||
|
||||
int wheel_keycode = BUTTON_NONE;
|
||||
int scroll;
|
||||
|
|
@ -92,10 +92,10 @@ static void handle_scroll_wheel(int new_scroll)
|
|||
}
|
||||
|
||||
/* poke backlight every 1/4s of activity */
|
||||
if (TIME_AFTER(current_tick, next_backlight_on)) {
|
||||
if (TIME_AFTER(current_tick, nextbacklight_hw_on)) {
|
||||
backlight_on();
|
||||
reset_poweroff_timer();
|
||||
next_backlight_on = current_tick + HZ/4;
|
||||
nextbacklight_hw_on = current_tick + HZ/4;
|
||||
}
|
||||
|
||||
if (++count < WHEEL_BASE_SENSITIVITY)
|
||||
|
|
@ -144,7 +144,7 @@ static void handle_scroll_wheel(int new_scroll)
|
|||
wheel_velocity = v;
|
||||
/* ensure backlight never gets stuck for an extended period if tick
|
||||
* wrapped such that next poke is very far ahead */
|
||||
next_backlight_on = current_tick - 1;
|
||||
nextbacklight_hw_on = current_tick - 1;
|
||||
}
|
||||
else {
|
||||
/* some velocity filtering to smooth things out */
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ void lcd_shutdown(void) {
|
|||
#if defined(IPOD_NANO)
|
||||
_backlight_hw_enable(false);
|
||||
#elif defined(IPOD_COLOR)
|
||||
_backlight_off();
|
||||
backlight_hw_off();
|
||||
#endif
|
||||
|
||||
if ((lcd_type&1) == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue