qmk_firmware

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

mariorion_v25.c (2117B)


      1 // Copyright <year> <name> <email> @<github_username>
      2 //
      3 // This program is free software: you can redistribute it and/or modify
      4 // it under the terms of the GNU General Public License as published by
      5 // the Free Software Foundation, either version 2 of the License, or
      6 // (at your option) any later version.
      7 //
      8 // This program is distributed in the hope that it will be useful,
      9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
     10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11 // GNU General Public License for more details.
     12 //
     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 "quantum.h"
     17 
     18 // Optional override functions below.
     19 // You can leave any or all of these undefined.
     20 // These are only required if you want to perform custom actions.
     21 
     22 void matrix_init_kb(void) {
     23 	// put your keyboard start-up code here
     24 	// runs once when the firmware starts up
     25 
     26 	gpio_set_pin_output(INDICATOR_0);
     27 	gpio_set_pin_output(INDICATOR_1);
     28 	gpio_set_pin_output(INDICATOR_2);
     29 	matrix_init_user();
     30 }
     31 
     32 layer_state_t layer_state_set_kb(layer_state_t state) {
     33 	switch (get_highest_layer(state)) {
     34 		case 1:
     35 			gpio_write_pin_high(INDICATOR_0);
     36 			gpio_write_pin_low(INDICATOR_1);
     37 			gpio_write_pin_low(INDICATOR_2);
     38 			break;
     39 		case 2:
     40 			gpio_write_pin_low(INDICATOR_0);
     41 			gpio_write_pin_high(INDICATOR_1);
     42 			gpio_write_pin_low(INDICATOR_2);
     43 			break;
     44 		case 3:
     45 			gpio_write_pin_low(INDICATOR_0);
     46 			gpio_write_pin_low(INDICATOR_1);
     47 			gpio_write_pin_high(INDICATOR_2);
     48 			break;
     49 		default:
     50 			gpio_write_pin_high(INDICATOR_0);
     51 			gpio_write_pin_high(INDICATOR_1);
     52 			gpio_write_pin_high(INDICATOR_2);
     53 			break;
     54 	}
     55 	return layer_state_set_user(state);
     56 }
     57 
     58 void suspend_power_down_kb(void) {
     59 	gpio_write_pin_low(INDICATOR_0);
     60 	gpio_write_pin_low(INDICATOR_1);
     61 	gpio_write_pin_low(INDICATOR_2);
     62 
     63 	suspend_power_down_user();
     64 }
     65 
     66 void suspend_wakeup_init_kb(void) {
     67 	gpio_write_pin_high(INDICATOR_0);
     68 	gpio_write_pin_high(INDICATOR_1);
     69 	gpio_write_pin_high(INDICATOR_2);
     70 
     71 	suspend_wakeup_init_user();
     72 }