summaryrefslogtreecommitdiff
path: root/keyboards/annepro2
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/annepro2')
-rw-r--r--keyboards/annepro2/ap2_led.c18
-rw-r--r--keyboards/annepro2/ap2_led.h5
-rw-r--r--keyboards/annepro2/c15/config.h24
-rw-r--r--keyboards/annepro2/c15/info.json6
-rw-r--r--keyboards/annepro2/c15/rules.mk4
-rw-r--r--keyboards/annepro2/c18/config.h24
-rw-r--r--keyboards/annepro2/c18/info.json6
-rw-r--r--keyboards/annepro2/c18/rules.mk4
-rw-r--r--keyboards/annepro2/halconf.h4
-rw-r--r--keyboards/annepro2/info.json6
-rw-r--r--keyboards/annepro2/keymaps/default-full-caps/keymap.c8
-rw-r--r--keyboards/annepro2/keymaps/default-layer-indicators/keymap.c12
-rw-r--r--keyboards/annepro2/mcuconf.h8
-rw-r--r--keyboards/annepro2/protocol.h8
14 files changed, 113 insertions, 24 deletions
diff --git a/keyboards/annepro2/ap2_led.c b/keyboards/annepro2/ap2_led.c
index f12269f93d..8b42e470c2 100644
--- a/keyboards/annepro2/ap2_led.c
+++ b/keyboards/annepro2/ap2_led.c
@@ -138,6 +138,24 @@ void ap2_led_reset_foreground_color() {
ap2_led_mask_set_mono(color);
}
+void ap2_led_sticky_set_key(uint8_t row, uint8_t col, ap2_led_t color) {
+ uint8_t payload[] = {row, col, color.p.blue, color.p.green, color.p.red, color.p.alpha};
+ proto_tx(CMD_LED_STICKY_SET_KEY, payload, sizeof(payload), 1);
+}
+
+void ap2_led_unset_sticky_key(uint8_t row, uint8_t col) {
+ uint8_t payload[] = {row, col};
+ proto_tx(CMD_LED_STICKY_UNSET_KEY, payload, sizeof(payload), 1);
+}
+
+void ap2_led_unset_sticky_row(uint8_t row) {
+ uint8_t payload[] = {row};
+ proto_tx(CMD_LED_STICKY_UNSET_ROW, payload, sizeof(payload), 1);
+}
+void ap2_led_unset_sticky_all(void) {
+ proto_tx(CMD_LED_STICKY_UNSET_ALL, NULL, 0, 1);
+}
+
/*
* Currently keypresses are unified with other messages, still with single 1
* byte payload. Transfer is normally fast enough for that to not be a problem -
diff --git a/keyboards/annepro2/ap2_led.h b/keyboards/annepro2/ap2_led.h
index 43f78c03e3..9d9a3aca7e 100644
--- a/keyboards/annepro2/ap2_led.h
+++ b/keyboards/annepro2/ap2_led.h
@@ -86,6 +86,11 @@ void ap2_led_blink(uint8_t row, uint8_t col, ap2_led_t color, uint8_t count, uin
void ap2_led_set_foreground_color(uint8_t red, uint8_t green, uint8_t blue);
void ap2_led_reset_foreground_color(void);
+void ap2_led_sticky_set_key(uint8_t row, uint8_t col, ap2_led_t color);
+void ap2_led_unset_sticky_key(uint8_t row, uint8_t col);
+void ap2_led_unset_sticky_row(uint8_t row);
+void ap2_led_unset_sticky_all(void);
+
typedef struct {
uint8_t amount_of_profiles;
uint8_t current_profile;
diff --git a/keyboards/annepro2/c15/config.h b/keyboards/annepro2/c15/config.h
index ff92aeea8e..ea38f4dce3 100644
--- a/keyboards/annepro2/c15/config.h
+++ b/keyboards/annepro2/c15/config.h
@@ -20,12 +20,6 @@
#include "pin_defs.h"
#include "config_led.h"
-/* USB Device descriptor parameter */
-#define VENDOR_ID 0xfeed
-#define PRODUCT_ID 0xac15
-#define DEVICE_VER 0x1337
-#define MANUFACTURER Obins
-#define PRODUCT Anne Pro 2 QMK
// key matrix size
#define MATRIX_ROWS 5
#define MATRIX_COLS 14
@@ -49,3 +43,21 @@
// Obins stock firmware has something similar to this already enabled, but disabled by default in QMK
#define PERMISSIVE_HOLD
+
+// SPI configuration
+#define SPI_DRIVER SPID1
+#define SPI_SCK_PIN A0
+#define SPI_MOSI_PIN A1
+#define SPI_MISO_PIN A2
+
+// Flash configuration
+#define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN B6
+#define EXTERNAL_FLASH_SPI_CLOCK_DIVISOR 16
+#define EXTERNAL_FLASH_PAGE_SIZE 256
+#define EXTERNAL_FLASH_SECTOR_SIZE 4096
+#define EXTERNAL_FLASH_BLOCK_SIZE 4096
+#define EXTERNAL_FLASH_SIZE (256 * 1024) // 2M-bit flash size
+
+// Wear-leveling driver configuration
+#define WEAR_LEVELING_LOGICAL_SIZE 1024
+#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2)
diff --git a/keyboards/annepro2/c15/info.json b/keyboards/annepro2/c15/info.json
new file mode 100644
index 0000000000..c8c637ccfb
--- /dev/null
+++ b/keyboards/annepro2/c15/info.json
@@ -0,0 +1,6 @@
+{
+ "keyboard_name": "Anne Pro 2 C15 (QMK)",
+ "usb": {
+ "pid": "0xAC15"
+ }
+}
diff --git a/keyboards/annepro2/c15/rules.mk b/keyboards/annepro2/c15/rules.mk
index 2c518b6339..302aeecbe6 100644
--- a/keyboards/annepro2/c15/rules.mk
+++ b/keyboards/annepro2/c15/rules.mk
@@ -26,6 +26,10 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
+# Wear-levelling driver
+EEPROM_DRIVER = wear_leveling
+WEAR_LEVELING_DRIVER = spi_flash
+
# Custom RGB matrix handling
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = custom
diff --git a/keyboards/annepro2/c18/config.h b/keyboards/annepro2/c18/config.h
index 82a406a157..6b6307c3d0 100644
--- a/keyboards/annepro2/c18/config.h
+++ b/keyboards/annepro2/c18/config.h
@@ -20,12 +20,6 @@
#include "pin_defs.h"
#include "config_led.h"
-/* USB Device descriptor parameter */
-#define VENDOR_ID 0xfeed
-#define PRODUCT_ID 0xac18
-#define DEVICE_VER 0x1337
-#define MANUFACTURER Obins
-#define PRODUCT Anne Pro 2(c18)QMK
// key matrix size
#define MATRIX_ROWS 5
#define MATRIX_COLS 14
@@ -47,3 +41,21 @@
// Obins stock firmware has something similar to this already enabled, but disabled by default in QMK
#define PERMISSIVE_HOLD
+
+// SPI configuration
+#define SPI_DRIVER SPID1
+#define SPI_SCK_PIN A0
+#define SPI_MOSI_PIN A1
+#define SPI_MISO_PIN A2
+
+// Flash configuration
+#define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN A3
+#define EXTERNAL_FLASH_SPI_CLOCK_DIVISOR 16
+#define EXTERNAL_FLASH_PAGE_SIZE 256
+#define EXTERNAL_FLASH_SECTOR_SIZE 4096
+#define EXTERNAL_FLASH_BLOCK_SIZE 4096
+#define EXTERNAL_FLASH_SIZE (256 * 1024) // 2M-bit flash size
+
+// Wear-leveling driver configuration
+#define WEAR_LEVELING_LOGICAL_SIZE 1024
+#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2)
diff --git a/keyboards/annepro2/c18/info.json b/keyboards/annepro2/c18/info.json
new file mode 100644
index 0000000000..94b96a2c44
--- /dev/null
+++ b/keyboards/annepro2/c18/info.json
@@ -0,0 +1,6 @@
+{
+ "keyboard_name": "Anne Pro 2 C18 (QMK)",
+ "usb": {
+ "pid": "0xAC18"
+ }
+}
diff --git a/keyboards/annepro2/c18/rules.mk b/keyboards/annepro2/c18/rules.mk
index 60c2e08648..b1c7208f8b 100644
--- a/keyboards/annepro2/c18/rules.mk
+++ b/keyboards/annepro2/c18/rules.mk
@@ -26,6 +26,10 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
+# Wear-levelling driver
+EEPROM_DRIVER = wear_leveling
+WEAR_LEVELING_DRIVER = spi_flash
+
# Custom RGB matrix handling
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = custom
diff --git a/keyboards/annepro2/halconf.h b/keyboards/annepro2/halconf.h
index 686b91a7fb..dcb04eab1b 100644
--- a/keyboards/annepro2/halconf.h
+++ b/keyboards/annepro2/halconf.h
@@ -25,4 +25,8 @@
#define SERIAL_USB_BUFFERS_SIZE 256
+#define HAL_USE_SPI TRUE
+#define SPI_USE_WAIT TRUE
+#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
+
#include_next <halconf.h>
diff --git a/keyboards/annepro2/info.json b/keyboards/annepro2/info.json
index 95786329b2..d2ddae4053 100644
--- a/keyboards/annepro2/info.json
+++ b/keyboards/annepro2/info.json
@@ -1,7 +1,11 @@
{
- "keyboard_name": "Anne Pro 2",
+ "manufacturer": "Obins",
"url": "https://openannepro.github.io/",
"maintainer": "bwisn",
+ "usb": {
+ "vid": "0xFEED",
+ "device_version": "13.3.7"
+ },
"layouts": {
"LAYOUT_60_ansi": {
"layout": [
diff --git a/keyboards/annepro2/keymaps/default-full-caps/keymap.c b/keyboards/annepro2/keymaps/default-full-caps/keymap.c
index c87447d311..cb6147d40a 100644
--- a/keyboards/annepro2/keymaps/default-full-caps/keymap.c
+++ b/keyboards/annepro2/keymaps/default-full-caps/keymap.c
@@ -96,7 +96,7 @@ enum anne_pro_layers {
*
*/
[FN2] = LAYOUT_60_ansi( /* FN2 */
- _______, KC_AP2_BT1, KC_AP2_BT2, KC_AP2_BT3, KC_AP2_BT4, _______, _______, _______, KC_AP_LED_OFF, KC_AP_LED_ON, _______, _______, _______, _______,
+ _______, KC_AP2_BT1, KC_AP2_BT2, KC_AP2_BT3, KC_AP2_BT4, _______, _______, _______, _______, KC_AP_RGB_MOD, KC_AP_RGB_TOG, KC_AP_RGB_VAD, KC_AP_RGB_VAI, _______,
MO(FN2), _______, KC_UP, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_HOME, KC_END, _______,
_______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, _______, KC_PGUP, KC_PGDN, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, KC_DEL, _______,
@@ -109,9 +109,11 @@ enum anne_pro_layers {
bool led_update_user(led_t leds) {
if (leds.caps_lock) {
// Set the leds to red
- ap2_led_set_foreground_color(0xFF, 0x00, 0x00);
+ const ap2_led_t color = {.p.red = 0xff, .p.green = 0x00, .p.blue = 0x00, .p.alpha = 0xff};
+ ap2_led_mask_set_mono(color);
} else {
- ap2_led_reset_foreground_color();
+ const ap2_led_t color = {.p.red = 0x00, .p.green = 0x00, .p.blue = 0x00, .p.alpha = 0x00};
+ ap2_led_mask_set_mono(color);
}
return true;
diff --git a/keyboards/annepro2/keymaps/default-layer-indicators/keymap.c b/keyboards/annepro2/keymaps/default-layer-indicators/keymap.c
index 1fd97c584e..ca042dcd32 100644
--- a/keyboards/annepro2/keymaps/default-layer-indicators/keymap.c
+++ b/keyboards/annepro2/keymaps/default-layer-indicators/keymap.c
@@ -96,7 +96,7 @@ enum anne_pro_layers {
*
*/
[FN2] = LAYOUT_60_ansi( /* FN2 */
- _______, KC_AP2_BT1, KC_AP2_BT2, KC_AP2_BT3, KC_AP2_BT4, _______, _______, _______, _______, KC_AP_LED_TOG, KC_AP_LED_NEXT_INTENSITY, KC_AP_LED_PREV_PROFILE, KC_AP_LED_NEXT_PROFILE, _______,
+ _______, KC_AP2_BT1, KC_AP2_BT2, KC_AP2_BT3, KC_AP2_BT4, _______, _______, _______, _______, KC_AP_RGB_MOD, KC_AP_RGB_TOG, KC_AP_RGB_VAD, KC_AP_RGB_VAI, _______,
MO(FN2), _______, KC_UP, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_HOME, KC_END, _______,
_______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, _______, KC_PGUP, KC_PGDN, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, KC_DEL, _______,
@@ -134,16 +134,12 @@ bool led_update_user(led_t leds) {
if (leds.caps_lock) {
// Set the caps-lock to red
const ap2_led_t color = {.p.red = 0xff, .p.green = 0x00, .p.blue = 0x00, .p.alpha = 0xff};
-
- ap2_led_mask_set_key(2, 0, color);
+ ap2_led_sticky_set_key(2, 0, color);
/* NOTE: Instead of colouring the capslock only, you can change the whole
- keyboard with ap2_led_set_foreground_color */
+ keyboard with ap2_led_mask_set_mono */
} else {
// Reset the capslock if there is no layer active
- if (!layer_state_is(FN1) && !layer_state_is(FN2)) {
- const ap2_led_t color = {.p.red = 0xff, .p.green = 0x00, .p.blue = 0x00, .p.alpha = 0x00};
- ap2_led_mask_set_key(2, 0, color);
- }
+ ap2_led_unset_sticky_key(2, 0);
}
return true;
diff --git a/keyboards/annepro2/mcuconf.h b/keyboards/annepro2/mcuconf.h
index 8265fe6eb9..9e39bd9681 100644
--- a/keyboards/annepro2/mcuconf.h
+++ b/keyboards/annepro2/mcuconf.h
@@ -60,3 +60,11 @@
#define HT32_USB_USE_USB0 TRUE
#define HT32_USB_USB0_IRQ_PRIORITY 5
+
+/*
+ * SPI driver setting
+ */
+
+#define HT32_SPI_USE_SPI1 TRUE
+#define HT32_SPI1_IRQ_PRIORITY 9
+
diff --git a/keyboards/annepro2/protocol.h b/keyboards/annepro2/protocol.h
index 41610054e0..d38fd0a66e 100644
--- a/keyboards/annepro2/protocol.h
+++ b/keyboards/annepro2/protocol.h
@@ -55,6 +55,14 @@ enum {
/* Number of profiles, current profile, on/off state,
reactive flag, brightness, errors */
CMD_LED_STATUS = 0x41,
+
+ /* Set sticky key, meaning the key will light up even when LEDs are turned off */
+ CMD_LED_STICKY_SET_KEY = 0x50,
+ CMD_LED_STICKY_SET_ROW = 0x51,
+ CMD_LED_STICKY_SET_MONO = 0x52,
+ CMD_LED_STICKY_UNSET_KEY = 0x53,
+ CMD_LED_STICKY_UNSET_ROW = 0x54,
+ CMD_LED_STICKY_UNSET_ALL = 0x55,
};
/* 1 ROW * 14 COLS * 4B (RGBX) = 56 + header prefix. */