Skip to content

Commit

Permalink
more template fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Univa committed Apr 11, 2024
1 parent 7296ef4 commit 0822374
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion rumcake-basic-template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
cortex-m-rt = "0.7.0"
embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "b8be126" }

rumcake = { git = "https://github.com/Univa/rumcake", rev = "d340eb9", features = ["usb", "stm32f303cb", "vial", "underglow", "ws2812-bitbang"] }
rumcake = { git = "https://github.com/Univa/rumcake", rev = "3ef4990", features = ["usb", "stm32f303cb", "vial", "underglow", "ws2812-bitbang"] }

[build-dependencies]
rust-lzma = "0.6.0"
Expand Down
4 changes: 3 additions & 1 deletion rumcake-basic-template/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ impl USBKeyboard for {{ keyboard-name }} {
// Note: since the `storage` feature flag is not enabled, changes to your keyboard in the Vial app will not be saved. If you use `storage`, be sure to update memory.x.
struct {{ keyboard-name }}Via;
use rumcake::via::ViaKeyboard;
impl ViaKeyboard for {{ keyboard-name }}Via {}
impl ViaKeyboard for {{ keyboard-name }}Via {
type Layout = {{ keyboard-name }};
}
use rumcake::vial::VialKeyboard;
impl VialKeyboard for {{ keyboard-name }}Via {
const VIAL_KEYBOARD_UID: [u8; 8] = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; // TODO: Change this
Expand Down
2 changes: 1 addition & 1 deletion rumcake-split-template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cortex-m = { version = "0.7.6" }
cortex-m-rt = "0.7.0"
embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "b8be126" }

rumcake = { git = "https://github.com/Univa/rumcake", rev = "d340eb9", features = ["nrf52840", "nrf-ble"] }
rumcake = { git = "https://github.com/Univa/rumcake", rev = "3ef4990", features = ["nrf52840", "nrf-ble"] }

[profile.dev]
debug = 2
Expand Down
13 changes: 9 additions & 4 deletions rumcake-split-template/src/left.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![no_main]
#![no_std]
#![feature(macro_metavar_expr)]
#![feature(type_alias_impl_trait)]
#![feature(generic_const_exprs)]

Expand Down Expand Up @@ -28,7 +27,7 @@ impl Keyboard for {{ keyboard-name }}Left {
}

// Layout configuration
use rumcake::bluetooth::BluetoothCommand::*;
use rumcake::hw::HardwareCommand::*;
use rumcake::keyberon::action::{Action::Custom, Action::*};
use rumcake::keyboard::{KeyboardLayout, Keycode::*};
impl KeyboardLayout for {{ keyboard-name }}Left {
Expand All @@ -42,7 +41,7 @@ impl KeyboardLayout for {{ keyboard-name }}Left {
{
[ LGui F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 ]
[ t t t t t t Left Down Up Right t t ]
[ {Custom(Bluetooth(ToggleOutput))} t t t t t Home PgDown PgUp End t F12 ]
[ {Custom(Hardware(ToggleOutput))} t t t t t Home PgDown PgUp End t F12 ]
[ t t t t t t PScreen Enter t t t t ]
}
{
Expand All @@ -66,7 +65,7 @@ impl KeyboardMatrix for {{ keyboard-name }}Left {
}

// Bluetooth configuration
use rumcake::hw::mcu::BluetoothDevice;
use rumcake::hw::platform::BluetoothDevice;
impl BluetoothDevice for {{ keyboard-name }}Left {
const BLUETOOTH_ADDRESS: [u8; 6] = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; // TODO: Change this
}
Expand All @@ -77,6 +76,12 @@ impl BluetoothKeyboard for {{ keyboard-name }}Left {
const BLE_PID: u16 = 0x0000; // TODO: Change this
}

// ADC setup required for battery level detection
use rumcake::hw::platform::setup_adc_sampler;
setup_adc_sampler! {
(timer: TIMER1, ppi_ch0: PPI_CH0, ppi_ch1: PPI_CH1) => {}
}

// Split keyboard setup
use rumcake::split::central::{CentralDevice, CentralDeviceDriver};
use rumcake::drivers::nrf_ble::central::setup_nrf_ble_split_central;
Expand Down
15 changes: 10 additions & 5 deletions rumcake-split-template/src/right.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#![no_main]
#![no_std]
#![feature(macro_metavar_expr)]
#![feature(type_alias_impl_trait)]
#![feature(generic_const_exprs)]

use defmt_rtt as _;
use panic_probe as _;
use rumcake::keyberon;
use rumcake::keyboard;
use rumcake::keyboard::{build_layout, build_standard_matrix};
use rumcake::keyboard::build_standard_matrix;

#[keyboard(split_peripheral(driver_setup_fn = setup_nrf_ble, driver_type = "nrf-ble"))]
pub struct {{ keyboard-name }}Right;
Expand Down Expand Up @@ -39,17 +38,23 @@ impl KeyboardMatrix for {{ keyboard-name }}Right {
}

// Bluetooth configuration
use rumcake::hw::mcu::BluetoothDevice;
use rumcake::hw::platform::BluetoothDevice;
impl BluetoothDevice for {{ keyboard-name }}Right {
const BLUETOOTH_ADDRESS: [u8; 6] = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; // TODO: Change this
}

// ADC setup required for battery level detection
use rumcake::hw::platform::setup_adc_sampler;
setup_adc_sampler! {
(timer: TIMER1, ppi_ch0: PPI_CH0, ppi_ch1: PPI_CH1) => {}
}

// Split keyboard setup
use ::rumcake::split::peripheral::{PeripheralDevice, PeripheralDeviceDriver};
use rumcake::drivers::nrf_ble::peripheral::setup_nrf_ble_split_peripheral;
impl PeripheralDevice for {{ keyboard-name }}Right {}
async fn setup_nrf_ble() -> (impl PeripheralDeviceDriver, [u8; 6]) {
setup_nrf_ble_split_central! {
peripheral_addresses: [[0x00, 0x00, 0x00, 0x00, 0x00, 0x00]], // TODO: Change this, must match the left half's BLUETOOTH_ADDRESS
setup_nrf_ble_split_peripheral! {
central_address: [1, 1, 1, 1, 1, 1], // TODO: Change this, must match the left half's BLUETOOTH_ADDRESS
}
}

0 comments on commit 0822374

Please sign in to comment.