freemyipod r74 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r73‎ | r74 | r75 >
Date:01:50, 10 August 2010
Author:cmwslw
Status:new
Tags:
Comment:
Ported the backlight driver over from iBugger.
Modified paths:
  • /embios/branches/4g_compat/SOURCES (modified) (history)
  • /embios/branches/4g_compat/target/ipodnano4g/backlight.c (added) (history)
  • /embios/branches/4g_compat/target/ipodnano4g/backlight.h (added) (history)

Diff [purge]

Index: embios/branches/4g_compat/SOURCES
@@ -12,6 +12,7 @@
1313 target/ipodnano4g/storage.c
1414 target/ipodnano4g/i2c.S
1515 target/ipodnano4g/accel.c
 16+target/ipodnano4g/backlight.c
1617 #endif
1718
1819 init.c
Index: embios/branches/4g_compat/target/ipodnano4g/backlight.c
@@ -0,0 +1,41 @@
 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+
 28+void backlight_set(uint8_t brightness, uint8_t fade)
 29+{
 30+ i2csendbyte(0xe6, 0x30, brightness);
 31+ i2csendbyte(0xe6, 0x31, 3);
 32+}
 33+
 34+void backlight_on(uint8_t fade)
 35+{
 36+ backlight_set(255, 32);
 37+}
 38+
 39+void backlight_off(uint8_t fade)
 40+{
 41+ i2csendbyte(0xe6, 0x31, 2);
 42+}
Index: embios/branches/4g_compat/target/ipodnano4g/backlight.h
@@ -0,0 +1,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+#ifndef __BACKLIGHT_H__
 26+#define __BACKLIGHT_H__
 27+
 28+#include "global.h"
 29+
 30+// fade is only used on the 2G but keep it here for a common API (use anything)
 31+void backlight_set(double brightness, uint8_t fade);
 32+void backlight_on(uint8_t fade);
 33+void backlight_off(uint8_t fade);
 34+
 35+#endif