Subversion Repositories freemyipod

Rev

Rev 85 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 85 Rev 117
Line 21... Line 21...
21
//
21
//
22
 
22
 
23
 
23
 
24
#include "global.h"
24
#include "global.h"
25
#include "i2c.h"
25
#include "i2c.h"
-
 
26
#include "backlight.h"
26
 
27
 
-
 
28
 
-
 
29
static bool backlight_fade;
-
 
30
 
-
 
31
 
27
void backlight_set(uint8_t brightness, uint8_t fade)
32
void backlight_on(bool on)
28
{
33
{
29
    i2csendbyte(0xe6, 0x30, brightness);
34
    i2c_sendbyte(0, 0xe6, 0x31, (backlight_fade ? 2 : 0) + (on ? 1 : 0));
30
    i2csendbyte(0xe6, 0x31, 3);
-
 
31
}
35
}
32
 
36
 
33
void backlight_on(uint8_t fade)
37
void backlight_set_fade(uint8_t fade)
34
{
38
{
35
    backlight_set(255, 32);
39
    backlight_fade = fade;
36
}
40
}
37
 
41
 
38
void backlight_off(uint8_t fade)
42
void backlight_set_brightness(uint8_t brightness)
39
{
43
{
40
    i2csendbyte(0xe6, 0x31, 2);
44
    i2c_sendbyte(0, 0xe6, 0x30, (250 * (brightness & 0xff)) >> 8);
41
}
45
}