qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

led.h (1507B)


      1 /*
      2 Copyright 2011 Jun Wako <wakojun@gmail.com>
      3 
      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.
      8 
      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 
     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/>.
     16 */
     17 
     18 #pragma once
     19 
     20 #include <stdint.h>
     21 #include <stdbool.h>
     22 
     23 /* FIXME: Add doxygen comments here. */
     24 
     25 #ifdef __cplusplus
     26 extern "C" {
     27 #endif
     28 
     29 typedef union {
     30     uint8_t raw;
     31     struct {
     32         bool    num_lock : 1;
     33         bool    caps_lock : 1;
     34         bool    scroll_lock : 1;
     35         bool    compose : 1;
     36         bool    kana : 1;
     37         uint8_t reserved : 3;
     38     };
     39 } led_t;
     40 
     41 void led_set(uint8_t usb_led);
     42 
     43 void led_init_ports(void);
     44 
     45 void led_suspend(void);
     46 
     47 void led_wakeup(void);
     48 
     49 void led_task(void);
     50 
     51 /* Callbacks */
     52 bool led_update_user(led_t led_state);
     53 bool led_update_kb(led_t led_state);
     54 void led_update_ports(led_t led_state);
     55 
     56 uint32_t last_led_activity_time(void);    // Timestamp of the LED activity
     57 uint32_t last_led_activity_elapsed(void); // Number of milliseconds since the last LED activity
     58 
     59 #ifdef __cplusplus
     60 }
     61 #endif