diff --git a/keyboards/aki27/cocot46plus/cocot46plus.c b/keyboards/aki27/cocot46plus/cocot46plus.c index 46170597a00..ed4751ca756 100644 --- a/keyboards/aki27/cocot46plus/cocot46plus.c +++ b/keyboards/aki27/cocot46plus/cocot46plus.c @@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include QMK_KEYBOARD_H #include "cocot46plus.h" #include @@ -235,18 +236,7 @@ void render_logo(void) { void oled_write_layer_state(void) { oled_write_P(PSTR(" "), false); - // int cpi = pointing_device_get_cpi(); - int cpi = cpi_array[cocot_config.cpi_idx]; - int scroll_div = scrl_div_array[cocot_config.scrl_div]; - int angle = angle_array[cocot_config.rotation_angle]; - char buf1[5]; - char buf2[3]; - char buf3[4]; - snprintf(buf1, 5, "%4d", cpi); - snprintf(buf2, 3, "%2d", scroll_div); - snprintf(buf3, 4, "%3d", angle); - switch (get_highest_layer(layer_state | default_layer_state)) { case 0: oled_write_P(PSTR("Base "), false); @@ -279,12 +269,17 @@ void oled_write_layer_state(void) { } else{ oled_write_P(PSTR("C"), false); } + + int cpi = cpi_array[cocot_config.cpi_idx]; + int scroll_div = scrl_div_array[cocot_config.scrl_div]; + int angle = angle_array[cocot_config.rotation_angle]; + oled_write_P(PSTR("/"), false); - oled_write(buf1, false); + oled_write(get_u16_str(cpi,' '), false); oled_write_P(PSTR("/"), false); - oled_write(buf2, false); + oled_write(get_u8_str(scroll_div,' '), false); oled_write_P(PSTR("/"), false); - oled_write(buf3, false); + oled_write(get_u16_str(angle,' '), false); } #endif diff --git a/keyboards/aki27/cocot46plus/cocot46plus.h b/keyboards/aki27/cocot46plus/cocot46plus.h index e0f530dff63..dba6ac69d9b 100644 --- a/keyboards/aki27/cocot46plus/cocot46plus.h +++ b/keyboards/aki27/cocot46plus/cocot46plus.h @@ -31,30 +31,8 @@ typedef union { }; } cocot_config_t; - - extern cocot_config_t cocot_config; -enum cocot_keycodes { - - COCOT_SAFE_RANGE = SAFE_RANGE, - CPI_SW, - SCRL_SW, - ROT_R15, - ROT_L15, - SCRL_MO, - SCRL_TO, - SCRL_IN, - -}; - -#define CPI_SW QK_USER_0 -#define SCRL_SW QK_USER_1 -#define ROT_R15 QK_USER_2 -#define ROT_L15 QK_USER_3 -#define SCRL_MO QK_USER_4 -#define SCRL_TO QK_USER_5 -#define SCRL_IN QK_USER_6 bool cocot_get_scroll_mode(void); void cocot_set_scroll_mode(bool mode); diff --git a/keyboards/aki27/cocot46plus/config.h b/keyboards/aki27/cocot46plus/config.h index e5806c38853..d8ffbd74f51 100644 --- a/keyboards/aki27/cocot46plus/config.h +++ b/keyboards/aki27/cocot46plus/config.h @@ -22,5 +22,15 @@ along with this program. If not, see . #define ADNS5050_SDIO_PIN B4 #define ADNS5050_CS_PIN B5 +/* key matrix size */ +#define MATRIX_ROWS 10 +#define MATRIX_COLS 6 + +// wiring of each half +#define MATRIX_ROW_PINS { D4, C6, D7, E6, NO_PIN } +#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3 } + +#define DIODE_DIRECTION COL2ROW + #define POINTING_DEVICE_ROTATION_180 #define OLED_FONT_H "keyboards/aki27/cocot46plus/glcdfont.c" diff --git a/keyboards/aki27/cocot46plus/keyboard.json b/keyboards/aki27/cocot46plus/keyboard.json index 10a01ba8e4c..b8dd276056e 100644 --- a/keyboards/aki27/cocot46plus/keyboard.json +++ b/keyboards/aki27/cocot46plus/keyboard.json @@ -2,7 +2,7 @@ "keyboard_name": "cocot46plus", "manufacturer": "aki27", "maintainer": "markstos", - "tags": ["unibody","ergo","corne","trackball","encoder","rgb"] + "tags": ["unibody","ergo","corne","trackball","encoder","rgb"], "usb": { "device_version": "1.0.0", "pid": "0x0003", @@ -17,27 +17,9 @@ "encoder":true, "extrakey": true, "mousekey": true, - "oled": true, "pointing_device": true, "rgblight": true }, - "matrix_pins": { - "cols": ["F4", "F5", "F6", "F7", "B1", "B3"], - "rows": ["D4", "C6", "D7", "E6", "NO_PIN"], - "custom": true, - "direct": [ - [ "A00", "A01", "A02", "A03", "A04", "A05" ], - [ "A10", "A11", "A12", "A13", "A14", "A15" ], - [ "A20", "A21", "A22", "A23", "A24", "A25" ], - [ "A30", "A31", "A32", "A33", "A34", "A35" ], - [ null, null, "A42", null, null, "A45" ], - [ "B00", "B01", "B02", "B03", "B04", "B05" ], - [ "B10", "B11", "B12", "B13", "B14", "B15" ], - [ "B20", "B21", "B22", "B23", "B24", "B25" ], - [ "B30", "B31", "B32", "B33", "B34", "B35" ], - [ null, null, "B42", null, null, "B45" ] - ] - }, "ws2812": { "pin": "B6" }, @@ -59,6 +41,15 @@ "hue_steps": 10, "max_brightness": 120, }, + "keycodes":[ + {"key": "CPI_SW"}, + {"key": "SCRL_SW"}, + {"key": "ROT_R15"}, + {"key": "ROT_L15"}, + {"key": "SCRL_MO"}, + {"key": "SCRL_TO"}, + {"key": "SCRL_IN"} + ], "layouts": { "LAYOUT": { "layout": [ diff --git a/keyboards/aki27/cocot46plus/keymaps/default/keymap.c b/keyboards/aki27/cocot46plus/keymaps/default/keymap.c index 602e6fa8bd7..099a067a94f 100644 --- a/keyboards/aki27/cocot46plus/keymaps/default/keymap.c +++ b/keyboards/aki27/cocot46plus/keymaps/default/keymap.c @@ -25,7 +25,6 @@ enum layer_number { _TRACKBALL }; - #define LW_MHEN LT(1,KC_INT5) // lower #define RS_HENK LT(2,KC_INT4) // raise #define DEL_ALT ALT_T(KC_DEL) diff --git a/keyboards/aki27/cocot46plus/keymaps/default/rules.mk b/keyboards/aki27/cocot46plus/keymaps/default/rules.mk deleted file mode 100644 index 9d2c49d933e..00000000000 --- a/keyboards/aki27/cocot46plus/keymaps/default/rules.mk +++ /dev/null @@ -1 +0,0 @@ -VIA_ENABLE = no diff --git a/keyboards/aki27/cocot46plus/layout-reference.md b/keyboards/aki27/cocot46plus/layout-reference.md deleted file mode 100644 index 8a58540efa4..00000000000 --- a/keyboards/aki27/cocot46plus/layout-reference.md +++ /dev/null @@ -1,29 +0,0 @@ - -This was the original layout definition showing how the physical key locations map -to the matrix grid. - -* A3 and B35 are the trackball keys -* A42, A34, A45 are for the encoder CCW, click and CW bindings - -The last three, B42, B34 and B45 don't seem to used. - -```` -define LAYOUT( \ - A00, A01, A02, A03, A04, A05, B05, B04, B03, B02, B01, B00, \ - A10, A11, A12, A13, A14, A15, B15, B14, B13, B12, B11, B10, \ - A20, A21, A22, A23, A24, A25, B25, B24, B23, B22, B21, B20, \ - A30, A31, A32, A33, A35, B35, B33, B32, B31, B30, \ - A42, A34, A45, B42, B34, B45 \ - ) \ - { \ - { A00, A01, A02, A03, A04, A05 }, \ - { A10, A11, A12, A13, A14, A15 }, \ - { A20, A21, A22, A23, A24, A25 }, \ - { A30, A31, A32, A33, A34, A35 }, \ - { KC_NO, KC_NO, A42, KC_NO, KC_NO, A45 }, \ - { B00, B01, B02, B03, B04, B05 }, \ - { B10, B11, B12, B13, B14, B15 }, \ - { B20, B21, B22, B23, B24, B25 }, \ - { B30, B31, B32, B33, B34, B35 }, \ - { KC_NO, KC_NO, B42, KC_NO, KC_NO, B45 } \ -``` diff --git a/keyboards/aki27/cocot46plus/matrix.c b/keyboards/aki27/cocot46plus/matrix.c index 4abe8797ed8..c5e93d9b76e 100644 --- a/keyboards/aki27/cocot46plus/matrix.c +++ b/keyboards/aki27/cocot46plus/matrix.c @@ -15,24 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "matrix.h" -#include "quantum.h" - -#if (MATRIX_COLS <= 8) -# define print_matrix_header() print("\nr/c 01234567\n") -# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) -# define matrix_bitpop(i) bitpop(matrix[i]) -# define ROW_SHIFTER ((uint8_t)1) -#elif (MATRIX_COLS <= 16) -# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n") -# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row)) -# define matrix_bitpop(i) bitpop16(matrix[i]) -# define ROW_SHIFTER ((uint16_t)1) -#elif (MATRIX_COLS <= 32) -# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n") -# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row)) -# define matrix_bitpop(i) bitpop32(matrix[i]) -# define ROW_SHIFTER ((uint32_t)1) -#endif +#include "wait.h" static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; @@ -103,7 +86,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin - current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); + current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); } // Unselect row @@ -131,12 +114,12 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit - current_matrix[tmp] |= (ROW_SHIFTER << current_col); + current_matrix[tmp] |= (MATRIX_ROW_SHIFTER << current_col); } else { // Pin HI, clear col bit - current_matrix[tmp] &= ~(ROW_SHIFTER << current_col); + current_matrix[tmp] &= ~(MATRIX_ROW_SHIFTER << current_col); } // Determine if the matrix changed state diff --git a/keyboards/aki27/cocot46plus/readme.md b/keyboards/aki27/cocot46plus/readme.md index 60b9e443162..518fcef6b97 100644 --- a/keyboards/aki27/cocot46plus/readme.md +++ b/keyboards/aki27/cocot46plus/readme.md @@ -1,6 +1,6 @@ # cocot46plus -![cocot46plus_photo15](https://user-images.githubusercontent.com/88039287/171889114-53163c9f-4ef2-492d-b12b-7b6a23578bdf.jpg) +![cocot46plus_photo15](https://i.imgur.com/yCvbMgo.jpeg) cocot46plus is a column-staggered keyboard with 46 keys, a 34mm-trackball and a rotary encoder. @@ -39,12 +39,8 @@ Value | Keycode |Description ### Gallery -![cocot46plus_photo12](https://user-images.githubusercontent.com/88039287/170438554-630e1c55-a0de-4021-96c9-22d9bfee850e.jpg) - -![cocot46plus_photo14](https://user-images.githubusercontent.com/88039287/170669470-d258e0f5-6dba-4e6a-8008-43c8c6c1f1b2.jpg) - -![cocot46plus_photo05](https://user-images.githubusercontent.com/88039287/170669586-f97a07f9-cc3e-4ec8-8144-de095594974b.jpg) - -![cocot46plus_photo02](https://user-images.githubusercontent.com/88039287/170669653-933e0ebc-dbf4-4f3d-9d89-2d6171de5415.jpg) - -![cocot46plus_photo10](https://user-images.githubusercontent.com/88039287/170669715-810a73a1-d12f-4cf3-9f66-493bf0615beb.jpg) +![cocot46plus_photo12](https://i.imgur.com/hPOB98H.jpeg) +![cocot46plus_photo14](https://i.imgur.com/HrtI9w1.jpeg) +![cocot46plus_photo05](https://i.imgur.com/LOcxHIV.jpeg) +![cocot46plus_photo02](https://i.imgur.com/b5O9tKq.jpeg) +![cocot46plus_photo10](https://i.imgur.com/gDx5e64.jpeg)