freemyipod r190 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r189‎ | r190 | r191 >
Date:18:23, 4 September 2010
Author:theseven
Status:new
Tags:
Comment:
Initialize the backlight properly (on nano2g)
Modified paths:
  • /embios/trunk/init.c (modified) (history)
  • /embios/trunk/target/ipodnano2g/backlight.c (modified) (history)
  • /embios/trunk/target/ipodnano4g/backlight.c (modified) (history)

Diff [purge]

Index: embios/trunk/init.c
@@ -48,6 +48,9 @@
4949 #ifdef HAVE_BOOTFLASH
5050 #include "bootflash.h"
5151 #endif
 52+#ifdef HAVE_BOOTFLASH
 53+#include "backlight.h"
 54+#endif
5255
5356
5457 struct bootinfo_t
@@ -176,6 +179,9 @@
177180 usb_init();
178181 #endif
179182 cputs(CONSOLE_BOOT, welcomestring);
 183+#ifdef HAVE_BACKLIGHT
 184+ backlight_init();
 185+#endif
180186 #ifdef HAVE_BUTTON
181187 button_init();
182188 #endif
Index: embios/trunk/target/ipodnano2g/backlight.c
@@ -26,6 +26,11 @@
2727 #include "backlight.h"
2828
2929
 30+void backlight_init()
 31+{
 32+ i2c_sendbyte(0, 0xe6, 0x2a, 6);
 33+}
 34+
3035 void backlight_on(bool on)
3136 {
3237 i2c_sendbyte(0, 0xe6, 0x29, on ? 1 : 0);
Index: embios/trunk/target/ipodnano4g/backlight.c
@@ -1,45 +1,49 @@
2 -//
3 -//
4 -// Copyright 2010 TheSeven
5 -//
6 -//
7 -// This file is part of emBIOS.
8 -//
9 -// emBIOS is free software: you can redistribute it and/or
10 -// modify it under the terms of the GNU General Public License as
11 -// published by the Free Software Foundation, either version 2 of the
12 -// License, or (at your option) any later version.
13 -//
14 -// emBIOS is distributed in the hope that it will be useful,
15 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
16 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 -// See the GNU General Public License for more details.
18 -//
19 -// You should have received a copy of the GNU General Public License along
20 -// with emBIOS. If not, see <http://www.gnu.org/licenses/>.
21 -//
22 -//
23 -
24 -
25 -#include "global.h"
26 -#include "i2c.h"
27 -#include "backlight.h"
28 -
29 -
30 -static bool backlight_fade;
31 -
32 -
33 -void backlight_on(bool on)
34 -{
 2+//
 3+//
 4+// Copyright 2010 TheSeven
 5+//
 6+//
 7+// This file is part of emBIOS.
 8+//
 9+// emBIOS is free software: you can redistribute it and/or
 10+// modify it under the terms of the GNU General Public License as
 11+// published by the Free Software Foundation, either version 2 of the
 12+// License, or (at your option) any later version.
 13+//
 14+// emBIOS is distributed in the hope that it will be useful,
 15+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 16+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 17+// See the GNU General Public License for more details.
 18+//
 19+// You should have received a copy of the GNU General Public License along
 20+// with emBIOS. If not, see <http://www.gnu.org/licenses/>.
 21+//
 22+//
 23+
 24+
 25+#include "global.h"
 26+#include "i2c.h"
 27+#include "backlight.h"
 28+
 29+
 30+static bool backlight_fade;
 31+
 32+
 33+void backlight_init()
 34+{
 35+}
 36+
 37+void backlight_on(bool on)
 38+{
3539 i2c_sendbyte(0, 0xe6, 0x31, (backlight_fade ? 2 : 0) + (on ? 1 : 0));
36 -}
37 -
38 -void backlight_set_fade(uint8_t fade)
39 -{
 40+}
 41+
 42+void backlight_set_fade(uint8_t fade)
 43+{
4044 backlight_fade = fade;
41 -}
42 -
43 -void backlight_set_brightness(uint8_t brightness)
44 -{
 45+}
 46+
 47+void backlight_set_brightness(uint8_t brightness)
 48+{
4549 i2c_sendbyte(0, 0xe6, 0x30, (250 * (brightness & 0xff)) >> 8);
46 -}
 50+}