Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor to use led config - Part 3 #10966

Merged
merged 4 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions keyboards/1upkeyboards/sweet16/v1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 0 additions & 20 deletions keyboards/1upkeyboards/sweet16/v1/v1.c
Original file line number Diff line number Diff line change
@@ -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
}
20 changes: 0 additions & 20 deletions keyboards/alps64/alps64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 2 additions & 0 deletions keyboards/alps64/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
29 changes: 0 additions & 29 deletions keyboards/amjpad/amjpad.c
Original file line number Diff line number Diff line change
@@ -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);
}
}
3 changes: 3 additions & 0 deletions keyboards/amjpad/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions keyboards/exclusive/e6v2/le/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 0 additions & 32 deletions keyboards/exclusive/e6v2/le/le.c
Original file line number Diff line number Diff line change
@@ -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);
}
}

2 changes: 2 additions & 0 deletions keyboards/exclusive/e7v1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 0 additions & 24 deletions keyboards/exclusive/e7v1/e7v1.c
Original file line number Diff line number Diff line change
@@ -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);
}

5 changes: 4 additions & 1 deletion keyboards/fc980c/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 0 additions & 37 deletions keyboards/fc980c/fc980c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
3 changes: 3 additions & 0 deletions keyboards/foxlab/leaf60/hotswap/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 0 additions & 43 deletions keyboards/foxlab/leaf60/hotswap/hotswap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
3 changes: 3 additions & 0 deletions keyboards/foxlab/leaf60/universal/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 0 additions & 45 deletions keyboards/foxlab/leaf60/universal/universal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
5 changes: 5 additions & 0 deletions keyboards/hineybush/hineyg80/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading