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

eyooso-z11 device support and more reorganization #14

Merged
merged 11 commits into from
May 26, 2024
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# SMK - Small (device) Mechanical Keyboard Firmware

This is a keyboard firmware similar to [QMK](https://github.com/qmk/qmk_firmware), but targeting 8051-based devices like the Sinowealth SH68F90A (labeled as BYK916). It's aimed to be at least partially compatible with QMK configurations.
This is a keyboard firmware similar to [QMK](https://github.com/qmk/qmk_firmware), but targeting 8051-based devices like the Sinowealth SH68F90A (labeled as BYK916 or BYK901). It's aimed to be at least partially compatible with QMK configurations.

The S (Small) in SMK comes from this firmware using [SDCC](https://sdcc.sourceforge.net/) to build itself.

Expand All @@ -18,7 +18,8 @@ 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/nuphy-air60.md) |
| [NuPhy Air60 v1](https://nuphy.com/products/air60) | SH68F90A / BYK916 | ✅ | ✅ | TBD | [Details](docs/keyboards/nuphy-air60.md) |
| E-YOOSO Z11 | SH68F90A / BYK901 | ✅ | ✅ | N/A | [Details](docs/keyboards/nuphy-air60.md) |

## Acknowledgements

Expand Down
39 changes: 15 additions & 24 deletions docs/nuphy-air60.md → docs/keyboards/eyooso-z11.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,26 @@
# NuPhy Air60 Support
# E-YOOSO Z11

## MCU
## Specs

- [x] 3.3V LDO
- [x] CPU Clock (use 24Mhz as SYSCLK)
- [x] GPIO
- [x] UART
- [x] Transmit
- [ ] Receive
- [x] PWM
- [x] USB
- [ ] SPI
- MCU: BYK901(-0997A) (SH68F90A)
- Backlight: Single Color LEDs (Yellow)
- Indicators: Single CAPS_LOCK LED
- Wireless: None

## Keyboard
## Pictures

| PCB | MCU | JTAG Setup |
| --- | --- | ---------- |
| ![e-yooso-z11-pcb](https://github.com/carlossless/smk/assets/498906/8335b453-d8ef-45ce-ae17-d5c9ffe432c1) | ![e-yooso-z11-mcu](https://github.com/carlossless/smk/assets/498906/ce7b8f84-7359-4c8d-a012-b90a1927bc6a) | ![e-yooso-z11-jtag](https://github.com/carlossless/smk/assets/498906/a872b662-24c5-47f8-98af-09b74ef02885) |

## SMK Supported Features

- [x] ISP (jump)
- [x] Key Scan
- [x] RGB Matrix
- [ ] Debouncing
- [x] USB HID
- [x] USB Keyboard
- [ ] Status LEDs
- [ ] Extra Keys (System / Consumer)
- [ ] NKRO
- [~] QMK Compatibility
- [~] Layouts
- [ ] Wireless
- [x] LED Matrix

## Code Options

This firmware requires the following (stock) code options for SH68F90A
This firmware requires the following (stock) code options that are programmed on the BYK901 (SH68F90A) in the E-YOOSO Z11

```
Code Option String: A4E063C00F000088
Expand Down
71 changes: 71 additions & 0 deletions docs/keyboards/nuphy-air60.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# NuPhy Air60

## Specs

- MCU: BYK916 (SH68F90A)
- Backlight: RGB LEDs
- Indicators: 2x5 RGB LEDs (on each side, part of the RGB backlight matrix)
- Switches:
- 2-state switch to control OS mode (win/mac)
- 3-state switch to control power and usb/wireless mode (off/usb/wireless)
- Wireless: BK3632 (supports BT and 2.4G)

## Pictures

| PCB | MCU | Wireless IC |
| --- | --- | ----------- |
| ![top](https://github.com/carlossless/smk/assets/498906/43ad50b2-6666-424d-94f8-ca8e9207eb7b) | ![mcu](https://github.com/carlossless/smk/assets/498906/295a8904-d131-45e1-a5dd-d2938b1a116b) | ![wireless-ic](https://github.com/carlossless/smk/assets/498906/ab980bf1-6123-4947-b05b-c006d6e41ef0) |

## SMK Supported Features

- [x] Key Scan
- [x] RGB Matrix
- [ ] Wireless

## Code Options

This firmware requires the following (stock) code options that are programmed on the BYK916 (SH68F90A) in the E-YOOSO Z11

```
Code Option String: A4E063C00F000088
Code Option Number: 0x8800000fc063e0a4

Byte 0 - A4
OP_OSCDRIVE 2 - 4MHz crystal or 8~12MHz crystal with external capacitance(C1=C2)<20pF
OP_RST 1 - P0.2 used as IO pin
OP_WMT 0 - longest warm up time
OP_SCMEN 1 - Disable SCM
OP_OSCRFB 0 - 150K

Byte 1 - E0
OP_LVREN 1 - Enable LVR function
OP_LVRLEVEL 3 - 2.1V LVR level4
OP_SCM 0 - SCM is invalid in warm up period
OP_OSC2SEL 0 - OSC2 select 12M RC
OP_IOV1 0 - P7.1/P7.2/P7.3/P7.4 input/output level is VUSB(5V)
OP_IOV0 0 - P5.5/P5.6 input/output level is VUSB(5V)

Byte 2 - 63
OP_SCMSEL 3 - 8MHz
OP_OSC 3 - Oscillator1 is internal 128KHz RC, oscillator2 is internal 24MHz RC

Byte 3 - C0
OP_ISP 1 - Disable ISP function
OP_ISPPIN 1 - Enter ISP mode only when P6.3 and P6.4 are connected to GND, simultaneously
OP_WDT 0 - Enable WDT function
OP_WDTPD 0 - Disable WDT function in Power-Down mode

Byte 4 - 0F
OP_SINK1 3 - Port6[5:0] sink ability largest mode(380mA)
OP_SINK0 3 - P4.7/Port7[7:5] sink ability largest mode(50mA)

Byte 5 - 00
OP_BOPTP 0 - (1+21%)tr min
OP_BOPTN 0 - (1+21%)tf min

Byte 6 - 00
Unused

Byte 7 - 88
OP_ISPSIZE 8 - 0Bytes
```
14 changes: 14 additions & 0 deletions docs/platforms/sh68f90a.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SH68F90A (BYK901 / BYK916) Support

## MCU

- [x] 3.3V LDO
- [x] CPU Clock (use 24Mhz as SYSCLK)
- [x] GPIO
- [x] UART
- [x] Transmit
- [x] Receive
- [x] PWM
- [x] USB
- [ ] SPI
- [x] ISP (jump)
15 changes: 15 additions & 0 deletions docs/smk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SMK Supported Features

- [x] Debug printf (via UART)
- [x] Key Scan
- [ ] Debouncing
- [x] Indicators (Backlight)
- [x] USB HID
- [x] ISP Command
- [x] USB Keyboard
- [x] Status LEDs
- [ ] Extra Keys (System / Consumer)
- [ ] NKRO
- [~] QMK Compatibility
- [~] Layouts
- [ ] Wireless
12 changes: 6 additions & 6 deletions flake.lock

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

39 changes: 32 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ default_options = {
parts = [
['example', 'sh68f90a', ['default'], {}],
['nuphy-air60', 'sh68f90a', ['default'], { 'vendor_id': '0x05ac', 'product_id': '0x024f' }],
['eyooso-z11', 'sh68f90a', ['default'], { 'vendor_id': '0x258a', 'product_id': '0x002a' }],
]

# SMK
Expand All @@ -35,12 +36,15 @@ src_smk = [
'src/smk/host.c',
'src/smk/matrix.c',
'src/smk/report.c',
'src/smk/keyboard.c',
]

# USER DEFAULTS

src_user = [
'src/user/user_init.c',
'src/user/layout_process_record.c',
'src/user/indicators_start.c',
'src/user/indicators_pre_update.c',
'src/user/indicators_update_step.c',
'src/user/indicators_post_update.c',
Expand All @@ -55,13 +59,11 @@ inc_platform_sh68f90a = [
src_platform_sh68f90a = [
'src/platform/sh68f90a/clock.c',
'src/platform/sh68f90a/delay.c',
'src/platform/sh68f90a/gpio.c',
'src/platform/sh68f90a/isp.c',
'src/platform/sh68f90a/ldo.c',
'src/platform/sh68f90a/pwm.c',
'src/platform/sh68f90a/uart.c',
'src/platform/sh68f90a/usb.c',
'src/platform/sh68f90a/keyboard.c',
]

# USER KEYBOARDS
Expand All @@ -79,7 +81,18 @@ inc_user_nuphy_air60 = [
]

src_user_nuphy_air60 = [
'src/keyboards/nuphy-air60/user_init.c',
'src/keyboards/nuphy-air60/user_matrix.c',
'src/keyboards/nuphy-air60/user_keyboard.c',
]

inc_user_eyooso_z11 = [
'src/keyboards/eyooso-z11',
]

src_user_eyooso_z11 = [
'src/keyboards/eyooso-z11/user_init.c',
'src/keyboards/eyooso-z11/user_matrix.c',
]

# USER LAYOUTS
Expand All @@ -93,6 +106,11 @@ src_user_nuphy_air60_default = [
'src/keyboards/nuphy-air60/layouts/default/layout.c',
]

src_user_eyooso_z11_default = [
'src/keyboards/eyooso-z11/layouts/default/indicators.c',
'src/keyboards/eyooso-z11/layouts/default/layout.c',
]

cc_base_args = [
'--Werror',
'--std-c2x',
Expand Down Expand Up @@ -154,19 +172,26 @@ foreach part : parts
error('unsupported platform: @0@'.format(platform))
endif

if keyboard == 'nuphy-air60'
if keyboard == 'example'
src_main += src_user_example
inc_dirs += inc_user_example

if layout == 'default'
src_main += src_user_example_default
endif
elif keyboard == 'nuphy-air60'
src_main += src_user_nuphy_air60
inc_dirs += inc_user_nuphy_air60

if layout == 'default'
src_main += src_user_nuphy_air60_default
endif
elif keyboard == 'example'
src_main += src_user_example
inc_dirs += inc_user_example
elif keyboard == 'eyooso-z11'
src_main += src_user_eyooso_z11
inc_dirs += inc_user_eyooso_z11

if layout == 'default'
src_main += src_user_example_default
src_main += src_user_eyooso_z11_default
endif
else
error('unsupported keyboard: @0@'.format(keyboard))
Expand Down
66 changes: 7 additions & 59 deletions src/keyboards/example/kbdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,73 +3,21 @@

#include "sh68f90a.h"

#define MATRIX_ROWS 5
#define MATRIX_COLS 16
#define MATRIX_ROWS 1
#define MATRIX_COLS 2

// Row Pins Bits
#define KB_R0_P7_1 _P7_1
#define KB_R1_P7_2 _P7_2
#define KB_R2_P7_3 _P7_3
#define KB_R2_P5_3 _P5_3
#define KB_R2_P5_4 _P5_4

// Row Pins
// TODO
#define KB_R0 P7_1

// Column Pins Bits
#define KB_C0_P5_0 _P5_0
#define KB_C1_P5_1 _P5_1
#define KB_C2_P5_2 _P5_2
#define KB_C3_P3_5 _P3_5
#define KB_C4_P3_4 _P3_4
#define KB_C5_P3_3 _P3_3
#define KB_C6_P3_2 _P3_2
#define KB_C7_P3_1 _P3_1
#define KB_C8_P3_0 _P3_0
#define KB_C9_P2_5 _P2_5
#define KB_C10_P2_4 _P2_4
#define KB_C11_P2_3 _P2_3
#define KB_C12_P2_2 _P2_2
#define KB_C13_P2_1 _P2_1
#define KB_C14_P2_0 _P2_0
#define KB_C15_P1_5 _P1_5
#define KB_C0_P5_0 _P5_0
#define KB_C1_P5_1 _P5_1

// Column Pins
#define KB_C0 P5_0
#define KB_C1 P5_1
#define KB_C2 P5_2
#define KB_C3 P3_5
#define KB_C4 P3_4
#define KB_C5 P3_3
#define KB_C6 P3_2
#define KB_C7 P3_1
#define KB_C8 P3_0
#define KB_C9 P2_5
#define KB_C10 P2_4
#define KB_C11 P2_3
#define KB_C12 P2_2
#define KB_C13 P2_1
#define KB_C14 P2_0
#define KB_C15 P1_5

// RGB Row Pins
#define RGB_R0R_P0_4 _P0_4
#define RGB_R0G_P6_1 _P6_1
#define RGB_R0B_P0_3 _P0_3
#define RGB_R1R_P6_7 _P6_7
#define RGB_R1G_P6_2 _P6_2
#define RGB_R1B_P6_6 _P6_6
#define RGB_R2R_P0_2 _P0_2
#define RGB_R2G_P6_3 _P6_3
#define RGB_R2B_P5_7 _P5_7
#define RGB_R3R_P4_5 _P4_5
#define RGB_R3G_P6_4 _P6_4
#define RGB_R3B_P4_6 _P4_6
#define RGB_R4R_P4_4 _P4_4
#define RGB_R4G_P6_5 _P6_5
#define RGB_R4B_P4_3 _P4_3
#define RGB_ULR_P1_1 _P1_1
#define RGB_ULG_P1_2 _P1_2
#define RGB_ULB_P1_3 _P1_3
#define KB_C0 P5_0
#define KB_C1 P5_1

#endif
Loading