summaryrefslogtreecommitdiff
path: root/keyboards/keychron/c2_pro
diff options
context:
space:
mode:
authorSergey Vlasov <sigprof@gmail.com>2023-08-23 12:13:03 +0300
committerGitHub <noreply@github.com>2023-08-23 10:13:03 +0100
commitb1fbfaaacc61af1efe1b897aeed0dc7389d91708 (patch)
tree7d0ebe6e8730ec9fe7253743ccddbcca8fc82133 /keyboards/keychron/c2_pro
parentc2b837514bd23444dcd08cb5b60d2aa78944b88a (diff)
keychron/c2_pro/ansi/white: Fix column 19 in the custom matrix (#21805)
Although `keychron/c2_pro/ansi/rgb` and `keychron/c2_pro/ansi/white` use the same custom matrix code, the matrix layouts are slightly different; in particular, only the `keychron/c2_pro/ansi/white` board actually uses column 19. However, the handling of column 19 in the custom matrix code was broken, therefore that column did not work. Looks like the custom matrix code assumes that `SHIFT_COL_END` refers to the last column connected to the shift register, and not to the column past that; so the value of `SHIFT_COL_END` needs to be changed from 19 to 18 (columns 11...18 are connected to the shift register, and column 19 is connected to the C14 pin). Also the code which was determining `SIZE_T` and `UNSELECT_ALL_COL` had an off-by-one bug when counting the required number of bits (again due to the confusion on the `SHIFT_COL_END` meaning); this had been fixed too (the actual behavior of that part of the code did not change, because both the old and the new version select the 8 bit variant).
Diffstat (limited to 'keyboards/keychron/c2_pro')
-rw-r--r--keyboards/keychron/c2_pro/config.h2
-rw-r--r--keyboards/keychron/c2_pro/matrix.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/keyboards/keychron/c2_pro/config.h b/keyboards/keychron/c2_pro/config.h
index f107dadf48..6971ebd1aa 100644
--- a/keyboards/keychron/c2_pro/config.h
+++ b/keyboards/keychron/c2_pro/config.h
@@ -41,4 +41,4 @@
#define HC595_SHCP A1
#define HC595_DS C15
#define SHIFT_COL_START 11
-#define SHIFT_COL_END 19
+#define SHIFT_COL_END 18
diff --git a/keyboards/keychron/c2_pro/matrix.c b/keyboards/keychron/c2_pro/matrix.c
index af7514c5ad..5065f97aa7 100644
--- a/keyboards/keychron/c2_pro/matrix.c
+++ b/keyboards/keychron/c2_pro/matrix.c
@@ -24,10 +24,10 @@
#endif
#if defined(SHIFT_COL_START) && defined(SHIFT_COL_END)
-# if ((SHIFT_COL_END - SHIFT_COL_START) > 16)
+# if ((SHIFT_COL_END - SHIFT_COL_START + 1) > 16)
# define SIZE_T uint32_t
# define UNSELECT_ALL_COL 0xFFFFFFFF
-# elif ((SHIFT_COL_END - SHIFT_COL_START) > 8)
+# elif ((SHIFT_COL_END - SHIFT_COL_START + 1) > 8)
# define SIZE_T uint16_t
# define UNSELECT_ALL_COL 0xFFFF
# else