From dc67fd9b87b0e86cea8d176d8b9bbce3e8a8676d Mon Sep 17 00:00:00 2001 From: jpe230 Date: Tue, 8 Mar 2022 23:49:29 -0600 Subject: Various improvements for the AnnePro2 (#16579) --- keyboards/annepro2/ap2_led.h | 93 ++++++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 42 deletions(-) (limited to 'keyboards/annepro2/ap2_led.h') diff --git a/keyboards/annepro2/ap2_led.h b/keyboards/annepro2/ap2_led.h index 23712a2555..b68589d204 100644 --- a/keyboards/annepro2/ap2_led.h +++ b/keyboards/annepro2/ap2_led.h @@ -1,18 +1,18 @@ /* Copyright 2021 OpenAnnePro community - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #pragma once @@ -31,54 +31,63 @@ typedef union { uint8_t pv[4]; /* 0xrgb in mem is b g r a */ uint32_t rgb; -} annepro2Led_t; +} ap2_led_t; #define ROWCOL2IDX(row, col) (NUM_COLUMN * (row) + (col)) #define NUM_COLUMN 14 #define NUM_ROW 5 #define KEY_COUNT 70 -/* Local copy of ledMask, used to override colors on the board */ -extern annepro2Led_t ledMask[KEY_COUNT]; +/* Local copy of led_mask, used to override colors on the board */ +extern ap2_led_t led_mask[KEY_COUNT]; +extern uint8_t rgb_row_changed[NUM_ROW]; /* Handle incoming messages */ -extern void ledCommandCallback(const message_t *msg); +extern void led_command_callback(const message_t *msg); -void annepro2SetIAP(void); -void annepro2LedDisable(void); -void annepro2LedEnable(void); -void annepro2LedSetProfile(uint8_t prof); -void annepro2LedGetStatus(void); -void annepro2LedNextProfile(void); -void annepro2LedPrevProfile(void); -void annepro2LedNextIntensity(void); -void annepro2LedNextAnimationSpeed(void); -void annepro2LedForwardKeypress(uint8_t row, uint8_t col); +void ap2_set_IAP(void); +void ap2_led_disable(void); +void ap2_led_enable(void); +void ap2_led_set_profile(uint8_t prof); +void ap2_led_get_status(void); +void ap2_led_next_profile(void); +void ap2_led_prev_profile(void); +void ap2_led_next_intensity(void); +void ap2_led_next_animation_speed(void); +void ap2_led_forward_keypress(uint8_t row, uint8_t col); /* Set single key to a given color; alpha controls which is displayed */ -void annepro2LedMaskSetKey(uint8_t row, uint8_t col, annepro2Led_t color); +void ap2_led_mask_set_key(uint8_t row, uint8_t col, ap2_led_t color); /* Push a whole local row to the shine */ -void annepro2LedMaskSetRow(uint8_t row); +void ap2_led_mask_set_row(uint8_t row); /* Synchronize all rows */ -void annepro2LedMaskSetAll(void); +void ap2_led_mask_set_all(void); /* Set all keys to a given color */ -void annepro2LedMaskSetMono(annepro2Led_t color); +void ap2_led_mask_set_mono(ap2_led_t color); /* Blink given key `count` times by masking it with a `color`. Blink takes `hundredths` of a second */ -void annepro2LedBlink(uint8_t row, uint8_t col, annepro2Led_t color, uint8_t count, uint8_t hundredths); +void ap2_led_blink(uint8_t row, uint8_t col, ap2_led_t color, uint8_t count, uint8_t hundredths); /* Kept for compatibility, but implemented using masks */ -void annepro2LedSetForegroundColor(uint8_t red, uint8_t green, uint8_t blue); -void annepro2LedResetForegroundColor(void); +void ap2_led_set_foreground_color(uint8_t red, uint8_t green, uint8_t blue); +void ap2_led_reset_foreground_color(void); typedef struct { - uint8_t amountOfProfiles; - uint8_t currentProfile; - uint8_t matrixEnabled; - uint8_t isReactive; - uint8_t ledIntensity; + uint8_t amount_of_profiles; + uint8_t current_profile; + uint8_t matrix_enabled; + uint8_t is_reactive; + uint8_t led_intensity; uint8_t errors; -} annepro2LedStatus_t; +} ap2_led_status_t; -extern annepro2LedStatus_t annepro2LedStatus; +extern ap2_led_status_t ap2_led_status; + +#ifdef RGB_MATRIX_ENABLE +/* RGB driver functions */ +void init(void); +void flush(void); +void set_color(int index, uint8_t r, uint8_t g, uint8_t b); +void set_color_all(uint8_t r, uint8_t g, uint8_t b); +#endif -- cgit v1.2.3