keymap.c 1006 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "sweet16.h"
  2. enum custom_keycodes {
  3. UP_URL = SAFE_RANGE
  4. };
  5. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  6. LAYOUT_ortho_4x4(
  7. KC_7, KC_8, KC_9, KC_ASTR,
  8. KC_4, KC_5, KC_6, KC_SLSH,
  9. KC_1, KC_2, KC_3, KC_MINS,
  10. KC_0, KC_ENT, KC_DOT, KC_EQL
  11. )
  12. };
  13. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  14. switch (keycode) {
  15. case UP_URL:
  16. if (record->event.pressed) {
  17. SEND_STRING("http://1upkeyboards.com");
  18. }
  19. return false;
  20. break;
  21. }
  22. return true;
  23. }
  24. void led_set_user(uint8_t usb_led) {
  25. /* Map RXLED to USB_LED_NUM_LOCK */
  26. if (usb_led & (1 << USB_LED_NUM_LOCK)) {
  27. DDRB |= (1 << 0); PORTB &= ~(1 << 0);
  28. } else {
  29. DDRB &= ~(1 << 0); PORTB &= ~(1 << 0);
  30. }
  31. /* Map TXLED to USB_LED_CAPS_LOCK */
  32. if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
  33. DDRD |= (1 << 5); PORTD &= ~(1 << 5);
  34. } else {
  35. DDRD &= ~(1 << 5); PORTD &= ~(1 << 5);
  36. }
  37. }