2 Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "backlight.h"
21 /* Backlight pin configuration
31 void backlight_init_ports() {
32 DDRB |= (1<<0) | (1<<1) | (1<<2) | (1<<4) | (1<<5);
33 DDRD |= (1<<6) | (1<<7);
35 backlight_disable_numlock();
38 void backlight_set(uint8_t level) {
39 (level & BACKLIGHT_FN1) ? backlight_enable_fn1() : backlight_disable_fn1();
40 (level & BACKLIGHT_FN2) ? backlight_enable_fn2() : backlight_disable_fn2();
41 (level & BACKLIGHT_FN3) ? backlight_enable_fn3() : backlight_disable_fn3();
42 (level & BACKLIGHT_FN4) ? backlight_enable_fn4() : backlight_disable_fn4();
43 (level & BACKLIGHT_NUMPAD) ? backlight_enable_numpad() : backlight_disable_numpad();
44 (level & BACKLIGHT_REAR) ? backlight_enable_rear() : backlight_disable_rear();
47 void backlight_enable_fn1() {
51 void backlight_disable_fn1() {
55 void backlight_invert_fn1() {
59 void backlight_enable_fn2() {
63 void backlight_disable_fn2() {
67 void backlight_invert_fn2() {
71 void backlight_enable_fn3() {
75 void backlight_disable_fn3() {
79 void backlight_invert_fn3() {
83 void backlight_enable_fn4() {
87 void backlight_disable_fn4() {
91 void backlight_invert_fn4() {
95 void backlight_enable_numpad() {
99 void backlight_disable_numpad() {
103 void backlight_invert_numpad() {
107 void backlight_enable_numlock() {
111 void backlight_disable_numlock() {
115 void backlight_invert_numlock() {
119 void backlight_enable_rear() {
123 void backlight_disable_rear() {
127 void backlight_invert_rear() {