Skip to content

Commit

Permalink
feat(macro): add default config for nrf52810
Browse files Browse the repository at this point in the history
Signed-off-by: Haobo Gu <[email protected]>
  • Loading branch information
HaoboGu committed Oct 22, 2024
1 parent 4ce811e commit cb540bf
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions rmk-macro/src/default_config/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub(crate) mod esp32;
pub(crate) mod nrf52810;
pub(crate) mod nrf52832;
pub(crate) mod nrf52840;
pub(crate) mod rp2040;
Expand Down
25 changes: 25 additions & 0 deletions rmk-macro/src/default_config/nrf52810.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use rmk_config::toml_config::{BleConfig, StorageConfig};

use crate::{
keyboard_config::{CommunicationConfig, KeyboardConfig},
ChipModel,
};

// Default config for nRF52810
pub(crate) fn default_nrf52810(chip: ChipModel) -> KeyboardConfig {
KeyboardConfig {
chip,
communication: CommunicationConfig::Ble(
BleConfig {
enabled: true,
..Default::default()
},
),
storage: StorageConfig {
start_addr: Some(0x28000),
num_sectors: Some(8),
enabled: true,
},
..Default::default()
}
}
7 changes: 4 additions & 3 deletions rmk-macro/src/keyboard_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use std::fs;

use crate::{
default_config::{
esp32::default_esp32, nrf52832::default_nrf52832, nrf52840::default_nrf52840,
rp2040::default_rp2040, stm32::default_stm32,
esp32::default_esp32, nrf52810::default_nrf52810, nrf52832::default_nrf52832,
nrf52840::default_nrf52840, rp2040::default_rp2040, stm32::default_stm32,
},
usb_interrupt_map::{get_usb_info, UsbInfo},
ChipModel, ChipSeries,
Expand Down Expand Up @@ -249,8 +249,9 @@ impl KeyboardConfig {
}

let config = match chip.chip.as_str() {
"nrf52840" => default_nrf52840(chip),
"nrf52840" | "nrf52833" => default_nrf52840(chip),
"nrf52832" => default_nrf52832(chip),
"nrf52810" | "nrf52811" => default_nrf52810(chip),
"rp2040" => default_rp2040(chip),
s if s.starts_with("stm32") => default_stm32(chip),
s if s.starts_with("esp32") => default_esp32(chip),
Expand Down

0 comments on commit cb540bf

Please sign in to comment.