Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sn32: welcome 240C, 290 #436

Draft
wants to merge 9 commits into
base: sn32_develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions data/schemas/keyboard.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@
"RP2040",
"SN32F248F",
"SN32F248BF",
"SN32F248CF",
"SN32F268F",
"SN32F299F",
"STM32F042",
"STM32F072",
"STM32F103",
Expand Down
24 changes: 24 additions & 0 deletions keyboards/handwired/onekey/sn32f240c/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Copyright 2024 Dimitris Mantzouranis <[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/>.
*/

#pragma once
/*
#define I2C_DRIVER I2CD0
#define I2C1_SCL_PIN A6
#define I2C1_SDA_PIN A7
#define I2C1_OPMODE OPMODE_I2C
#define I2C1_CLOCK_SPEED 400000
*/
9 changes: 9 additions & 0 deletions keyboards/handwired/onekey/sn32f240c/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"keyboard_name": "Onekey SN32F240C",
"processor": "SN32F248CF",
"bootloader": "sn32-dfu",
"matrix_pins": {
"cols": ["A8"],
"rows": ["D11"]
}
}
19 changes: 19 additions & 0 deletions keyboards/handwired/onekey/sn32f240c/mcuconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* Copyright 2024 Dimitris Mantzouranis <[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/>.
*/
#pragma once

//#define SN32_I2C_USE_I2C0 TRUE
#include_next <mcuconf.h>
5 changes: 5 additions & 0 deletions keyboards/handwired/onekey/sn32f240c/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SN32F240C onekey

Supported Hardware: *SN32F240C*.

To trigger keypress, short together pins *A8* and *D11*.
24 changes: 24 additions & 0 deletions keyboards/handwired/onekey/sn32f290/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Copyright 2024 Dimitris Mantzouranis <[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/>.
*/

#pragma once
/*
#define I2C_DRIVER I2CD0
#define I2C1_SCL_PIN A6
#define I2C1_SDA_PIN A7
#define I2C1_OPMODE OPMODE_I2C
#define I2C1_CLOCK_SPEED 400000
*/
9 changes: 9 additions & 0 deletions keyboards/handwired/onekey/sn32f290/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"keyboard_name": "Onekey SN32F290",
"processor": "SN32F299F",
"bootloader": "sn32-dfu",
"matrix_pins": {
"cols": ["A8"],
"rows": ["D11"]
}
}
19 changes: 19 additions & 0 deletions keyboards/handwired/onekey/sn32f290/mcuconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* Copyright 2024 Dimitris Mantzouranis <[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/>.
*/
#pragma once

//#define SN32_I2C_USE_I2C0 TRUE
#include_next <mcuconf.h>
5 changes: 5 additions & 0 deletions keyboards/handwired/onekey/sn32f290/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SN32F290 onekey

Supported Hardware: *SN32F290*.

To trigger keypress, short together pins *A8* and *D11*.
8 changes: 6 additions & 2 deletions lib/python/qmk/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
MAX_KEYBOARD_SUBFOLDERS = 5

# Supported processor types
CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK64FX512', 'MK66FX1M0', 'RP2040', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F405', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32H723', 'STM32H733', 'STM32L412', 'STM32L422', 'STM32L432', 'STM32L433', 'STM32L442', 'STM32L443', 'GD32VF103', 'WB32F3G71', 'WB32FQ95', 'SN32F248F', 'SN32F248BF', 'SN32F268F'
CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK64FX512', 'MK66FX1M0', 'RP2040', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F405', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32H723', 'STM32H733', 'STM32L412', 'STM32L422', 'STM32L432', 'STM32L433', 'STM32L442', 'STM32L443', 'GD32VF103', 'WB32F3G71', 'WB32FQ95', 'SN32F248F', 'SN32F248BF', 'SN32F248CF', 'SN32F268F', 'SN32F299F'
LUFA_PROCESSORS = 'at90usb162', 'atmega16u2', 'atmega32u2', 'atmega16u4', 'atmega32u4', 'at90usb646', 'at90usb647', 'at90usb1286', 'at90usb1287', None
VUSB_PROCESSORS = 'atmega32a', 'atmega328p', 'atmega328', 'attiny85'

Expand Down Expand Up @@ -57,7 +57,9 @@
"WB32FQ95": "wb32-dfu",
"SN32F248F": "sn32-dfu",
"SN32F248BF": "sn32-dfu",
"SN32F248CF": "sn32-dfu",
"SN32F268F": "sn32-dfu",
"SN32F299F": "sn32-dfu",
"atmega16u2": "atmel-dfu",
"atmega32u2": "atmel-dfu",
"atmega16u4": "atmel-dfu",
Expand Down Expand Up @@ -127,7 +129,9 @@
'sn32-dfu': {
("0c45", "7010"), # SN32F260
("0c45", "7040"), # SN32F240B
("0c45", "7900") # SN32F240
("0c45", "7160"), # SN32F240C
("0c45", "7900"), # SN32F240
("0c45", "7140") # SN32F290
}
}

Expand Down
16 changes: 16 additions & 0 deletions platforms/chibios/boards/SN_SN32F240C/board/board.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# List of all the board related files.
BOARDSRC = $(CHIBIOS_CONTRIB)/os/hal/boards/SN_SN32F240C/board.c

# Required include directories
BOARDINC = $(CHIBIOS_CONTRIB)/os/hal/boards/SN_SN32F240C

# Optimize for speed
OPT = 2
# Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
# Shave some extra bytes
OPT_DEFS += -DCRT1_AREAS_NUMBER=1

# Shared variables
ALLCSRC += $(BOARDSRC)
ALLINC += $(BOARDINC)
38 changes: 38 additions & 0 deletions platforms/chibios/boards/SN_SN32F240C/configs/chconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* Copyright 2020 QMK
*
* 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/>.
*/

/*
* This file was auto-generated by:
* `qmk chibios-confmigrate -i platforms/chibios/boards/SN_SN32F240C/configs/chconf.h -r platforms/chibios/boards/common/configs/chconf.h`
*/

#pragma once

#define CH_CFG_ST_RESOLUTION 16

#define CH_CFG_ST_FREQUENCY 187500

#include_next <chconf.h>

#undef CH_CFG_IDLE_ENTER_HOOK
#define CH_CFG_IDLE_ENTER_HOOK() { \
SN_PMU->CTRL = 4; \
}

