Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
a273a01
Increase key scan delay on AJAZZ AK33 rev1
CalcProgrammer1 Apr 15, 2021
71a53f4
Add sleep led animation options
Apr 18, 2021
e8780d9
Hack to make led animation smooth in suspend mode
Apr 18, 2021
a48f239
[Keychron K8] Add Keychron K8 Gateron RGB v1 ANSI
alex-dinh Apr 19, 2021
1af97cb
[Keychron K6] Enable sleep led animation, media keys and add user layout
Apr 19, 2021
4068006
Disable USB driver restart after remote wakeup
May 1, 2021
6ae5a72
Link chibios-contrib with remote wakeup changes
May 1, 2021
546c391
Link chibios-contrib with 24xB USB improvements
May 1, 2021
adba721
Link chibios-contrib with 24x non-B USB improvements
CalcProgrammer1 May 2, 2021
2b92f7e
[Keychron K4] Enable sleep led animation, media keys
dexter93 May 10, 2021
c909b51
[Keychron K8]: Fix rightmost column functionality (#38)
alex-dinh May 15, 2021
26bc5ec
[Redragon K530] Initial support for Redragon K530 Draconic
CalcProgrammer1 Jun 3, 2021
6c63864
Update ChibiOS-Contrib submodule and delete CT16/32.h files from keyb…
CalcProgrammer1 Jun 5, 2021
673bf5c
[Smart Duck XS61] Add support for Smart Duck XS61
LumaGabriela Jun 4, 2021
4df5818
Add SPCGear GK530
HorrorTroll Apr 22, 2021
ba67164
Add support for SPCGear GK540 and Sharkoon SGK3
HorrorTroll Jun 3, 2021
79744e5
[Smart Duck XS61] Move column disabling into key scan condition for b…
CalcProgrammer1 Jun 5, 2021
43200e0
[Ajazz AK33 Rev2] Condense LED matrix configuration
CalcProgrammer1 May 28, 2021
f62c60e
[Ajazz AK33 Rev1] Condense LED matrix configuration
CalcProgrammer1 May 29, 2021
a47610c
[Redragon K552 Rev2] Condense LED matrix configuration
CalcProgrammer1 May 29, 2021
b18d513
[Redragon K556] Condense LED matrix configuration
CalcProgrammer1 May 29, 2021
60bff8c
[Redragon K552 Rev1] Add new keymaps and LED configs for ANSI, ISO, a…
HorrorTroll Apr 8, 2021
e6c5aaf
[Keychron K4] Condense LED matrix configuration
CalcProgrammer1 Jun 8, 2021
72d277e
[Keychron K6] Condense LED matrix configuration
CalcProgrammer1 Jun 8, 2021
4e2d19f
[Keychron K8] Condense LED matrix configuration
CalcProgrammer1 Jun 8, 2021
9b26226
[Kechron C1] Adding Keychron C1
noldevin Jun 12, 2021
19465c8
[Redragon K582] Add Redragon K582 specific config
Krutonium Jun 14, 2021
6e3db3d
[Redragon K530] Change reset keybind from Fn+Tab to Fn+RCtrl
CalcProgrammer1 Jun 14, 2021
c7c6553
[Keychron C1, Keychron K8] Add missing Keychron keyboards to build_al…
CalcProgrammer1 Jun 15, 2021
6564660
[Womier K87] Add Womier K87
Jun 13, 2021
2af1cf7
[Womier K87] Condense LED matrix configuration
CalcProgrammer1 Jun 18, 2021
509bf12
[Womier K87] Clean up LED and Key maps
CalcProgrammer1 Jun 18, 2021
ebb42ab
[Womier K87] Capitalize K87 in product/description
CalcProgrammer1 Jun 18, 2021
01b2872
[Keychron K2] Adding Keychron K2v2 RGB
dexter93 Jul 1, 2021
7f74de1
[Keychron K2] Add keyboard to build_all.py
dexter93 Jul 1, 2021
bfb7008
[Keychron K2] fix compilation
dexter93 Jul 1, 2021
4323f12
[Keychron C1] Update c1.h (#47)
noldevin Jul 1, 2021
ffbf535
[Redragon K580] Adding Redragon K580 (resolves #33) (#39)
tkon99 Jul 1, 2021
0f8a1c9
[Flashquark Horizon Z] Add Flashquark Horizon Z
CalcProgrammer1 Jul 21, 2021
9145d65
[Flashquark Horizon Z] Enable auto build
CalcProgrammer1 Jul 21, 2021
0e9f252
[Redragon K556] Remove row lookup array
CalcProgrammer1 Jul 25, 2021
b966894
[Redragon K556] Clean up LED positions and add additional RGB control…
CalcProgrammer1 Jul 25, 2021
4013eb7
[Redragon K552 Rev2] Clean up LED positions and add additional RGB co…
CalcProgrammer1 Jul 26, 2021
5ea0f6f
[Redragon K556] Make matrix.c generic
CalcProgrammer1 Jul 26, 2021
6a71b89
[Redragon K556, K552 Rev2, K580, K582] Move matrix.c out of keyboard-…
CalcProgrammer1 Jul 26, 2021
04dfcc6
[Redragon K530] Use common matrix code, add definition for reading ro…
CalcProgrammer1 Jul 26, 2021
37e704d
[Flashquark Horizon Z] Use common matrix code, switch ESC/GRV, add 5m…
CalcProgrammer1 Jul 26, 2021
6c9087a
[AJAZZ AK33 Rev2] Use common matrix code
CalcProgrammer1 Jul 26, 2021
b2230fb
[Redragon K556] Add ISO layout keys to default keymap
CalcProgrammer1 Jul 27, 2021
48e3e86
[Keychron K6] Cumulative changes (matrix and layouts)
Aug 1, 2021
2833859
[Keychron C1, K2, K4, K8] Use common matrix code
Aug 1, 2021
1e6adeb
[Keychron C1] Disable VIA, update keymap and readme.md
vjdato21 Jul 19, 2021
56df967
[Keychron] sn32f240b: move board files in chibios-contrib (#72)
dexter93 Aug 4, 2021
792892f
[ajazz, flashquark, redragon, smartduck, womier] sn32f240b: move boar…
dexter93 Aug 4, 2021
31179ac
[smartduck xs61] fix linting (#74)
dexter93 Aug 4, 2021
87f779d
Process PWM B outputs in SN32F248B matrix pin initialization
CalcProgrammer1 Aug 7, 2021
ae24778
[Flashquark Horizon Z] Corrected LED matrix, Added question mark to d…
flashquark Jul 26, 2021
ec2ca99
Updated keymap for these two keeb
HorrorTroll Jul 28, 2021
088e9d7
[Keychron K3] Add Keychron K3 RGB
smplman Mar 27, 2021
0677f84
sn32f240b: common RGB matrix integration in QMK
dexter93 Aug 1, 2021
49bc365
[Keychron K*] Use the unified sn32 RGB matrix driver
dexter93 Aug 1, 2021
aadd733
[Redragon k530,k552,k556,k582] Use the unified sn32 RGB matrix driver
dexter93 Aug 1, 2021
ce1f3ae
[AJAZZ AK33 Rev2] Use common SN32F248B LED matrix code
CalcProgrammer1 Aug 7, 2021
1497fb5
[Keychron K2,C1] Enable LED Status indicators
dexter93 Aug 7, 2021
cfedee5
[Keychron K6 ansi] Enable LED Status indicators
dexter93 Aug 7, 2021
1317c92
[Keychron K6 ansi] Keyboard Description update
dexter93 Aug 7, 2021
2124555
[Keychron K6] Use driver defaults for RGB control
dexter93 Aug 7, 2021
29fab79
[Keychron C1] Update keyboard naming scheme
dexter93 Aug 8, 2021
8064057
[Friendly Foes Foundry FFC61] Add Friendly Foes Foundry FFC61
ejiije Jun 14, 2021
f4aa8fa
[SN32F248B Keyboards] Remove SN32_MATRIX_READ_ROWS/COLS defines, use …
CalcProgrammer1 Aug 10, 2021
600e6ca
Sharkoon SGK3 - Added ABNT2 keymap
RyanKF Aug 19, 2021
4e44017
[Redragon K530] Add Magic FN feature from stock FW
yellowberryHN Aug 18, 2021
697eca0
[Keychron K6] User profile update
Aug 17, 2021
b368c4a
Update ChibiOS-contrib
CalcProgrammer1 Sep 4, 2021
7148084
[Glorious GMMK Full (2021)] Initial support for Glorious GMMK Full (2…
gloryhzw Aug 31, 2021
96c9d87
[Glorious GMMK Full (2021)] Move SN32F260 board files to common locat…
CalcProgrammer1 Sep 5, 2021
470c8e1
[Glorious GMMK Full (2021)] Fix animation speed
CalcProgrammer1 Sep 8, 2021
b455a0f
Keychron K8 - Added ISO UK config, keymap and RGB support. (#82)
morph27 Sep 11, 2021
0254429
Add support for Marvo KG938 (#55)
Pescu123 Sep 11, 2021
ee0a94a
Enable NKRO for K556 (#36)
Krutonium Sep 11, 2021
a95072e
[Redragon K552 Rev2] Add missing key in ABNT2 (Brazilian) layout to d…
CalcProgrammer1 Sep 12, 2021
d90384a
[Keychron K6] Add support for Keychron K6 White LED (#91)
marcellp Sep 12, 2021
5f79c64
[Keychron K6] Combine RGB and White backlit under the same keyboard
Sep 12, 2021
c5126ce
[Keychron K6] Remove unnecessary files
Sep 12, 2021
632c16e
[Redragon K552 Rev2] Update LED map to account for added ABNT2 key
CalcProgrammer1 Sep 15, 2021
3f70cad
[Keychron C1] Bulk update (#94)
vjdato21 Sep 18, 2021
c8d3f31
Update ChibiOS-Contrib
CalcProgrammer1 Sep 18, 2021
73b354d
Make RAW_IN/OUT_CAPACITY configurable in chconf.h, set them to 1 for …
CalcProgrammer1 Sep 18, 2021
bfb8750
[Redragon K630] Add Redragon K630 support
robertosale Sep 8, 2021
889f11c
[Keychron K4] Revamp time. Welcome v2 (#107)
dexter93 Sep 28, 2021
7583e45
[Keychron C1] Cleanup keymaps
dexter93 Sep 27, 2021
3f94c63
[K3v2] Bringup (#106)
mjaroszek Sep 28, 2021
0824fdc
[Glorious GMMK Full] Add GMMK Full rev2 support and move keyboard folder
gloryhzw Sep 30, 2021
90962a1
[Glorious GMMK Full Rev2] Remove I2C delay
CalcProgrammer1 Sep 30, 2021
471b4f2
[Glorious GMMK Full Rev2] Track selected frame, only send update when…
CalcProgrammer1 Sep 30, 2021
ae80fff
Pull up chibios-contrib
CalcProgrammer1 Sep 30, 2021
3d55abc
Pull up chibios-contrib
dexter93 Oct 2, 2021
0f61fb6
Pull up chibios-contrib
dexter93 Oct 2, 2021
9c58da8
[Glorious GMMK Full] Add ISO keymap (#116)
gloryhzw Oct 3, 2021
44bbb30
Remove OpenRGB references
CalcProgrammer1 Oct 3, 2021
df25423
[Glorious GMMK Full] Remove more stuff that is only relevant to OpenR…
CalcProgrammer1 Oct 3, 2021
95168fa
Pull up chibios-contrib
CalcProgrammer1 Oct 3, 2021
9eb6f09
[Keychron C1] Minor keymap cleaning (#113)
simgunz Oct 7, 2021
bf1d64b
gmmk: fix wrong mcu clk setting in mcuconf.h (#118)
gloryhzw Oct 7, 2021
5437649
Pull up chibios-contrib
dexter93 Oct 7, 2021
a2b3600
[Keychron K2,K3,K4] Reboot to bootloader on Fn + Esc
dexter93 Oct 10, 2021
1d3688a
Use restart_usb_driver redefined in board chibios board file (#123)
stdvar Oct 12, 2021
a738964
Pull up chibios-contrib
dexter93 Oct 12, 2021
ee40040
[Keychron, Redragon] Go full speed 48Mhz
dexter93 Oct 12, 2021
ed492c9
shared matrix: adapt prescasler based on clock speed
dexter93 Oct 12, 2021
74f8fb6
[Keychron K4] Move RGB to make space for White
dexter93 Oct 12, 2021
cfc1f2b
Pull up chibios-contrib
dexter93 Oct 17, 2021
c9a8957
[Keychron K4v1] indicate caps lock (#130)
dexter93 Oct 19, 2021
615d043
[Keychron C1 RGB] Move to rgb subfolder (#122)
IsaacDynamo Oct 19, 2021
7d2f0b8
gmmk: support MCU 48MHz for rev2 (#121)
gloryhzw Oct 19, 2021
dbcd254
Pull up chibios-contrib
dexter93 Oct 19, 2021
5eca47e
shared matrix: update preloader values (#138)
dexter93 Oct 24, 2021
ec5f380
Revert "[Keychron, Redragon] Go full speed 48Mhz"
dexter93 Oct 29, 2021
c7768d2
[sn32] eeprom emulation (#95)
dexter93 Oct 29, 2021
6ed0541
sn32: family definition updates (#151)
dexter93 Nov 17, 2021
ad9e3ea
Pull up ChibiOS-Contrib
dexter93 Nov 17, 2021
566c7d8
gmmk: support VIA (#147)
gloryhzw Nov 21, 2021
bd8d40f
Fix PR122 (#154)
IsaacDynamo Nov 21, 2021
8135cf0
sleep led: sn32: don't override mode stored in eeprom
dexter93 Nov 17, 2021
8f4279e
New Unified Key and RGB Matrix
dexter93 Nov 15, 2021
eca9c6a
shared matrix: export less functions
dexter93 Nov 16, 2021
79ff7cd
rgb: fix logic. We use PNP transistors on cols
dexter93 Nov 21, 2021
683a1be
fix pin gpio
dexter93 Nov 21, 2021
4a5a4b1
shared matrix: support optical switches
dexter93 Nov 21, 2021
8b5943c
shared matrix: run at 48Mhz
dexter93 Nov 21, 2021
05e57f2
pwm: slow down for smoothness
dexter93 Nov 21, 2021
96e8d10
Pull up Chibios-Contrib
dexter93 Nov 21, 2021
0b066d1
[Keychron K6 rgb/ansi] Gets os toggle switch to work (#156)
blacklizard Nov 28, 2021
daceccc
[Keychron K6 rgb/stdvar] Gets os toggle switch to work and update keymap
Nov 28, 2021
6c759e5
Revert "Sharkoon SGK3 - Added ABNT2 keymap"
Nov 29, 2021
2c4a3e0
[Sharkoon SGK3] Fix broken iso keymap defs
Nov 29, 2021
9b34b3a
[Redragon K580] Fix broken build in tkon99 user profile
Nov 29, 2021
2e7c850
[Keychron K8] Remove incomplete, nonexisting and broken via keymap
Nov 29, 2021
c4ccc54
Make compile firmware action fail when kb build fails (#160)
jath03 Nov 29, 2021
4ec8389
Add sha and ref name to CI artifacts
jath03 Dec 1, 2021
923b4ee
Removing "/" so that upload doesn't fail
jath03 Dec 1, 2021
10ec0cc
[Keychron C1 White] Bringup (#135)
IsaacDynamo Dec 2, 2021
2a0effd
[Keychron C1 RGB] Bulk Update (#148)
vjdato21 Dec 2, 2021
c48631c
Corrected K530 documentation. (#120)
Johns-Q Dec 2, 2021
cefac8e
[Keychron K6 RGB] Add VIA support
Dec 5, 2021
3711823
[Keychron K8 RGB] Update keychron k8 keymaps, and add via json file f…
tbowmo Dec 5, 2021
38e39f2
[Keychorn K7 Optical] Initial bringup (#125)
stdvar Dec 7, 2021
b65d67a
Add fix for F row not working (for bigger boards) and fix bug with re…
Dec 7, 2021
1ec26ce
Add fix for F row not working on row2col shared matrix scan
Dec 7, 2021
b709d77
shared matrix: add delays by default
dexter93 Dec 9, 2021
664da21
Pull up Chibios-Contrib
dexter93 Dec 9, 2021
2c86dad
shared matrix: satisfy the compiler
dexter93 Dec 9, 2021
7e4743d
[Keychron K8 RGB] Add Keychron K8 RGB Optical support (#170)
edlf Dec 9, 2021
72de00f
Fix nightly.link download links (#165)
jath03 Dec 9, 2021
7dc6564
[Keychron C2 White] Add Keychron C2 White support (#166)
edlf Dec 9, 2021
beec566
[Keychron C1 Plain] Add Keychron C1 Plain support (#161)
edlf Dec 9, 2021
c4a8c7b
fix c1 plain CI build
dexter93 Dec 18, 2021
899473a
Pull up Chibios-Contrib
dexter93 Dec 18, 2021
724cb28
Moved matrix driver for SN32F26x to drivers/sn32. Moved SN32F260_defi…
IsaacDynamo Dec 10, 2021
96c7ff5
Added support for Akko 3061 World Tour Tokyo R2 (#140)
HorrorTroll Dec 20, 2021
d491812
gmmk: support TKL (#158)
gloryhzw Dec 20, 2021
03c781d
Keychron K14 bring up (#173)
Jpe230 Dec 21, 2021
c9f3b83
sn32 keyboards: minimize shared declarations
dexter93 Jan 2, 2022
36ca329
sn32: shared matrix: switch to continuous pwm (#171)
dexter93 Jan 2, 2022
e9b934f
Keychron K*: restructure (#184)
dexter93 Jan 3, 2022
1d95fdf
keychron k4: fix json + add numlock indicator in v1
dexter93 Jan 3, 2022
61ff878
gmmk: support compact size rev2 and rev3 (#175)
gloryhzw Jan 4, 2022
241ea17
TEMP: HACK: Fixed issue that cause Keychron C1 White github Action bu…
IsaacDynamo Jan 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 13 additions & 0 deletions .github/workflows/auto-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,21 @@ jobs:
run: pip3 install -r requirements.txt
- name: Build keyboards
run: python3 bin/build_all.py
- name: Declare some variables
id: vars
shell: bash
run: |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF_NAME//\//-})"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"

- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: Pre-Compiled Firmware (${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }})
path: '*.bin'

- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: Pre-Compiled Firmware
path: '*.bin'
69 changes: 67 additions & 2 deletions bin/build_all.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,72 @@
import subprocess
import os
import sys

BOARDS = ['redragon/k552/rev1', 'redragon/k552/rev2', 'redragon/k556', 'keychron/k4', 'keychron/k6', 'ajazz/ak33/rev1', 'ajazz/ak33/rev2']
BOARDS = [
'redragon/k552/rev1',
'redragon/k552/rev2',
'redragon/k530',
'redragon/k556',
'redragon/k580',
'redragon/k630',
'keychron/c1/plain',
'keychron/c1/rgb',
'keychron/c1/white',
'keychron/c2/white',
'keychron/k2/rgb',
'keychron/k2/rgb/via',
'keychron/k2/rgb/optical',
'keychron/k2/rgb/optical_via',
'keychron/k3/rgb',
'keychron/k3/rgb/via',
'keychron/k3/rgb/optical',
'keychron/k3/rgb/optical_via',
'keychron/k4/rgb/v1',
'keychron/k4/rgb/v1/via',
'keychron/k4/rgb/v1/optical',
'keychron/k4/rgb/v1/optical_via',
'keychron/k4/rgb/v2',
'keychron/k4/rgb/v2/via',
'keychron/k4/rgb/v2/optical',
'keychron/k4/rgb/v2/optical_via',
'keychron/k6/rgb',
'keychron/k6/rgb/via',
'keychron/k6/rgb/optical',
'keychron/k6/rgb/optical_via',
'keychron/k6/white',
'keychron/k7/rgb',
'keychron/k7/rgb/via',
'keychron/k7/rgb/optical',
'keychron/k7/rgb/optical_via',
'keychron/k8/rgb',
'keychron/k8/rgb/via',
'keychron/k8/rgb/optical',
'keychron/k8/rgb/optical_via',
'keychron/k14/rgb',
'keychron/k14/rgb/via',
'keychron/k14/rgb/optical',
'keychron/k14/rgb/optical_via',
'ajazz/ak33/rev1',
'ajazz/ak33/rev2',
'smartduck/xs61',
'spcgear/gk530',
'spcgear/gk540',
'sharkoon/sgk3',
'womier/k87',
'flashquark/horizon_z',
'ffc/ffc61',
'gmmk/full/rev2',
'gmmk/full/rev3',
'gmmk/tkl/rev2',
'gmmk/tkl/rev3',
'gmmk/compact/rev2',
'gmmk/compact/rev3',
'marvo/kg938',
'akko/3061_rgb']

error = False
for kb in BOARDS:
subprocess.run(f"bin/qmk compile -kb {kb} -km all -j{os.cpu_count()}", shell=True)
if subprocess.run(f"qmk compile -kb {kb} -km all -j{os.cpu_count()}", shell=True).returncode != 0:
error = True
if error:
sys.exit(1)
29 changes: 22 additions & 7 deletions common_features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,14 @@ else
SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c
OPT_DEFS += -DEEPROM_EMU_STM32F072xB
OPT_DEFS += -DSTM32_EEPROM_ENABLE
# else ifeq ($(MCU_SERIES)_$(MCU_LDSCRIPT), SN32F240_SN32F240B)
# SRC += $(PLATFORM_COMMON_DIR)/eeprom_sn32.c
# SRC += $(PLATFORM_COMMON_DIR)/flash_sn32.c
# OPT_DEFS += -DEEPROM_EMU_SN32F240B
# OPT_DEFS += -DSN32_EEPROM_ENABLE
else ifeq ($(MCU_SERIES)_$(MCU_LDSCRIPT), SN32F240B_SN32F240B)
SRC += $(PLATFORM_COMMON_DIR)/eeprom_sn32.c
OPT_DEFS += -DEEPROM_EMU_SN32F240B
OPT_DEFS += -DSN32_EEPROM_ENABLE
else ifeq ($(MCU_SERIES)_$(MCU_LDSCRIPT), SN32F260_SN32F260)
SRC += $(PLATFORM_COMMON_DIR)/eeprom_sn32.c
OPT_DEFS += -DEEPROM_EMU_SN32F260
OPT_DEFS += -DSN32_EEPROM_ENABLE
else ifeq ($(MCU_SERIES)_$(MCU_LDSCRIPT), STM32F0xx_STM32F042x6)

# Stack sizes: Since this chip has limited RAM capacity, the stack area needs to be reduced.
Expand Down Expand Up @@ -205,7 +208,7 @@ ifeq ($(strip $(LED_MATRIX_ENABLE)), yes)
endif

RGB_MATRIX_ENABLE ?= no
VALID_RGB_MATRIX_TYPES := IS31FL3731 IS31FL3733 IS31FL3737 IS31FL3741 WS2812 custom
VALID_RGB_MATRIX_TYPES := IS31FL3731 IS31FL3733 IS31FL3737 IS31FL3741 WS2812 SN32F248B SN32F26x custom

ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
ifeq ($(filter $(RGB_MATRIX_DRIVER),$(VALID_RGB_MATRIX_TYPES)),)
Expand All @@ -218,7 +221,9 @@ ifneq (,$(filter $(MCU), atmega16u2 atmega32u2))
endif
SRC += $(QUANTUM_DIR)/color.c
SRC += $(QUANTUM_DIR)/rgb_matrix.c
SRC += $(QUANTUM_DIR)/rgb_matrix_drivers.c
ifneq ($(strip $(RGB_MATRIX_DRIVER)), SN32F248B)
SRC += $(QUANTUM_DIR)/rgb_matrix_drivers.c
endif
CIE1931_CURVE := yes
RGB_KEYCODES_ENABLE := yes

Expand Down Expand Up @@ -255,6 +260,16 @@ endif
WS2812_DRIVER_REQUIRED := yes
endif

ifeq ($(strip $(RGB_MATRIX_DRIVER)), SN32F248B)
COMMON_VPATH += $(DRIVER_PATH)/sn32
SRC += rgb_matrix_sn32f248b.c
endif

ifeq ($(strip $(RGB_MATRIX_DRIVER)), SN32F26x)
COMMON_VPATH += $(DRIVER_PATH)/sn32
SRC += matrix_sn32f26x.c
endif

ifeq ($(strip $(RGB_MATRIX_CUSTOM_KB)), yes)
OPT_DEFS += -DRGB_MATRIX_CUSTOM_KB
endif
Expand Down
196 changes: 196 additions & 0 deletions drivers/sn32/matrix_sn32f24xx.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
/*
Copyright 2021 Dimitris Mantzouranis <[email protected]>
Copyright 2021 Adam Honse <[email protected]>
Copyright 2011 Jun Wako <[email protected]>

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 <http://www.gnu.org/licenses/>.

Ported to QMK by Stephen Peery <https://github.com/smp4488/>
*/

#include <stdint.h>
#include <stdbool.h>
#include "ch.h"
#include "hal.h"

#include "wait.h"
#include "util.h"
#include "matrix.h"
#include "debounce.h"
#include "quantum.h"
#include "rgb_matrix_sn32f24xx.h"

#if defined(OPTICAL_MATRIX)
#ifndef PRESSED_KEY_PIN_STATE
# define PRESSED_KEY_PIN_STATE 1
#endif
#ifndef MATRIX_KEY_SAMPLE_DELAY
# define MATRIX_KEY_SAMPLE_DELAY 2000
#endif
#endif

#ifndef PRESSED_KEY_PIN_STATE
# define PRESSED_KEY_PIN_STATE 0
#endif

#ifndef MATRIX_KEY_SAMPLE_DELAY
# define MATRIX_KEY_SAMPLE_DELAY 100
#endif

#if defined(MATRIX_KEY_SAMPLE_DELAY)
void sample_delay(void){
//should give 2000/48000000Mhz = 42us delay
//we want 42 micro thus to get value
for (int i = 0; i < MATRIX_KEY_SAMPLE_DELAY; ++i) {
__asm__ volatile("" ::: "memory");
}
//wait_us(73); //does not work
}
#endif

static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
matrix_row_t raw_matrix[MATRIX_ROWS]; //raw values
matrix_row_t last_matrix[MATRIX_ROWS] = {0}; // raw values
matrix_row_t matrix[MATRIX_ROWS]; //debounced values

static bool matrix_changed = false;

__attribute__((weak)) void matrix_init_kb(void) { matrix_init_user(); }

__attribute__((weak)) void matrix_scan_kb(void) { matrix_scan_user(); }

__attribute__((weak)) void matrix_init_user(void) {}

__attribute__((weak)) void matrix_scan_user(void) {}

inline matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; }

void matrix_print(void) {}

static void init_pins(void) {
#if(DIODE_DIRECTION == ROW2COL)
// Unselect ROWs
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
setPinInputHigh(row_pins[x]);
}
#elif(DIODE_DIRECTION == COL2ROW)
// Unselect COLs
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
setPinInputHigh(col_pins[x]);
}
#else
#error DIODE_DIRECTION must be one of COL2ROW or ROW2COL!
#endif
}

void matrix_scan_select(uint8_t current){
#if(DIODE_DIRECTION == ROW2COL)
// Select COL
setPinOutput(col_pins[current]);
writePinLow(col_pins[current]);
#elif(DIODE_DIRECTION == COL2ROW)
// Select ROW
setPinOutput(row_pins[current]);
writePinLow(row_pins[current]);
#endif
}

void matrix_scan_unselect(uint8_t current) {
#if(DIODE_DIRECTION == ROW2COL)
// Select COL
setPinInputHigh(col_pins[current]);
#elif(DIODE_DIRECTION == COL2ROW)
// Select ROW
setPinInputHigh(row_pins[current]);
#endif
}

void matrix_init(void) {
// initialize key pins
init_pins();

// initialize matrix state: all keys off
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
raw_matrix[i] = 0;
matrix[i] = 0;
}

debounce_init(MATRIX_ROWS);

matrix_init_quantum();
}

uint8_t matrix_scan(void) {
matrix_changed = false;
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) {
// Determine if the matrix changed state
if ((last_matrix[row_index] != raw_matrix[row_index])) {
matrix_changed = true;
last_matrix[row_index] = raw_matrix[row_index];
}
}
}

debounce(raw_matrix, matrix, MATRIX_ROWS, matrix_changed);

matrix_scan_quantum();

return matrix_changed;
}

void matrix_scan_keys(matrix_row_t raw_matrix[], uint8_t current){
#if(DIODE_DIRECTION == ROW2COL)
// Read the key matrix rows on col
uint8_t col_index = current;
// Enable the column
matrix_scan_select(col_index);
sample_delay();
for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) {
// Check row pin state
if (readPin(row_pins[row_index]) == PRESSED_KEY_PIN_STATE) {
// Pin LO, set col bit
raw_matrix[row_index] |= (MATRIX_ROW_SHIFTER << col_index);
} else {
// Pin HI, clear col bit
raw_matrix[row_index] &= ~(MATRIX_ROW_SHIFTER << col_index);
}
}
// Disable the column
matrix_scan_unselect(col_index);
//see https://github.com/SonixQMK/qmk_firmware/issues/157
sample_delay();
#elif(DIODE_DIRECTION == COL2ROW)
// Read the key matrix cols on row
uint8_t row_index = current;
// Enable the row
matrix_scan_select(row_index);
sample_delay();
for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
// Check row pin state
if (readPin(col_pins[col_index]) == PRESSED_KEY_PIN_STATE) {
// Pin LO, set col bit
raw_matrix[row_index] |= (MATRIX_ROW_SHIFTER << col_index);
} else {
// Pin HI, clear col bit
raw_matrix[row_index] &= ~(MATRIX_ROW_SHIFTER << col_index);
}
}
// Disable the row
matrix_scan_unselect(row_index);
//see https://github.com/SonixQMK/qmk_firmware/issues/157
sample_delay();
#endif
}
Loading