rev3.c 698 B

1234567891011121314151617181920212223242526272829
  1. #include "rev3.h"
  2. #include "print.h"
  3. void backlight_init_ports(void) {
  4. print("init_backlight_pin()\n");
  5. // Set our LED pins as output
  6. DDRD |= (1<<6); // Esc
  7. DDRB |= (1<<7); // Page Up
  8. DDRD |= (1<<4); // Arrows
  9. // Set our LED pins low
  10. PORTD &= ~(1<<6); // Esc
  11. PORTB &= ~(1<<7); // Page Up
  12. PORTD &= ~(1<<4); // Arrows
  13. }
  14. void backlight_set(uint8_t level) {
  15. if ( level == 0 ) {
  16. // Turn off light
  17. PORTD |= (1<<6); // Esc
  18. PORTB |= (1<<7); // Page Up
  19. PORTD |= (1<<4); // Arrows
  20. } else {
  21. // Turn on light
  22. PORTD &= ~(1<<6); // Esc
  23. PORTB &= ~(1<<7); // Page Up
  24. PORTD &= ~(1<<4); // Arrows
  25. }
  26. }