#undef CH_CFG_IDLE_LEAVE_HOOK
#define CH_CFG_IDLE_LEAVE_HOOK() { \
SN_PMU->CTRL = 0; \
}
24 changes: 24 additions & 0 deletions platforms/chibios/boards/SN_SN32F240C/configs/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Copyright 2024 Dimitris Mantzouranis <[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/>.
*/
#pragma once

#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
#endif

#ifndef WEAR_LEVELING_EFL_OMIT_LAST_SECTOR_COUNT
# define WEAR_LEVELING_EFL_OMIT_LAST_SECTOR_COUNT 1
#endif
16 changes: 16 additions & 0 deletions platforms/chibios/boards/SN_SN32F290/board/board.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# List of all the board related files.
BOARDSRC = $(CHIBIOS_CONTRIB)/os/hal/boards/SN_SN32F290/board.c

# Required include directories
BOARDINC = $(CHIBIOS_CONTRIB)/os/hal/boards/SN_SN32F290

# Optimize for speed
OPT = 2
# Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
# Shave some extra bytes
OPT_DEFS += -DCRT1_AREAS_NUMBER=1

# Shared variables
ALLCSRC += $(BOARDSRC)
ALLINC += $(BOARDINC)
38 changes: 38 additions & 0 deletions platforms/chibios/boards/SN_SN32F290/configs/chconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* Copyright 2024 Dimitris Mantzouranis <[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/>.
*/

/*
* This file was auto-generated by:
* `qmk chibios-confmigrate -i platforms/chibios/boards/SN_SN32F240B/configs/chconf.h -r platforms/chibios/boards/common/configs/chconf.h`
*/

#pragma once

#define CH_CFG_ST_RESOLUTION 16

#define CH_CFG_ST_FREQUENCY 187500

#include_next <chconf.h>

#undef CH_CFG_IDLE_ENTER_HOOK
#define CH_CFG_IDLE_ENTER_HOOK() { \
SN_PMU->CTRL = 4; \
}

#undef CH_CFG_IDLE_LEAVE_HOOK
#define CH_CFG_IDLE_LEAVE_HOOK() { \
SN_PMU->CTRL = 0; \
}
24 changes: 24 additions & 0 deletions platforms/chibios/boards/SN_SN32F290/configs/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Copyright 2024 Dimitris Mantzouranis <[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/>.
*/
#pragma once

#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
#endif

#ifndef WEAR_LEVELING_EFL_OMIT_LAST_SECTOR_COUNT
# define WEAR_LEVELING_EFL_OMIT_LAST_SECTOR_COUNT 1
#endif
6 changes: 6 additions & 0 deletions platforms/chibios/bootloader.mk
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,15 @@ ifeq ($(strip $(BOOTLOADER)), sn32-dfu)
ifeq ($(strip $(MCU_SERIES)), SN32F240B)
DFU_ARGS ?= -v 0c45/7040
endif
ifeq ($(strip $(MCU_SERIES)), SN32F240C)
DFU_ARGS ?= -v 0c45/7160
endif
ifeq ($(strip $(MCU_SERIES)), SN32F260)
DFU_ARGS ?= -v 0c45/7010 -o 0x200
endif
ifeq ($(strip $(MCU_SERIES)), SN32F290)
DFU_ARGS ?= -v 0c45/7140
endif

endif

Expand Down
Loading
Loading