Skip to content

Commit

Permalink
Merge pull request #81 from hdhoang/edition-2018
Browse files Browse the repository at this point in the history
use rust-2018
  • Loading branch information
hdhoang authored Jan 2, 2019
2 parents 42c1f98 + 0fe9069 commit ed95bb3
Show file tree
Hide file tree
Showing 17 changed files with 100 additions and 95 deletions.
79 changes: 43 additions & 36 deletions Cargo.lock

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

12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[package]
edition = "2018"
name = "anne-key"
description = "Firmware for Anne Pro Keyboard"
repository = "https://github.com/ah-/anne-key"
Expand All @@ -14,10 +15,17 @@ bit_field = "0.9.0"
cortex-m = "0.5.8"
cortex-m-rt = "0.6.5"
cortex-m-semihosting = "0.3.1"
cortex-m-rtfm = { git = "https://github.com/hdhoang/cortex-m-rtfm", branch = "v0.3-with-cortex-m-v0.5" }
nb = "0.1.1"
vcell = "0.1.0"
stm32l151-hal = "0.5.0"

[dependencies.rtfm]
package = "cortex-m-rtfm"
git = "https://github.com/hdhoang/cortex-m-rtfm"
branch = "v0.3-with-cortex-m-v0.5"

[dependencies.hal]
package = "stm32l151-hal"
version = "0.5.0"

[dependencies.embedded-hal]
features = ["unproven"]
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2018-12-06
nightly-2019-01-01
2 changes: 1 addition & 1 deletion src/action.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use keycodes::KeyCode;
use crate::keycodes::KeyCode;

#[allow(dead_code)]
#[derive(Copy, Clone, PartialEq)]
Expand Down
4 changes: 2 additions & 2 deletions src/bluetooth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use super::led::Led;
use super::protocol::{BleOp, KeyboardOp, LedOp, MacroOp, Message, MsgType, SystemOp};
use super::serial::bluetooth_usart::BluetoothUsart;
use super::serial::{DmaUsart, Serial, Transfer};
use crate::debug::UnwrapLog;
use core::marker::Unsize;
use debug::UnwrapLog;
use nb;
use rtfm::Threshold;

Expand Down Expand Up @@ -104,7 +104,7 @@ where

pub fn handle_message(
&mut self,
message: &Message,
message: &Message<'_>,
led: &mut Led<BUFFER>,
keyboard: &mut Keyboard,
) {
Expand Down
2 changes: 1 addition & 1 deletion src/clock.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cortex_m;
use stm32l151;
use stm32l1::stm32l151;

pub fn init_clock(p: &stm32l151::Peripherals) {
p.USB.usb_cntr.modify(|_, w| w.pdwn().clear_bit());
Expand Down
22 changes: 11 additions & 11 deletions src/keyboard.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
use action::Action;
use crate::action::Action;
use crate::bluetooth::Bluetooth;
use crate::debug::UnwrapLog;
use crate::hidreport::HidReport;
use crate::keycodes::KeyCode;
use crate::keymatrix::{KeyState, COLUMNS, ROWS};
use crate::layout::LAYERS;
use crate::layout::LAYER_BT;
use crate::led::Led;
use crate::usb::Usb;
use bit_field::{BitArray, BitField};
use bluetooth::Bluetooth;
use core::marker::Unsize;
use debug::UnwrapLog;
use hidreport::HidReport;
use keycodes::KeyCode;
use keymatrix::{KeyState, COLUMNS, ROWS};
use layout::LAYERS;
use layout::LAYER_BT;
use led::Led;
use stm32l151::SCB;
use usb::Usb;
use stm32l1::stm32l151::SCB;

pub struct Keyboard {
layers: Layers,
Expand Down
2 changes: 1 addition & 1 deletion src/keymatrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use embedded_hal::digital::{InputPin, OutputPin};
use hal::gpio::gpioa::*;
use hal::gpio::gpiob::*;
use hal::gpio::{Input, Output};
use stm32l151::SYST;
use stm32l1::stm32l151::SYST;

pub const ROWS: usize = 5;
pub const COLUMNS: usize = 14;
Expand Down
8 changes: 4 additions & 4 deletions src/layout.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use action::Action;
use action::Action::*;
use keycodes::KeyCode::*;
use keymatrix::{COLUMNS, ROWS};
use crate::action::Action;
use crate::action::Action::*;
use crate::keycodes::KeyCode::*;
use crate::keymatrix::{COLUMNS, ROWS};

/*
,-----------------------------------------------------------------------------.
Expand Down
8 changes: 4 additions & 4 deletions src/led.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ use super::keymatrix::KeyState;
use super::protocol::{LedOp, Message, MsgType};
use super::serial::led_usart::LedUsart;
use super::serial::{Serial, Transfer};
use bluetooth::BluetoothMode;
use crate::bluetooth::BluetoothMode;
use crate::keycodes::KeyIndex;
use core::marker::Unsize;
use embedded_hal::digital::OutputPin;
use hal::gpio::gpioc::PC15;
use hal::gpio::{Input, Output};
use keycodes::KeyIndex;
use nb;
use rtfm::Threshold;
use stm32l151::SYST;
use stm32l1::stm32l151::SYST;

pub enum LedMode {
_Off,
Expand Down Expand Up @@ -204,7 +204,7 @@ where
self.set_keys(payload)
}

pub fn handle_message(&mut self, message: &Message) {
pub fn handle_message(&mut self, message: &Message<'_>) {
match message.msg_type {
MsgType::Led => {
match LedOp::from(message.operation) {
Expand Down
Loading

0 comments on commit ed95bb3

Please sign in to comment.