You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

led.c 1.1KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. Converter for 70% IBM Terminal Keyboard
  3. Author: Benjamin Gould, 2013
  4. Based on code Copyright 2011 Jun Wako <[email protected]>
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 2 of the License, or
  8. (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.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include "stdint.h"
  17. #include "ps2.h"
  18. #include "led.h"
  19. void led_set(uint8_t usb_led)
  20. {
  21. uint8_t ps2_led = 0;
  22. if (usb_led & (1<<USB_LED_SCROLL_LOCK))
  23. ps2_led |= (1<<PS2_LED_SCROLL_LOCK);
  24. if (usb_led & (1<<USB_LED_NUM_LOCK))
  25. ps2_led |= (1<<PS2_LED_NUM_LOCK);
  26. if (usb_led & (1<<USB_LED_CAPS_LOCK))
  27. ps2_led |= (1<<PS2_LED_CAPS_LOCK);
  28. ps2_host_set_led(ps2_led);
  29. }