diff options
| author | Joel Challis <git@zvecr.com> | 2020-11-17 17:06:23 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-17 17:06:23 +0000 |
| commit | adfd34c4512f6215a49a8f705ce408d6c82fb8cc (patch) | |
| tree | 8906980e1e581609db99856c449395afece1709e /keyboards/bpiphany | |
| parent | 3c156e130b3e7a24166eb20bf862aaaac8ceff53 (diff) | |
| download | qmk_firmware-adfd34c4512f6215a49a8f705ce408d6c82fb8cc.tar.gz qmk_firmware-adfd34c4512f6215a49a8f705ce408d6c82fb8cc.zip | |
Refactor to use led config - Part 2 (#10906)
* Refactor to use led config
* Refactor to use led config
* Refactor to use led config
Diffstat (limited to 'keyboards/bpiphany')
| -rw-r--r-- | keyboards/bpiphany/kitten_paw/config.h | 7 | ||||
| -rw-r--r-- | keyboards/bpiphany/kitten_paw/kitten_paw.c | 50 | ||||
| -rw-r--r-- | keyboards/bpiphany/kitten_paw/kitten_paw.h | 11 | ||||
| -rw-r--r-- | keyboards/bpiphany/tiger_lily/config.h | 5 | ||||
| -rw-r--r-- | keyboards/bpiphany/tiger_lily/tiger_lily.c | 62 | ||||
| -rw-r--r-- | keyboards/bpiphany/unloved_bastard/config.h | 5 | ||||
| -rw-r--r-- | keyboards/bpiphany/unloved_bastard/unloved_bastard.c | 54 |
7 files changed, 16 insertions, 178 deletions
diff --git a/keyboards/bpiphany/kitten_paw/config.h b/keyboards/bpiphany/kitten_paw/config.h index 89f104cfe..5e1429c8d 100644 --- a/keyboards/bpiphany/kitten_paw/config.h +++ b/keyboards/bpiphany/kitten_paw/config.h | |||
| @@ -47,7 +47,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 47 | 47 | ||
| 48 | /* COL2ROW or ROW2COL */ | 48 | /* COL2ROW or ROW2COL */ |
| 49 | #define DIODE_DIRECTION COL2ROW | 49 | #define DIODE_DIRECTION COL2ROW |
| 50 | 50 | ||
| 51 | #define LED_NUM_LOCK_PIN B7 | ||
| 52 | #define LED_CAPS_LOCK_PIN C6 | ||
| 53 | #define LED_SCROLL_LOCK_PIN C5 | ||
| 54 | #define LED_PIN_ON_STATE 0 | ||
| 55 | |||
| 51 | // #define BACKLIGHT_PIN B7 | 56 | // #define BACKLIGHT_PIN B7 |
| 52 | // #define BACKLIGHT_BREATHING | 57 | // #define BACKLIGHT_BREATHING |
| 53 | // #define BACKLIGHT_LEVELS 3 | 58 | // #define BACKLIGHT_LEVELS 3 |
diff --git a/keyboards/bpiphany/kitten_paw/kitten_paw.c b/keyboards/bpiphany/kitten_paw/kitten_paw.c index 26cb533f2..e71b3c801 100644 --- a/keyboards/bpiphany/kitten_paw/kitten_paw.c +++ b/keyboards/bpiphany/kitten_paw/kitten_paw.c | |||
| @@ -1,51 +1 @@ | |||
| 1 | #include "kitten_paw.h" | #include "kitten_paw.h" | |
| 2 | |||
| 3 | void matrix_init_kb(void) { | ||
| 4 | // put your keyboard start-up code here | ||
| 5 | // runs once when the firmware starts up | ||
| 6 | |||
| 7 | matrix_init_user(); | ||
| 8 | } | ||
| 9 | |||
| 10 | void matrix_scan_kb(void) { | ||
| 11 | // put your looping keyboard code here | ||
| 12 | // runs every cycle (a lot) | ||
| 13 | |||
| 14 | matrix_scan_user(); | ||
| 15 | } | ||
| 16 | |||
| 17 | __attribute__ ((weak)) | ||
| 18 | void matrix_init_user(void) { | ||
| 19 | } | ||
| 20 | |||
| 21 | __attribute__ ((weak)) | ||
| 22 | void matrix_scan_user(void) { | ||
| 23 | } | ||
| 24 | |||
| 25 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 26 | // put your per-action keyboard code here | ||
| 27 | // runs for every action, just before processing by the firmware | ||
| 28 | |||
| 29 | return process_record_user(keycode, record); | ||
| 30 | } | ||
| 31 | |||
| 32 | void led_set_kb(uint8_t usb_led) { | ||
| 33 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
| 34 | CONFIG_LED_IO; | ||
| 35 | CONFIG_LED_IO; | ||
| 36 | print_dec(usb_led); | ||
| 37 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) | ||
| 38 | USB_LED_CAPS_LOCK_ON; | ||
| 39 | else | ||
| 40 | USB_LED_CAPS_LOCK_OFF; | ||
| 41 | |||
| 42 | if (usb_led & (1<<USB_LED_NUM_LOCK)) | ||
| 43 | USB_LED_NUM_LOCK_ON; | ||
| 44 | else | ||
| 45 | USB_LED_NUM_LOCK_OFF; | ||
| 46 | if (usb_led & (1<<USB_LED_SCROLL_LOCK)) | ||
| 47 | USB_LED_SCROLL_LOCK_ON; | ||
| 48 | else | ||
| 49 | USB_LED_SCROLL_LOCK_OFF; | ||
| 50 | led_set_user(usb_led); | ||
| 51 | } | ||
diff --git a/keyboards/bpiphany/kitten_paw/kitten_paw.h b/keyboards/bpiphany/kitten_paw/kitten_paw.h index 4de550f81..38b2a9433 100644 --- a/keyboards/bpiphany/kitten_paw/kitten_paw.h +++ b/keyboards/bpiphany/kitten_paw/kitten_paw.h | |||
| @@ -3,17 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #include "quantum.h" | 4 | #include "quantum.h" |
| 5 | 5 | ||
| 6 | #define CONFIG_LED_IO \ | ||
| 7 | DDRB |= (1<<7); \ | ||
| 8 | DDRC |= (1<<5) | (1<<6); | ||
| 9 | |||
| 10 | #define USB_LED_CAPS_LOCK_ON PORTC &= ~(1<<6) | ||
| 11 | #define USB_LED_CAPS_LOCK_OFF PORTC |= (1<<6) | ||
| 12 | #define USB_LED_NUM_LOCK_ON PORTB &= ~(1<<7) | ||
| 13 | #define USB_LED_NUM_LOCK_OFF PORTB |= (1<<7) | ||
| 14 | #define USB_LED_SCROLL_LOCK_ON PORTC &= ~(1<<5) | ||
| 15 | #define USB_LED_SCROLL_LOCK_OFF PORTC |= (1<<5) | ||
| 16 | |||
| 17 | // This a shortcut to help you visually see your layout. | 6 | // This a shortcut to help you visually see your layout. |
| 18 | // The first section contains all of the arguements | 7 | // The first section contains all of the arguements |
| 19 | // The second converts the arguments into a two-dimensional array | 8 | // The second converts the arguments into a two-dimensional array |
diff --git a/keyboards/bpiphany/tiger_lily/config.h b/keyboards/bpiphany/tiger_lily/config.h index 1ab352ccb..d7eb42941 100644 --- a/keyboards/bpiphany/tiger_lily/config.h +++ b/keyboards/bpiphany/tiger_lily/config.h | |||
| @@ -44,6 +44,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 44 | */ | 44 | */ |
| 45 | #define UNUSED_PINS { B0, C4, D3 } | 45 | #define UNUSED_PINS { B0, C4, D3 } |
| 46 | 46 | ||
| 47 | #define LED_NUM_LOCK_PIN C5 | ||
| 48 | #define LED_CAPS_LOCK_PIN C6 | ||
| 49 | #define LED_SCROLL_LOCK_PIN B7 | ||
| 50 | #define LED_PIN_ON_STATE 0 | ||
| 51 | |||
| 47 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | 52 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ |
| 48 | #define DEBOUNCE 5 | 53 | #define DEBOUNCE 5 |
| 49 | 54 | ||
diff --git a/keyboards/bpiphany/tiger_lily/tiger_lily.c b/keyboards/bpiphany/tiger_lily/tiger_lily.c index d2e7ba709..f57f8b5f5 100644 --- a/keyboards/bpiphany/tiger_lily/tiger_lily.c +++ b/keyboards/bpiphany/tiger_lily/tiger_lily.c | |||
| @@ -1,63 +1 @@ | |||
| 1 | #include "tiger_lily.h" | #include "tiger_lily.h" | |
| 2 | |||
| 3 | void matrix_init_kb(void) { | ||
| 4 | // put your keyboard start-up code here | ||
| 5 | // runs once when the firmware starts up | ||
| 6 | |||
| 7 | matrix_init_user(); | ||
| 8 | } | ||
| 9 | |||
| 10 | void matrix_scan_kb(void) { | ||
| 11 | // put your looping keyboard code here | ||
| 12 | // runs every cycle (a lot) | ||
| 13 | |||
| 14 | matrix_scan_user(); | ||
| 15 | } | ||
| 16 | |||
| 17 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 18 | // put your per-action keyboard code here | ||
| 19 | // runs for every action, just before processing by the firmware | ||
| 20 | |||
| 21 | return process_record_user(keycode, record); | ||
| 22 | } | ||
| 23 | |||
| 24 | void led_set_kb(uint8_t usb_led) { | ||
| 25 | DDRB |= (1<<7); | ||
| 26 | DDRC |= (1<<5) | (1<<6); | ||
| 27 | |||
| 28 | print_dec(usb_led); | ||
| 29 | |||
| 30 | if (usb_led & (1<<USB_LED_NUM_LOCK)) | ||
| 31 | PORTC &= ~(1<<5); | ||
| 32 | else | ||
| 33 | PORTC |= (1<<5); | ||
| 34 | |||
| 35 | if (usb_led & (1<<USB_LED_SCROLL_LOCK)) | ||
| 36 | PORTB &= ~(1<<7); | ||
| 37 | else | ||
| 38 | PORTB |= (1<<7); | ||
| 39 | |||
| 40 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) | ||
| 41 | PORTC &= ~(1<<6); | ||
| 42 | else | ||
| 43 | PORTC |= (1<<6); | ||
| 44 | |||
| 45 | led_set_user(usb_led); | ||
| 46 | } | ||
| 47 | |||
| 48 | __attribute__ ((weak)) | ||
| 49 | void matrix_init_user(void) { | ||
| 50 | } | ||
| 51 | |||
| 52 | __attribute__ ((weak)) | ||
| 53 | void matrix_scan_user(void) { | ||
| 54 | } | ||
| 55 | |||
| 56 | __attribute__ ((weak)) | ||
| 57 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 58 | return true; | ||
| 59 | } | ||
| 60 | |||
| 61 | __attribute__ ((weak)) | ||
| 62 | void led_set_user(uint8_t usb_led) { | ||
| 63 | } \ No newline at end of file | ||
diff --git a/keyboards/bpiphany/unloved_bastard/config.h b/keyboards/bpiphany/unloved_bastard/config.h index 029cdb59e..e67ca658f 100644 --- a/keyboards/bpiphany/unloved_bastard/config.h +++ b/keyboards/bpiphany/unloved_bastard/config.h | |||
| @@ -35,6 +35,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 35 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | 35 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ |
| 36 | #define DEBOUNCE 5 | 36 | #define DEBOUNCE 5 |
| 37 | 37 | ||
| 38 | #define LED_NUM_LOCK_PIN B7 | ||
| 39 | #define LED_CAPS_LOCK_PIN C5 | ||
| 40 | #define LED_SCROLL_LOCK_PIN C6 | ||
| 41 | #define LED_PIN_ON_STATE 0 | ||
| 42 | |||
| 38 | /* define if matrix has ghost (lacks anti-ghosting diodes) */ | 43 | /* define if matrix has ghost (lacks anti-ghosting diodes) */ |
| 39 | //#define MATRIX_HAS_GHOST | 44 | //#define MATRIX_HAS_GHOST |
| 40 | 45 | ||
diff --git a/keyboards/bpiphany/unloved_bastard/unloved_bastard.c b/keyboards/bpiphany/unloved_bastard/unloved_bastard.c index 197593060..f4b8032a0 100644 --- a/keyboards/bpiphany/unloved_bastard/unloved_bastard.c +++ b/keyboards/bpiphany/unloved_bastard/unloved_bastard.c | |||
| @@ -14,57 +14,3 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | #include "unloved_bastard.h" | 16 | #include "unloved_bastard.h" |
| 17 | |||
| 18 | void matrix_init_kb(void) { | ||
| 19 | // put your keyboard start-up code here | ||
| 20 | // runs once when the firmware starts up | ||
| 21 | led_init_ports(); | ||
| 22 | matrix_init_user(); | ||
| 23 | } | ||
| 24 | |||
| 25 | void matrix_scan_kb(void) { | ||
| 26 | // put your looping keyboard code here | ||
| 27 | // runs every cycle (a lot) | ||
| 28 | |||
| 29 | matrix_scan_user(); | ||
| 30 | } | ||
| 31 | |||
| 32 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 33 | // put your per-action keyboard code here | ||
| 34 | // runs for every action, just before processing by the firmware | ||
| 35 | return process_record_user(keycode, record); | ||
| 36 | } | ||
| 37 | |||
| 38 | // C5 left | ||
| 39 | // C6 middle led | ||
| 40 | // B7 right led | ||
| 41 | void led_init_ports(void) { | ||
| 42 | DDRB |= (1<<7); | ||
| 43 | DDRC |= (1<<5); | ||
| 44 | DDRC |= (1<<6); | ||
| 45 | |||
| 46 | PORTB |= (1<<7); | ||
| 47 | PORTC |= (1<<5); | ||
| 48 | PORTC |= (1<<6); | ||
| 49 | } | ||
| 50 | |||
| 51 | |||
| 52 | void led_set_kb(uint8_t usb_led) { | ||
| 53 | |||
| 54 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) | ||
| 55 | PORTC &= ~(1<<5); | ||
| 56 | else | ||
| 57 | PORTC |= (1<<5); | ||
| 58 | |||
| 59 | if (usb_led & (1<<USB_LED_NUM_LOCK)) | ||
| 60 | PORTB &= ~(1<<7); | ||
| 61 | else | ||
| 62 | PORTB |= (1<<7); | ||
| 63 | |||
| 64 | if (usb_led & (1<<USB_LED_SCROLL_LOCK)) | ||
| 65 | PORTC &= ~(1<<6); | ||
| 66 | else | ||
| 67 | PORTC |= (1<<6); | ||
| 68 | |||
| 69 | led_set_user(usb_led); | ||
| 70 | } | ||
