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 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. NeXT non-ADB Keyboard USB Converter
  3. Copyright 2013, Benjamin Gould ([email protected])
  4. Based on:
  5. TMK firmware code Copyright 2011,2012 Jun WAKO <[email protected]>
  6. Arduino code by "Ladyada" Limor Fried (http://ladyada.net/, http://adafruit.com/), released under BSD license
  7. Timing reference thanks to http://m0115.web.fc2.com/ (dead link), http://cfile7.uf.tistory.com/image/14448E464F410BF22380BB
  8. Pinouts thanks to http://www.68k.org/~degs/nextkeyboard.html
  9. Keycodes from http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/sys/arch/next68k/dev/
  10. This software is licensed with a Modified BSD License.
  11. All of this is supposed to be Free Software, Open Source, DFSG-free,
  12. GPL-compatible, and OK to use in both free and proprietary applications.
  13. Additions and corrections to this file are welcome.
  14. Redistribution and use in source and binary forms, with or without
  15. modification, are permitted provided that the following conditions are met:
  16. * Redistributions of source code must retain the above copyright
  17. notice, this list of conditions and the following disclaimer.
  18. * Redistributions in binary form must reproduce the above copyright
  19. notice, this list of conditions and the following disclaimer in
  20. the documentation and/or other materials provided with the
  21. distribution.
  22. * Neither the name of the copyright holders nor the names of
  23. contributors may be used to endorse or promote products derived
  24. from this software without specific prior written permission.
  25. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  26. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  27. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  28. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  29. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  30. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  31. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  32. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  33. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  34. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  35. POSSIBILITY OF SUCH DAMAGE.
  36. */
  37. #include "stdint.h"
  38. #include "led.h"
  39. #include "next_kbd.h"
  40. void led_set(uint8_t usb_led)
  41. {
  42. if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
  43. next_kbd_set_leds(true, true);
  44. } else {
  45. next_kbd_set_leds(false, false);
  46. }
  47. }