aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/board/mod.rs1
-rw-r--r--src/board/pins.rs31
-rw-r--r--src/drivers/buttons.rs0
-rw-r--r--src/drivers/display.rs18
-rw-r--r--src/drivers/mod.rs1
-rw-r--r--src/main.rs13
6 files changed, 63 insertions, 1 deletions
diff --git a/src/board/mod.rs b/src/board/mod.rs
new file mode 100644
index 0000000..2babc83
--- /dev/null
+++ b/src/board/mod.rs
@@ -0,0 +1 @@
+pub mod pins;
diff --git a/src/board/pins.rs b/src/board/pins.rs
new file mode 100644
index 0000000..71e471b
--- /dev/null
+++ b/src/board/pins.rs
@@ -0,0 +1,31 @@
+// OLED
+pub const OLED_SDA_PIN: i32 = 8;
+pub const OLED_SCL_PIN: i32 = 9;
+
+// NRF24
+pub const CE1_PIN: i32 = 10;
+pub const CSN1_PIN: i32 = 11;
+
+pub const CE2_PIN: i32 = 12;
+pub const CSN2_PIN: i32 = 13;
+
+pub const NRF_SCK: i32 = 18;
+pub const NRF_MISO: i32 = 16;
+pub const NRF_MOSI: i32 = 17;
+
+// CC1101 FSPI
+pub const CC1101_SCK: i32 = 15;
+pub const CC1101_MISO: i32 = 41;
+pub const CC1101_MOSI: i32 = 35;
+
+pub const CC1101_CS: i32 = 40;
+pub const CC1101_GDO0: i32 = 39;
+pub const CC1101_GDO2: i32 = 42;
+
+// Buttons
+pub const BTN_UP: i32 = 4;
+pub const BTN_DOWN: i32 = 5;
+pub const BTN_SELECT: i32 = 6;
+pub const BTN_BACK: i32 = 7;
+pub const BTN_RIGHT: i32 = 1;
+pub const BTN_LEFT: i32 = 2;
diff --git a/src/drivers/buttons.rs b/src/drivers/buttons.rs
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/drivers/buttons.rs
diff --git a/src/drivers/display.rs b/src/drivers/display.rs
new file mode 100644
index 0000000..77bacf6
--- /dev/null
+++ b/src/drivers/display.rs
@@ -0,0 +1,18 @@
+use crate::board::pins::*;
+
+pub struct Display {
+}
+
+impl Display {
+ pub fn new() -> Self {
+ Self {}
+ }
+
+ pub fn init(&mut self) {
+ log::info!("display Initialized!!");
+ }
+
+ pub fn draw_text(&mut self, text: &str) {
+ log::info!("{}", text);
+ }
+}
diff --git a/src/drivers/mod.rs b/src/drivers/mod.rs
new file mode 100644
index 0000000..8754563
--- /dev/null
+++ b/src/drivers/mod.rs
@@ -0,0 +1 @@
+pub mod display;
diff --git a/src/main.rs b/src/main.rs
index 419e7f7..ee48cf8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,9 @@
+
+mod board;
+mod drivers;
+
+use drivers::display::Display;
+
fn main() {
// It is necessary to call this function once. Otherwise, some patches to the runtime
// implemented by esp-idf-sys might not link properly. See https://github.com/esp-rs/esp-idf-template/issues/71
@@ -6,5 +12,10 @@ fn main() {
// Bind the log crate to the ESP Logging facilities
esp_idf_svc::log::EspLogger::initialize_default();
- log::info!("Hello, world!");
+ log::info!("ORION-RF Booted!!");
+ let mut display = Display::new();
+
+ display.init();
+ display.draw_text("ORION-RF");
+
}