Refactor to use led config - Part 3 (#10966)
* Refactor to use led config * Refactor to use led config * Refactor to use led config * Refactor to use led config
This commit is contained in:
		
							parent
							
								
									e1e13c53ac
								
							
						
					
					
						commit
						f00402a2f3
					
				
					 30 changed files with 54 additions and 546 deletions
				
			
		| 
						 | 
				
			
			@ -17,6 +17,12 @@
 | 
			
		|||
/* Set 0 if debouncing isn't needed */
 | 
			
		||||
#define DEBOUNCE 5
 | 
			
		||||
 | 
			
		||||
#ifndef CONVERT_TO_PROTON_C
 | 
			
		||||
#    define LED_NUM_LOCK_PIN B0 // RXLED
 | 
			
		||||
#    define LED_CAPS_LOCK_PIN D5 // TXLED
 | 
			
		||||
#    define LED_PIN_ON_STATE 0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Underglow options */
 | 
			
		||||
#define RGB_DI_PIN B1
 | 
			
		||||
#ifdef RGB_DI_PIN
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,21 +1 @@
 | 
			
		|||
#include "v1.h"
 | 
			
		||||
 | 
			
		||||
void led_set_kb(uint8_t usb_led) {
 | 
			
		||||
#ifndef CONVERT_TO_PROTON_C
 | 
			
		||||
    /* Map RXLED to USB_LED_NUM_LOCK */
 | 
			
		||||
    if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
 | 
			
		||||
        setPinOutput(B0);
 | 
			
		||||
        writePinLow(B0);
 | 
			
		||||
    } else {
 | 
			
		||||
        setPinInput(B0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* Map TXLED to USB_LED_CAPS_LOCK */
 | 
			
		||||
    if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
 | 
			
		||||
        setPinOutput(D5);
 | 
			
		||||
        writePinLow(D5);
 | 
			
		||||
    } else {
 | 
			
		||||
        setPinInput(D5);
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,23 +15,3 @@ You should have received a copy of the GNU General Public License
 | 
			
		|||
along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
*/
 | 
			
		||||
#include "alps64.h"
 | 
			
		||||
 | 
			
		||||
void keyboard_pre_init_kb(void) {
 | 
			
		||||
	// put your keyboard start-up code here
 | 
			
		||||
	// runs once when the firmware starts up
 | 
			
		||||
    setPinOutput(C5);
 | 
			
		||||
    keyboard_pre_init_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void led_set_kb(uint8_t usb_led)
 | 
			
		||||
{
 | 
			
		||||
    if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
 | 
			
		||||
        // output high
 | 
			
		||||
        writePinHigh(C5);
 | 
			
		||||
    } else {
 | 
			
		||||
        // Hi-Z
 | 
			
		||||
        writePinLow(C5);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    led_set_user(usb_led);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,6 +37,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
 | 
			
		||||
#define DIODE_DIRECTION COL2ROW
 | 
			
		||||
 | 
			
		||||
#define LED_CAPS_LOCK_PIN C5
 | 
			
		||||
 | 
			
		||||
/* define if matrix has ghost */
 | 
			
		||||
//#define MATRIX_HAS_GHOST
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,30 +1 @@
 | 
			
		|||
#include "amjpad.h"
 | 
			
		||||
#include "led.h"
 | 
			
		||||
 | 
			
		||||
void matrix_init_kb(void) {
 | 
			
		||||
	// put your keyboard start-up code here
 | 
			
		||||
	// runs once when the firmware starts up
 | 
			
		||||
	matrix_init_user();
 | 
			
		||||
	led_init_ports();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void matrix_scan_kb(void) {
 | 
			
		||||
	// put your looping keyboard code here
 | 
			
		||||
	// runs every cycle (a lot)
 | 
			
		||||
	matrix_scan_user();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void led_init_ports(void) {
 | 
			
		||||
    // * Set our LED pins as output
 | 
			
		||||
    DDRD |= (1<<6);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void led_set_kb(uint8_t usb_led) {
 | 
			
		||||
    if (usb_led & (1<<USB_LED_NUM_LOCK)) {
 | 
			
		||||
        // Turn numlock on
 | 
			
		||||
        PORTD &= ~(1<<6);
 | 
			
		||||
    } else {
 | 
			
		||||
        // Turn numlock off
 | 
			
		||||
        PORTD |= (1<<6);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -54,6 +54,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
/* Locking resynchronize hack */
 | 
			
		||||
#define LOCKING_RESYNC_ENABLE
 | 
			
		||||
 | 
			
		||||
#define LED_NUM_LOCK_PIN D6
 | 
			
		||||
#define LED_PIN_ON_STATE 0
 | 
			
		||||
 | 
			
		||||
/* Backlight configuration
 | 
			
		||||
 */
 | 
			
		||||
#define BACKLIGHT_LEVELS 4
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,6 +37,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
#define MATRIX_COL_PINS { B5, D0, D1, D2, D3, D4, D5, D6, D7, C6, C7, F4, F5, F6, F7 }
 | 
			
		||||
#define UNUSED_PINS
 | 
			
		||||
 | 
			
		||||
#define LED_CAPS_LOCK_PIN B7
 | 
			
		||||
#define LED_PIN_ON_STATE 0
 | 
			
		||||
 | 
			
		||||
#define RGB_DI_PIN E6
 | 
			
		||||
#ifdef RGB_DI_PIN
 | 
			
		||||
#define RGBLIGHT_ANIMATIONS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,33 +1 @@
 | 
			
		|||
#include "le.h"
 | 
			
		||||
 | 
			
		||||
void matrix_init_kb(void) {
 | 
			
		||||
	// put your keyboard start-up code here
 | 
			
		||||
	// runs once when the firmware starts up
 | 
			
		||||
 | 
			
		||||
	matrix_init_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void matrix_scan_kb(void) {
 | 
			
		||||
	// put your looping keyboard code here
 | 
			
		||||
	// runs every cycle (a lot)
 | 
			
		||||
 | 
			
		||||
	matrix_scan_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
	// put your per-action keyboard code here
 | 
			
		||||
	// runs for every action, just before processing by the firmware
 | 
			
		||||
 | 
			
		||||
	return process_record_user(keycode, record);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void led_set_user(uint8_t usb_led) {
 | 
			
		||||
	if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
 | 
			
		||||
		DDRB |= (1 << 7); 
 | 
			
		||||
		PORTB &= ~(1 << 7);
 | 
			
		||||
	} else {
 | 
			
		||||
		DDRB &= ~(1 << 7); 
 | 
			
		||||
		PORTB &= ~(1 << 7);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,6 +22,8 @@
 | 
			
		|||
/* COL2ROW or ROW2COL */
 | 
			
		||||
#define DIODE_DIRECTION COL2ROW
 | 
			
		||||
 | 
			
		||||
#define LED_CAPS_LOCK_PIN F0
 | 
			
		||||
 | 
			
		||||
/* number of backlight levels */
 | 
			
		||||
#define BACKLIGHT_PIN B7
 | 
			
		||||
#ifdef BACKLIGHT_PIN
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,25 +1 @@
 | 
			
		|||
#include "e7v1.h"
 | 
			
		||||
 | 
			
		||||
void matrix_init_kb(void) {
 | 
			
		||||
  setPinOutput(F0);
 | 
			
		||||
  matrix_init_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void matrix_scan_kb(void) {
 | 
			
		||||
  matrix_scan_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
  return process_record_user(keycode, record);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void led_set_kb(uint8_t usb_led) {
 | 
			
		||||
  if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
 | 
			
		||||
    writePinHigh(F0);
 | 
			
		||||
  } else {
 | 
			
		||||
    writePinLow(F0);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  led_set_user(usb_led);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,7 +49,10 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
 | 
			
		||||
/* Set 0 if debouncing isn't needed */
 | 
			
		||||
#define DEBOUNCE  0
 | 
			
		||||
#define TAPPING_TERM      175
 | 
			
		||||
 | 
			
		||||
#define LED_NUM_LOCK_PIN B4
 | 
			
		||||
#define LED_CAPS_LOCK_PIN B5
 | 
			
		||||
#define LED_SCROLL_LOCK_PIN B6
 | 
			
		||||
 | 
			
		||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
 | 
			
		||||
// #define LOCKING_SUPPORT_ENABLE
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,46 +22,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
void matrix_init_kb(void) {
 | 
			
		||||
	// put your keyboard start-up code here
 | 
			
		||||
	// runs once when the firmware starts up
 | 
			
		||||
 | 
			
		||||
#ifdef ACTUATION_DEPTH_ADJUSTMENT
 | 
			
		||||
    adjust_actuation_point(ACTUATION_DEPTH_ADJUSTMENT);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	matrix_init_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void matrix_scan_kb(void) {
 | 
			
		||||
	// put your looping keyboard code here
 | 
			
		||||
	// runs every cycle (a lot)
 | 
			
		||||
 | 
			
		||||
	matrix_scan_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
	// put your per-action keyboard code here
 | 
			
		||||
	// runs for every action, just before processing by the firmware
 | 
			
		||||
 | 
			
		||||
	return process_record_user(keycode, record);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void led_set_kb(uint8_t usb_led) {
 | 
			
		||||
    if (usb_led & (1<<USB_LED_NUM_LOCK)) {
 | 
			
		||||
        PORTB |=  (1<<4);
 | 
			
		||||
    } else {
 | 
			
		||||
        PORTB &= ~(1<<4);
 | 
			
		||||
    }
 | 
			
		||||
    if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
 | 
			
		||||
        PORTB |=  (1<<5);
 | 
			
		||||
    } else {
 | 
			
		||||
        PORTB &= ~(1<<5);
 | 
			
		||||
    }
 | 
			
		||||
    if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
 | 
			
		||||
        PORTB |=  (1<<6);
 | 
			
		||||
    } else {
 | 
			
		||||
        PORTB &= ~(1<<6);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	led_set_user(usb_led);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -48,6 +48,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
/* COL2ROW, ROW2COL*/
 | 
			
		||||
#define DIODE_DIRECTION COL2ROW
 | 
			
		||||
 | 
			
		||||
#define LED_CAPS_LOCK_PIN E6
 | 
			
		||||
#define LED_PIN_ON_STATE 0
 | 
			
		||||
 | 
			
		||||
#define BACKLIGHT_PIN B7
 | 
			
		||||
#define BACKLIGHT_BREATHING
 | 
			
		||||
#define BACKLIGHT_LEVELS 4
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,46 +14,3 @@
 | 
			
		|||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#include "hotswap.h"
 | 
			
		||||
 | 
			
		||||
// Optional override functions below.
 | 
			
		||||
// You can leave any or all of these undefined.
 | 
			
		||||
// These are only required if you want to perform custom actions.
 | 
			
		||||
 | 
			
		||||
void matrix_init_kb(void) {
 | 
			
		||||
  // put your keyboard start-up code here
 | 
			
		||||
  // runs once when the firmware starts up
 | 
			
		||||
  setPinOutput(E6);
 | 
			
		||||
  matrix_init_user();
 | 
			
		||||
}
 | 
			
		||||
/*
 | 
			
		||||
 | 
			
		||||
void matrix_scan_kb(void) {
 | 
			
		||||
  // put your looping keyboard code here
 | 
			
		||||
  // runs every cycle (a lot)
 | 
			
		||||
 | 
			
		||||
  matrix_scan_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
  // put your per-action keyboard code here
 | 
			
		||||
  // runs for every action, just before processing by the firmware
 | 
			
		||||
 | 
			
		||||
  return process_record_user(keycode, record);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void led_set_kb(uint8_t usb_led) {
 | 
			
		||||
  // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
 | 
			
		||||
 | 
			
		||||
  led_set_user(usb_led);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
void led_set_kb(uint8_t usb_led) {
 | 
			
		||||
  if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
 | 
			
		||||
    writePinLow(E6);
 | 
			
		||||
  } else {
 | 
			
		||||
    writePinHigh(E6);
 | 
			
		||||
  }
 | 
			
		||||
	led_set_user(usb_led);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -48,6 +48,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
/* COL2ROW, ROW2COL*/
 | 
			
		||||
#define DIODE_DIRECTION COL2ROW
 | 
			
		||||
 | 
			
		||||
#define LED_CAPS_LOCK_PIN E6
 | 
			
		||||
#define LED_PIN_ON_STATE 0
 | 
			
		||||
 | 
			
		||||
#define BACKLIGHT_PIN B7
 | 
			
		||||
#define BACKLIGHT_BREATHING
 | 
			
		||||
#define BACKLIGHT_LEVELS 3
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,48 +14,3 @@
 | 
			
		|||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#include "universal.h"
 | 
			
		||||
 | 
			
		||||
// Optional override functions below.
 | 
			
		||||
// You can leave any or all of these undefined.
 | 
			
		||||
// These are only required if you want to perform custom actions.
 | 
			
		||||
 | 
			
		||||
void matrix_init_kb(void) {
 | 
			
		||||
  // put your keyboard start-up code here
 | 
			
		||||
  // runs once when the firmware starts up
 | 
			
		||||
  setPinOutput(E6);
 | 
			
		||||
  matrix_init_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 | 
			
		||||
void matrix_scan_kb(void) {
 | 
			
		||||
  // put your looping keyboard code here
 | 
			
		||||
  // runs every cycle (a lot)
 | 
			
		||||
 | 
			
		||||
  matrix_scan_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
  // put your per-action keyboard code here
 | 
			
		||||
  // runs for every action, just before processing by the firmware
 | 
			
		||||
 | 
			
		||||
  return process_record_user(keycode, record);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void led_set_kb(uint8_t usb_led) {
 | 
			
		||||
  // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
 | 
			
		||||
 | 
			
		||||
  led_set_user(usb_led);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void led_set_kb(uint8_t usb_led) {
 | 
			
		||||
  if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
 | 
			
		||||
    writePinLow(E6);
 | 
			
		||||
  } else {
 | 
			
		||||
    writePinHigh(E6);
 | 
			
		||||
  }
 | 
			
		||||
	led_set_user(usb_led);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,6 +22,11 @@
 | 
			
		|||
/* COL2ROW or ROW2COL */
 | 
			
		||||
#define DIODE_DIRECTION COL2ROW
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define LED_NUM_LOCK_PIN C6
 | 
			
		||||
#define LED_CAPS_LOCK_PIN B6
 | 
			
		||||
#define LED_SCROLL_LOCK_PIN B5
 | 
			
		||||
 | 
			
		||||
/* number of backlight levels */
 | 
			
		||||
 | 
			
		||||
#ifdef BACKLIGHT_PIN
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,50 +14,3 @@
 | 
			
		|||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#include "hineyg80.h"
 | 
			
		||||
 | 
			
		||||
void matrix_init_kb(void) {
 | 
			
		||||
	// put your keyboard start-up code here
 | 
			
		||||
	// runs once when the firmware starts up
 | 
			
		||||
 | 
			
		||||
	matrix_init_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void matrix_scan_kb(void) {
 | 
			
		||||
	// put your looping keyboard code here
 | 
			
		||||
	// runs every cycle (a lot)
 | 
			
		||||
 | 
			
		||||
	matrix_scan_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
	// put your per-action keyboard code here
 | 
			
		||||
	// runs for every action, just before processing by the firmware
 | 
			
		||||
 | 
			
		||||
	return process_record_user(keycode, record);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void led_set_kb(uint8_t usb_led) {
 | 
			
		||||
	// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
 | 
			
		||||
	if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
 | 
			
		||||
        // Turn numlock on
 | 
			
		||||
		writePinHigh(C6);
 | 
			
		||||
    } else {
 | 
			
		||||
        // Turn numlock off
 | 
			
		||||
	    writePinLow(C6);
 | 
			
		||||
    }
 | 
			
		||||
	if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
 | 
			
		||||
        // Turn capslock on
 | 
			
		||||
		writePinHigh(B6);
 | 
			
		||||
    } else {
 | 
			
		||||
        // Turn capslock off
 | 
			
		||||
		writePinLow(B6);
 | 
			
		||||
    }
 | 
			
		||||
	if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
 | 
			
		||||
        // Turn scrolllock on
 | 
			
		||||
	    writePinHigh(B5);
 | 
			
		||||
    } else {
 | 
			
		||||
        // Turn scrolllock off
 | 
			
		||||
		writePinLow(B5);
 | 
			
		||||
    }
 | 
			
		||||
	led_set_user(usb_led);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,6 +37,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
#define MATRIX_COL_PINS { F0, F1, E6, C7, C6, B7, D4, B1, B0, B5, B4, D7, D6, B3, F4, F5 }
 | 
			
		||||
#define UNUSED_PINS
 | 
			
		||||
 | 
			
		||||
#define LED_CAPS_LOCK_PIN B2
 | 
			
		||||
#define LED_PIN_ON_STATE 0
 | 
			
		||||
 | 
			
		||||
#define RGB_DI_PIN E2
 | 
			
		||||
#ifdef RGB_DI_PIN
 | 
			
		||||
#define RGBLIGHT_ANIMATIONS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,36 +1 @@
 | 
			
		|||
#include "v32u4.h"
 | 
			
		||||
 | 
			
		||||
void matrix_init_kb(void) {
 | 
			
		||||
	// put your keyboard start-up code here
 | 
			
		||||
	// runs once when the firmware starts up
 | 
			
		||||
 | 
			
		||||
	matrix_init_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void matrix_scan_kb(void) {
 | 
			
		||||
	// put your looping keyboard code here
 | 
			
		||||
	// runs every cycle (a lot)
 | 
			
		||||
 | 
			
		||||
	matrix_scan_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
	// put your per-action keyboard code here
 | 
			
		||||
	// runs for every action, just before processing by the firmware
 | 
			
		||||
 | 
			
		||||
	return process_record_user(keycode, record);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void led_set_kb(uint8_t usb_led) {
 | 
			
		||||
	// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
 | 
			
		||||
    if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
 | 
			
		||||
        // output low
 | 
			
		||||
        DDRB |= (1<<2);
 | 
			
		||||
        PORTB &= ~(1<<2);
 | 
			
		||||
    } else {
 | 
			
		||||
        // Hi-Z
 | 
			
		||||
        DDRB &= ~(1<<2);
 | 
			
		||||
        PORTB &= ~(1<<2);
 | 
			
		||||
    }
 | 
			
		||||
	led_set_user(usb_led);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -45,6 +45,10 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
/* COL2ROW, ROW2COL*/
 | 
			
		||||
//#define DIODE_DIRECTION
 | 
			
		||||
 | 
			
		||||
#define LED_CAPS_LOCK_PIN B0
 | 
			
		||||
#define LED_SCROLL_LOCK_PIN E6
 | 
			
		||||
#define LED_PIN_ON_STATE 0
 | 
			
		||||
 | 
			
		||||
/* number of backlight levels */
 | 
			
		||||
//#define BACKLIGHT_LEVELS 3
 | 
			
		||||
// #define BACKLIGHT_PIN B7
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,62 +15,9 @@
 | 
			
		|||
 */
 | 
			
		||||
#include "kmac.h"
 | 
			
		||||
 | 
			
		||||
#define CAPS_PIN B0
 | 
			
		||||
#define SCROLL_PIN E6
 | 
			
		||||
#define F_ROW_MASK 0b01
 | 
			
		||||
#define WASD_MASK 0b10
 | 
			
		||||
 | 
			
		||||
// Optional override functions below.
 | 
			
		||||
// You can leave any or all of these undefined.
 | 
			
		||||
// These are only required if you want to perform custom actions.
 | 
			
		||||
 | 
			
		||||
void matrix_init_kb(void) {
 | 
			
		||||
    // put your keyboard start-up code here
 | 
			
		||||
    // runs once when the firmware starts up
 | 
			
		||||
    setPinOutput(CAPS_PIN);
 | 
			
		||||
    setPinOutput(SCROLL_PIN);
 | 
			
		||||
 | 
			
		||||
    matrix_init_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 | 
			
		||||
void matrix_scan_kb(void) {
 | 
			
		||||
  // put your looping keyboard code here
 | 
			
		||||
  // runs every cycle (a lot)
 | 
			
		||||
 | 
			
		||||
  matrix_scan_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
  // put your per-action keyboard code here
 | 
			
		||||
  // runs for every action, just before processing by the firmware
 | 
			
		||||
 | 
			
		||||
  return process_record_user(keycode, record);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/* LED pin configuration
 | 
			
		||||
 * Scroll Lock: Low PE6
 | 
			
		||||
 * Caps Lock: Low PB0
 | 
			
		||||
 */
 | 
			
		||||
void led_set_kb(uint8_t usb_led) {
 | 
			
		||||
    if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
 | 
			
		||||
        writePinLow(CAPS_PIN);
 | 
			
		||||
    } else {
 | 
			
		||||
        writePinHigh(CAPS_PIN);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
 | 
			
		||||
        writePinLow(SCROLL_PIN);
 | 
			
		||||
    } else {
 | 
			
		||||
        writePinHigh(SCROLL_PIN);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    led_set_user(usb_led);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void backlight_init_ports(void) {
 | 
			
		||||
    setPinOutput(B1);
 | 
			
		||||
    setPinOutput(B2);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,6 +22,11 @@
 | 
			
		|||
/* COL2ROW or ROW2COL */
 | 
			
		||||
#define DIODE_DIRECTION ROW2COL
 | 
			
		||||
 | 
			
		||||
#define LED_NUM_LOCK_PIN C6
 | 
			
		||||
#define LED_CAPS_LOCK_PIN C7
 | 
			
		||||
#define LED_SCROLL_LOCK_PIN B5
 | 
			
		||||
#define LED_PIN_ON_STATE 0
 | 
			
		||||
 | 
			
		||||
/* number of backlight levels */
 | 
			
		||||
#define BACKLIGHT_PIN B6
 | 
			
		||||
#ifdef BACKLIGHT_PIN
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,23 +1 @@
 | 
			
		|||
#include "melody96.h"
 | 
			
		||||
 | 
			
		||||
void led_set_kb(uint8_t usb_led) {
 | 
			
		||||
	if (usb_led & (1 << USB_LED_NUM_LOCK)) {
 | 
			
		||||
		DDRC |= (1 << 6); PORTC &= ~(1 << 6);
 | 
			
		||||
	} else {
 | 
			
		||||
		DDRC &= ~(1 << 6); PORTC &= ~(1 << 6);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
 | 
			
		||||
		DDRC |= (1 << 7); PORTC &= ~(1 << 7);
 | 
			
		||||
	} else {
 | 
			
		||||
		DDRC &= ~(1 << 7); PORTC &= ~(1 << 7);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
 | 
			
		||||
		DDRB |= (1 << 5); PORTB &= ~(1 << 5);
 | 
			
		||||
	} else {
 | 
			
		||||
		DDRB &= ~(1 << 5); PORTB &= ~(1 << 5);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    led_set_user(usb_led);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,3 +22,7 @@
 | 
			
		|||
 | 
			
		||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
 | 
			
		||||
#define DEBOUNCE 0
 | 
			
		||||
 | 
			
		||||
#define LED_NUM_LOCK_PIN A9
 | 
			
		||||
#define LED_CAPS_LOCK_PIN A10
 | 
			
		||||
#define LED_SCROLL_LOCK_PIN A8
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,43 +1 @@
 | 
			
		|||
#include "ixora.h"
 | 
			
		||||
 | 
			
		||||
void matrix_init_kb(void) {
 | 
			
		||||
    // put your keyboard start-up code here
 | 
			
		||||
    // runs once when the firmware starts up
 | 
			
		||||
    setPinOutput(A8);
 | 
			
		||||
    setPinOutput(A9);
 | 
			
		||||
    setPinOutput(A10);
 | 
			
		||||
    writePinLow(A8);
 | 
			
		||||
    writePinLow(A9);
 | 
			
		||||
    writePinLow(A10);
 | 
			
		||||
 | 
			
		||||
    matrix_init_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void matrix_scan_kb(void) {
 | 
			
		||||
 | 
			
		||||
    matrix_scan_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
 | 
			
		||||
    return process_record_user(keycode, record);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void led_set_kb(uint8_t usb_led) {
 | 
			
		||||
    if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
 | 
			
		||||
        writePinHigh(A10);
 | 
			
		||||
    } else {
 | 
			
		||||
        writePinLow(A10);
 | 
			
		||||
    }
 | 
			
		||||
    if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
 | 
			
		||||
        writePinHigh(A9);
 | 
			
		||||
    } else {
 | 
			
		||||
        writePinLow(A9);
 | 
			
		||||
    }
 | 
			
		||||
    if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
 | 
			
		||||
        writePinHigh(A8);
 | 
			
		||||
    } else {
 | 
			
		||||
        writePinLow(A8);
 | 
			
		||||
    }
 | 
			
		||||
    led_set_user(usb_led);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,10 +49,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
/* COL2ROW, ROW2COL*/
 | 
			
		||||
#define DIODE_DIRECTION COL2ROW
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
 | 
			
		||||
 */
 | 
			
		||||
//#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
 | 
			
		||||
#define LED_NUM_LOCK_PIN E6
 | 
			
		||||
#define LED_CAPS_LOCK_PIN C7
 | 
			
		||||
#define LED_PIN_ON_STATE 0
 | 
			
		||||
 | 
			
		||||
#define BACKLIGHT_PIN B7
 | 
			
		||||
//   #define BACKLIGHT_BREATHING
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,38 +14,3 @@
 | 
			
		|||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#include "verb.h"
 | 
			
		||||
 | 
			
		||||
// Optional override functions below.
 | 
			
		||||
// You can leave any or all of these undefined.
 | 
			
		||||
// These are only required if you want to perform custom actions.
 | 
			
		||||
 | 
			
		||||
void matrix_init_kb(void) {
 | 
			
		||||
    // put your keyboard start-up code here
 | 
			
		||||
    // runs once when the firmware starts up
 | 
			
		||||
 | 
			
		||||
    matrix_init_user();
 | 
			
		||||
    led_init_ports();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void led_init_ports(void) {
 | 
			
		||||
	setPinOutput(C7);
 | 
			
		||||
	setPinOutput(E6);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void led_set_kb(uint8_t usb_led) {
 | 
			
		||||
    // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
 | 
			
		||||
 | 
			
		||||
    if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
 | 
			
		||||
        writePinLow(C7);
 | 
			
		||||
    } else {
 | 
			
		||||
        writePinHigh(C7);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
 | 
			
		||||
        writePinLow(E6);
 | 
			
		||||
    } else {
 | 
			
		||||
        writePinHigh(E6);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    led_set_user(usb_led);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -91,6 +91,10 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
 | 
			
		||||
//#define MATRIX_HAS_GHOST
 | 
			
		||||
 | 
			
		||||
#define LED_NUM_LOCK_PIN C7
 | 
			
		||||
#define LED_CAPS_LOCK_PIN C6
 | 
			
		||||
#define LED_SCROLL_LOCK_PIN B6
 | 
			
		||||
 | 
			
		||||
/* number of backlight levels */
 | 
			
		||||
 | 
			
		||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,60 +14,3 @@
 | 
			
		|||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#include "osa.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// Optional override functions below.
 | 
			
		||||
// You can leave any or all of these undefined.
 | 
			
		||||
// These are only required if you want to perform custom actions.
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 | 
			
		||||
void matrix_init_kb(void) {
 | 
			
		||||
  // put your keyboard start-up code here
 | 
			
		||||
  // runs once when the firmware starts up
 | 
			
		||||
 | 
			
		||||
  matrix_init_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void matrix_scan_kb(void) {
 | 
			
		||||
  // put your looping keyboard code here
 | 
			
		||||
  // runs every cycle (a lot)
 | 
			
		||||
 | 
			
		||||
  matrix_scan_user();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
  // put your per-action keyboard code here
 | 
			
		||||
  // runs for every action, just before processing by the firmware
 | 
			
		||||
 | 
			
		||||
  return process_record_user(keycode, record);
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
void matrix_init_board(void){
 | 
			
		||||
    setPinOutput(C7);
 | 
			
		||||
    setPinOutput(C6);
 | 
			
		||||
    setPinOutput(B6);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void led_set_kb(uint8_t usb_led) {
 | 
			
		||||
  // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
 | 
			
		||||
 | 
			
		||||
  if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
 | 
			
		||||
        writePinHigh(C7);
 | 
			
		||||
    } else {
 | 
			
		||||
        writePinLow(C7);
 | 
			
		||||
    }
 | 
			
		||||
    if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
 | 
			
		||||
        writePinHigh(C6);
 | 
			
		||||
    } else {
 | 
			
		||||
        writePinLow(C6);
 | 
			
		||||
    }
 | 
			
		||||
    if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
 | 
			
		||||
        writePinHigh(B6);
 | 
			
		||||
    } else {
 | 
			
		||||
        writePinLow(B6);
 | 
			
		||||
    }
 | 
			
		||||
  led_set_user(usb_led);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue