Posted: 29 Jan 2015, 13:28
So I've tinkered a bit, and I only need to iron some things out.
I have a function called 'showColor()' which accepts red, green and blue values and outputs it to a certain pin.
I can't seem to work out the 'ACTION_BACKLIGHT_LEVEL(BACKLIGHT_FN1)' part.
I have FN1 through FN7 set as the following in backlight.h:
And I have the 'if' statements like this:
And so on and so on, but when I press FN2 it works (cycles on/off), and FN1 does nothing.
If I add FN3, same thing. Only FN3 works and the rest don't.
I managed to make 'ACTION_BACKLIGHT_STEP()' work, and having the following conditions:
And everything works as expected. FN1 cycles through all backlight levels.
Did I miss anything?
I have a function called 'showColor()' which accepts red, green and blue values and outputs it to a certain pin.
I can't seem to work out the 'ACTION_BACKLIGHT_LEVEL(BACKLIGHT_FN1)' part.
I have FN1 through FN7 set as the following in backlight.h:
Code: Select all
enum backlight_level {
BACKLIGHT_FN1 = 0b0000001,
BACKLIGHT_FN2 = 0b0000010,
BACKLIGHT_FN3 = 0b0000100,
BACKLIGHT_FN4 = 0b0001000,
BACKLIGHT_FN5 = 0b0010000,
BACKLIGHT_FN6 = 0b0100000,
BACKLIGHT_FN7 = 0b1000000,
};
Code: Select all
if (level & BACKLIGHT_FN1)
{
showColor(253,102,0);
}
else
{
showColor(0,0,0);
}
if (level & BACKLIGHT_FN2)
{
showColor(0,120,255);
}
else
{
showColor(0,0,0);
}
//and so on...
If I add FN3, same thing. Only FN3 works and the rest don't.
I managed to make 'ACTION_BACKLIGHT_STEP()' work, and having the following conditions:
Code: Select all
void backlight_set(uint8_t level)
{
switch(level)
{
case 0: //off
showColor(0,0,0);
break;
case 1: //Portal orange
showColor(253,102,0);
break;
case 2: //Portal blue
showColor(0,120,255);
break;
//and so on..
Did I miss anything?