Skip to content

Commit

Permalink
rf (bk3632) support (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlossless authored Dec 20, 2024
1 parent caeaf7d commit 8640b28
Show file tree
Hide file tree
Showing 29 changed files with 716 additions and 106 deletions.
29 changes: 15 additions & 14 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
---
BasedOnStyle: Google
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: 'true'
AlignConsecutiveDeclarations: 'true'
AlignConsecutiveMacros: 'true'
AlignOperands: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'false'
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignOperands: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortLoopsOnASingleLine: 'false'
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'false'
BinPackArguments: 'true'
BinPackParameters: 'true'
AlwaysBreakBeforeMultilineStrings: false
BinPackArguments: true
BinPackParameters: true
BreakBeforeBraces: 'Linux'
ColumnLimit: '1000'
IndentCaseLabels: 'true'
IndentCaseLabels: true
IndentPPDirectives: AfterHash
IndentWidth: '4'
MaxEmptyLinesToKeep: '1'
PointerAlignment: Right
SortIncludes: 'false'
SpaceBeforeAssignmentOperators: 'true'
SortIncludes: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: 'false'
SpaceInEmptyParentheses: false
AllowShortEnumsOnASingleLine: false
SpacesBeforeTrailingComments: 1
TabWidth: '4'
UseTab: Never
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ You can very easily end up with a bricked device if the written firmware can't j

| Keyboard | MCU | ISP | USB | Wireless | Details |
| -------- | --- | --- | --- | -------- | ------- |
| [NuPhy Air60 v1](https://nuphy.com/products/air60) | SH68F90A / BYK916 ||| TBD | [Details](docs/keyboards/nuphy-air60.md) |
| [NuPhy Air60 v1](https://nuphy.com/products/air60) | SH68F90A / BYK916 ||| 2.4G (BT WIP) | [Details](docs/keyboards/nuphy-air60.md) |
| E-YOOSO Z11 | SH68F90A / BYK901 ||| N/A | [Details](docs/keyboards/nuphy-air60.md) |

## Developing
Expand Down
5 changes: 4 additions & 1 deletion docs/smk.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
- [ ] NKRO
- [~] QMK Compatibility
- [~] Layouts
- [ ] Wireless
- [~] Wireless
- [~] BK3632
- [~] 2.4G
- [ ] BT
96 changes: 31 additions & 65 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
utils.url = "github:numtide/flake-utils";
sinowealth-kb-tool.url = "github:carlossless/sinowealth-kb-tool";
};
Expand Down
48 changes: 37 additions & 11 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ default_options = {
parts = [
# keyboard, platform, layouts, options
['example', 'sh68f90a', ['default'], {}],
['nuphy-air60', 'sh68f90a', ['default'], { 'vendor_id': '0x05ac', 'product_id': '0x024f' }],
['nuphy-air60', 'sh68f90a', ['default'], { 'vendor_id': '0x05ac', 'product_id': '0x024f', 'wireless': 'bk3632' }],
['eyooso-z11', 'sh68f90a', ['default'], { 'vendor_id': '0x258a', 'product_id': '0x002a' }],
]

Expand All @@ -31,6 +31,7 @@ inc_base_dirs = [
'src',
'src/smk',
'src/plaform',
'src/kb',
'src/user',
'src/keyboards',
]
Expand All @@ -52,6 +53,11 @@ src_user = [
'src/user/indicators_pre_update.c',
'src/user/indicators_update_step.c',
'src/user/indicators_post_update.c',

'src/kb/kb_init.c',
'src/kb/kb_process_record.c',
'src/kb/kb_update_switches.c',
'src/kb/kb_update.c',
]

# PLATFORM
Expand All @@ -70,10 +76,21 @@ src_platform_sh68f90a = [
'src/platform/sh68f90a/usb.c',
]

inc_platform_bk3632 = [
'src/platform/bk3632',
'src/platform', # for bb_spi
]

src_platform_bk3632 = [
'src/platform/bb_spi.c',
'src/platform/bk3632/rf_controller.c',
]

possible_src_keyboard = [
'user_matrix.c',
'user_init.c',
'user_keyboard.c',
# 'user_keyboard.c',
'kb.c'
]

possible_src_layout = [
Expand All @@ -83,7 +100,7 @@ possible_src_layout = [

cc_base_args = [
'--Werror',
'--std-c2x',
'--std-c23',

'-mmcs51',
'--model-small',
Expand Down Expand Up @@ -142,6 +159,22 @@ foreach part : parts
error('unsupported platform: @0@'.format(platform))
endif

cc_args = cc_base_args + [
'-DFREQ_SYS=@0@'.format(options['freq_sys']),
'-DWATCHDOG_ENABLE=@0@'.format(options['watchdog_enable']),
'-DUSB_VID=@0@'.format(options['vendor_id']),
'-DUSB_PID=@0@'.format(options['product_id']),
]

wireless = options.get('wireless', '')
if wireless == 'bk3632'
src_main += src_platform_bk3632
inc_dirs += inc_platform_bk3632
cc_args += '-DRF_ENABLED=1'
elif wireless != ''
error('unsupported platform: @0@'.format(platform))
endif

kb_inc_dir = 'src/keyboards/@0@'.format(keyboard)
if fs.is_dir(kb_inc_dir)
inc_dirs += kb_inc_dir
Expand Down Expand Up @@ -170,13 +203,6 @@ foreach part : parts

prefix = '@0@_@1@_'.format(keyboard, layout)

cc_args = cc_base_args + [
'-DFREQ_SYS=@0@'.format(options['freq_sys']),
'-DWATCHDOG_ENABLE=@0@'.format(options['watchdog_enable']),
'-DUSB_VID=@0@'.format(options['vendor_id']),
'-DUSB_PID=@0@'.format(options['product_id']),
]

cc_incs = []
foreach dir : inc_dirs
cc_incs += '-I' + join_paths(dir_base, dir)
Expand Down Expand Up @@ -208,7 +234,7 @@ foreach part : parts
)

flash_target_name = '@0@flash'.format(prefix)
flash = run_target(flash_target_name,
run_target(flash_target_name,
command : [skbt, 'write', '-p', keyboard, hex_smk.full_path()],
depends : hex_smk,
)
Expand Down
14 changes: 14 additions & 0 deletions src/kb/kb.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef KB_H
#define KB_H

#include "report.h"
#include <stdint.h>
#include <stdbool.h>

void kb_init();
void kb_send_report(report_keyboard_t *report);
bool kb_process_record(uint16_t keycode, bool key_pressed);
void kb_update_switches();
void kb_update();

#endif
1 change: 1 addition & 0 deletions src/kb/kb_init.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
void kb_init() {}
Loading

0 comments on commit 8640b28

Please sign in to comment.