mirror of https://github.com/zmkfirmware/zmk.git
Compare commits
8 Commits
3a87e5cdaf
...
b67727fa37
| Author | SHA1 | Date |
|---|---|---|
|
|
b67727fa37 | |
|
|
abb64ba316 | |
|
|
8de5b120aa | |
|
|
ece2ce11b8 | |
|
|
d32ffb0a33 | |
|
|
83eafcbf9b | |
|
|
ad7fbfef92 | |
|
|
4da8d2cb20 |
|
|
@ -219,9 +219,6 @@ config BT_GATT_NOTIFY_MULTIPLE
|
|||
config BT_GATT_AUTO_SEC_REQ
|
||||
default (ZMK_SPLIT_BLE && !ZMK_SPLIT_ROLE_CENTRAL)
|
||||
|
||||
config BT_DEVICE_APPEARANCE
|
||||
default 961
|
||||
|
||||
config BT_PERIPHERAL_PREF_MIN_INT
|
||||
default 6
|
||||
|
||||
|
|
@ -323,7 +320,7 @@ config ZMK_RGB_UNDERGLOW_SPD_START
|
|||
|
||||
config ZMK_RGB_UNDERGLOW_EFF_START
|
||||
int "RGB underglow start effect int value related to the effect enum list"
|
||||
range 0 3
|
||||
range 0 4
|
||||
|
||||
config ZMK_RGB_UNDERGLOW_ON_START
|
||||
bool "RGB underglow starts on by default"
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@ config SYSTEM_WORKQUEUE_STACK_SIZE
|
|||
default 2048 if SOC_RP2040
|
||||
default 2048 if ZMK_BLE
|
||||
|
||||
# Basic
|
||||
config BT_DEVICE_APPEARANCE
|
||||
default 961
|
||||
|
||||
# HID
|
||||
if ZMK_HID_REPORT_TYPE_HKRO
|
||||
|
||||
|
|
@ -110,4 +114,4 @@ config ZMK_BATTERY_REPORT_INTERVAL
|
|||
default 60
|
||||
|
||||
# Imports
|
||||
rsource "src/split/Kconfig.defaults"
|
||||
rsource "src/split/Kconfig.defaults"
|
||||
|
|
|
|||
|
|
@ -65,13 +65,15 @@ static uint8_t active_profile;
|
|||
|
||||
#define DEVICE_NAME CONFIG_BT_DEVICE_NAME
|
||||
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
|
||||
#define DEVICE_APPEARANCE \
|
||||
(uint8_t) CONFIG_BT_DEVICE_APPEARANCE, (uint8_t)(CONFIG_BT_DEVICE_APPEARANCE >> 8)
|
||||
|
||||
BUILD_ASSERT(
|
||||
DEVICE_NAME_LEN <= CONFIG_BT_DEVICE_NAME_MAX,
|
||||
"ERROR: BLE device name is too long. Max length: " STRINGIFY(CONFIG_BT_DEVICE_NAME_MAX));
|
||||
|
||||
static struct bt_data zmk_ble_ad[] = {
|
||||
BT_DATA_BYTES(BT_DATA_GAP_APPEARANCE, 0xC1, 0x03),
|
||||
BT_DATA_BYTES(BT_DATA_GAP_APPEARANCE, DEVICE_APPEARANCE),
|
||||
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
|
||||
BT_DATA_BYTES(BT_DATA_UUID16_SOME, 0x12, 0x18, /* HID Service */
|
||||
0x0f, 0x18 /* Battery Service */
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <zmk/activity.h>
|
||||
#include <zmk/usb.h>
|
||||
#include <zmk/battery.h>
|
||||
#include <zmk/event_manager.h>
|
||||
#include <zmk/events/activity_state_changed.h>
|
||||
#include <zmk/events/usb_conn_state_changed.h>
|
||||
|
|
@ -49,6 +50,7 @@ enum rgb_underglow_effect {
|
|||
UNDERGLOW_EFFECT_BREATHE,
|
||||
UNDERGLOW_EFFECT_SPECTRUM,
|
||||
UNDERGLOW_EFFECT_SWIRL,
|
||||
UNDERGLOW_EFFECT_BATTERY,
|
||||
UNDERGLOW_EFFECT_NUMBER // Used to track number of underglow effects
|
||||
};
|
||||
|
||||
|
|
@ -175,6 +177,22 @@ static void zmk_rgb_underglow_effect_swirl(void) {
|
|||
state.animation_step = state.animation_step % HUE_MAX;
|
||||
}
|
||||
|
||||
static void zmk_rgb_underglow_effect_battery(void) {
|
||||
struct zmk_led_hsb hsb = state.color;
|
||||
|
||||
// Only set lights if battery information available, otherwise set to blue
|
||||
if (DT_HAS_CHOSEN(zmk_battery)) {
|
||||
uint8_t soc = zmk_battery_state_of_charge();
|
||||
hsb.h = (soc * 1.2);
|
||||
} else {
|
||||
hsb.h = 240;
|
||||
}
|
||||
hsb.s = SAT_MAX;
|
||||
for (int i = 0; i < STRIP_NUM_PIXELS; i++) {
|
||||
pixels[i] = hsb_to_rgb(hsb_scale_min_max(hsb));
|
||||
}
|
||||
}
|
||||
|
||||
static void zmk_rgb_underglow_tick(struct k_work *work) {
|
||||
switch (state.current_effect) {
|
||||
case UNDERGLOW_EFFECT_SOLID:
|
||||
|
|
@ -189,6 +207,9 @@ static void zmk_rgb_underglow_tick(struct k_work *work) {
|
|||
case UNDERGLOW_EFFECT_SWIRL:
|
||||
zmk_rgb_underglow_effect_swirl();
|
||||
break;
|
||||
case UNDERGLOW_EFFECT_BATTERY:
|
||||
zmk_rgb_underglow_effect_battery();
|
||||
break;
|
||||
}
|
||||
|
||||
int err = led_strip_update_rgb(led_strip, pixels, STRIP_NUM_PIXELS);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ static void blvl_ccc_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value
|
|||
|
||||
static ssize_t read_blvl(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset) {
|
||||
const uint8_t source = (uint8_t)(uint32_t)attr->user_data;
|
||||
const uint8_t source = *(uint8_t *)attr->user_data;
|
||||
uint8_t level = 0;
|
||||
int rc = zmk_split_central_get_peripheral_battery_level(source, &level);
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ static const struct bt_gatt_cpf aux_level_cpf = {
|
|||
|
||||
#define PERIPH_BATT_LEVEL_ATTRS(i, _) \
|
||||
BT_GATT_CHARACTERISTIC(BT_UUID_BAS_BATTERY_LEVEL, BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY, \
|
||||
BT_GATT_PERM_READ, read_blvl, NULL, i), \
|
||||
BT_GATT_PERM_READ, read_blvl, NULL, ((uint8_t[]){i})), \
|
||||
BT_GATT_CCC(blvl_ccc_cfg_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE), \
|
||||
BT_GATT_CPF(&aux_level_cpf), BT_GATT_CUD(PERIPH_CUD(i), BT_GATT_PERM_READ),
|
||||
|
||||
|
|
|
|||
|
|
@ -55,13 +55,14 @@ int zmk_split_transport_peripheral_command_handler(
|
|||
if (err) {
|
||||
LOG_ERR("Failed to invoke behavior %s: %d", binding.behavior_dev, err);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
case ZMK_SPLIT_TRANSPORT_CENTRAL_CMD_TYPE_SET_PHYSICAL_LAYOUT: {
|
||||
zmk_physical_layouts_select(cmd.data.set_physical_layout.layout_idx);
|
||||
return zmk_physical_layouts_select(cmd.data.set_physical_layout.layout_idx);
|
||||
}
|
||||
#if IS_ENABLED(CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS)
|
||||
case ZMK_SPLIT_TRANSPORT_CENTRAL_CMD_TYPE_SET_HID_INDICATORS: {
|
||||
raise_zmk_hid_indicators_changed((struct zmk_hid_indicators_changed){
|
||||
return raise_zmk_hid_indicators_changed((struct zmk_hid_indicators_changed){
|
||||
.indicators = cmd.data.set_hid_indicators.indicators});
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -16,3 +16,4 @@ See [Configuration Overview](index.md) for instructions on how to change these s
|
|||
| `CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES` | bool | Aggregate config that enables both `CONFIG_ZMK_BLE_EXPERIMENTAL_CONN` and `CONFIG_ZMK_BLE_EXPERIMENTAL_SEC`. | n |
|
||||
| `CONFIG_ZMK_BLE_PASSKEY_ENTRY` | bool | Enable passkey entry during pairing for enhanced security. (Note: After enabling this, you will need to re-pair all previously paired hosts.) | n |
|
||||
| `CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION` | bool | Low level setting for GATT subscriptions. Set to `n` to work around an annoying Windows bug with battery notifications. | y |
|
||||
| `CONFIG_BT_DEVICE_APPEARANCE` | int | Bluetooth device [appearance value](https://bluetooth.com/specifications/assigned-numbers) (should be converted from hexadecimal to decimal). | 961 |
|
||||
|
|
|
|||
|
|
@ -1,6 +1,34 @@
|
|||
const { execSync } = require("child_process");
|
||||
const path = require("path");
|
||||
const theme = require("./src/theme/prism/themes/github");
|
||||
const darkTheme = require("./src/theme/prism/themes/github-dark-dimmed");
|
||||
const { releaseVersions } = require("./zmk-release-versions.json");
|
||||
|
||||
const gitBranch =
|
||||
process.env.BRANCH ||
|
||||
execSync("git branch --show-current", { encoding: "utf-8" }).trim();
|
||||
const isDevelopmentVersion =
|
||||
gitBranch === "main" || !/^v\d+\.\d+-branch$/.test(gitBranch);
|
||||
const versionNavbarItems = [
|
||||
{
|
||||
label: "Pre-Release",
|
||||
description: "Current active development branch (main)",
|
||||
href: "https://zmk.dev/docs/",
|
||||
},
|
||||
...releaseVersions.map((r) => ({
|
||||
label: "v" + r,
|
||||
description: "Stable release v" + r,
|
||||
href: `https://v${r.replaceAll(".", "-")}-branch.zmk.dev/docs/`,
|
||||
})),
|
||||
];
|
||||
|
||||
const versionDropDownLabel = (
|
||||
isDevelopmentVersion
|
||||
? versionNavbarItems[0]
|
||||
: versionNavbarItems.find((item) => {
|
||||
return item.label === gitBranch.replace("-branch", "");
|
||||
})
|
||||
).label;
|
||||
|
||||
module.exports = {
|
||||
title: "ZMK Firmware",
|
||||
|
|
@ -11,6 +39,10 @@ module.exports = {
|
|||
trailingSlash: "false",
|
||||
organizationName: "zmkfirmware", // Usually your GitHub org/user name.
|
||||
projectName: "zmk", // Usually your repo name.
|
||||
customFields: {
|
||||
isDevelopmentVersion,
|
||||
releaseVersions,
|
||||
},
|
||||
plugins: [
|
||||
"@docusaurus/theme-mermaid",
|
||||
path.resolve(__dirname, "src/docusaurus-tree-sitter-plugin"),
|
||||
|
|
@ -51,16 +83,29 @@ module.exports = {
|
|||
label: "Docs",
|
||||
position: "left",
|
||||
},
|
||||
{ to: "blog", label: "Blog", position: "left" },
|
||||
isDevelopmentVersion
|
||||
? { to: "blog", label: "Blog", position: "left" }
|
||||
: { href: "https://zmk.dev/blog", label: "Blog", position: "left" },
|
||||
{
|
||||
to: "power-profiler",
|
||||
label: "Power Profiler",
|
||||
type: "dropdown",
|
||||
label: "Tools",
|
||||
position: "left",
|
||||
items: [
|
||||
{
|
||||
to: "power-profiler",
|
||||
label: "Power Profiler",
|
||||
},
|
||||
{
|
||||
to: "keymap-upgrader",
|
||||
label: "Keymap Upgrader",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
to: "keymap-upgrader",
|
||||
label: "Keymap Upgrader",
|
||||
position: "left",
|
||||
type: "dropdown",
|
||||
label: versionDropDownLabel,
|
||||
position: "right",
|
||||
items: versionNavbarItems,
|
||||
},
|
||||
{
|
||||
href: "https://zmk.studio/",
|
||||
|
|
@ -69,7 +114,8 @@ module.exports = {
|
|||
},
|
||||
{
|
||||
href: "https://github.com/zmkfirmware/zmk",
|
||||
label: "GitHub",
|
||||
"aria-label": "ZMK GitHub Repository",
|
||||
className: "header-github-link",
|
||||
position: "right",
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -23,6 +23,21 @@
|
|||
--docusaurus-highlighted-code-line-bg: rgb(255 255 255 / 8%);
|
||||
}
|
||||
|
||||
.header-github-link::before {
|
||||
content: "";
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: flex;
|
||||
background-color: var(--ifm-navbar-link-color);
|
||||
mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E");
|
||||
transition: background-color var(--ifm-transition-fast)
|
||||
var(--ifm-transition-timing-default);
|
||||
}
|
||||
|
||||
.header-github-link:hover::before {
|
||||
background-color: var(--ifm-navbar-link-hover-color);
|
||||
}
|
||||
|
||||
.docusaurus-highlight-code-line {
|
||||
display: block;
|
||||
margin: 0 calc(-1 * var(--ifm-pre-padding));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
import { type ReactNode } from "react";
|
||||
import clsx from "clsx";
|
||||
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
|
||||
import Link from "@docusaurus/Link";
|
||||
import { ThemeClassNames } from "@docusaurus/theme-common";
|
||||
import type { Props } from "@theme/DocVersionBanner";
|
||||
|
||||
function ZMKReleaseLink({ version }: { version: string }): ReactNode {
|
||||
return (
|
||||
<Link
|
||||
href={`https://v${version.replaceAll(".", "-")}-branch.zmk.dev/docs/`}
|
||||
>
|
||||
v{version}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
function DevWarningBanner({
|
||||
className,
|
||||
latestVersion,
|
||||
}: Props & { latestVersion: string }): ReactNode {
|
||||
return (
|
||||
<div
|
||||
className={clsx(
|
||||
className,
|
||||
ThemeClassNames.docs.docVersionBanner,
|
||||
"alert alert--warning margin-bottom--md"
|
||||
)}
|
||||
role="alert"
|
||||
>
|
||||
You're viewing the documentation for the development version of ZMK. You
|
||||
may want the latest release <ZMKReleaseLink version={latestVersion} />.
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function DocVersionBanner({ className }: Props): ReactNode {
|
||||
const {
|
||||
siteConfig: { customFields },
|
||||
} = useDocusaurusContext();
|
||||
|
||||
if (
|
||||
!customFields?.releaseVersions ||
|
||||
!Array.isArray(customFields.releaseVersions)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const releaseVersions: [string] = customFields.releaseVersions as [string];
|
||||
|
||||
if (customFields.isDevelopmentVersion) {
|
||||
return (
|
||||
<DevWarningBanner
|
||||
className={className}
|
||||
latestVersion={releaseVersions[0]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"releaseVersions": ["0.3"]
|
||||
}
|
||||
Loading…
Reference in New Issue