orion-rfab699e4
add display module stubs
+66 −1
7 files changed
- M Cargo.toml +3 −0
- A src/board/mod.rs +1 −0
- A src/board/pins.rs +31 −0
- A src/drivers/buttons.rs +0 −0
- A src/drivers/display.rs +18 −0
- A src/drivers/mod.rs +1 −0
- M src/main.rs +12 −1
| @@ -23,5 +23,8 @@ esp-idf-svc = { version = "0.52.1", features = ["critical-section", "embassy-tim | |||
| 23 | 23 | # Remove `generic-queue-8` if you plan to use `embassy-time` WITH `embassy-executor` | |
| 24 | 24 | embassy-time = { version = "0.5", features = ["generic-queue-8"] } | |
| 25 | 25 | ||
| 26 | + | embedded-graphics = "0.8.2" | |
| 27 | + | ssd1306 = "0.10.0" | |
| 28 | + | ||
| 26 | 29 | [build-dependencies] | |
| 27 | 30 | embuild = "0.33" | |
| @@ -0,0 +1 @@ | |||
| 1 | + | pub mod pins; | |
| @@ -0,0 +1,31 @@ | |||
| 1 | + | // OLED | |
| 2 | + | pub const OLED_SDA_PIN: i32 = 8; | |
| 3 | + | pub const OLED_SCL_PIN: i32 = 9; | |
| 4 | + | ||
| 5 | + | // NRF24 | |
| 6 | + | pub const CE1_PIN: i32 = 10; | |
| 7 | + | pub const CSN1_PIN: i32 = 11; | |
| 8 | + | ||
| 9 | + | pub const CE2_PIN: i32 = 12; | |
| 10 | + | pub const CSN2_PIN: i32 = 13; | |
| 11 | + | ||
| 12 | + | pub const NRF_SCK: i32 = 18; | |
| 13 | + | pub const NRF_MISO: i32 = 16; | |
| 14 | + | pub const NRF_MOSI: i32 = 17; | |
| 15 | + | ||
| 16 | + | // CC1101 FSPI | |
| 17 | + | pub const CC1101_SCK: i32 = 15; | |
| 18 | + | pub const CC1101_MISO: i32 = 41; | |
| 19 | + | pub const CC1101_MOSI: i32 = 35; | |
| 20 | + | ||
| 21 | + | pub const CC1101_CS: i32 = 40; | |
| 22 | + | pub const CC1101_GDO0: i32 = 39; | |
| 23 | + | pub const CC1101_GDO2: i32 = 42; | |
| 24 | + | ||
| 25 | + | // Buttons | |
| 26 | + | pub const BTN_UP: i32 = 4; | |
| 27 | + | pub const BTN_DOWN: i32 = 5; | |
| 28 | + | pub const BTN_SELECT: i32 = 6; | |
| 29 | + | pub const BTN_BACK: i32 = 7; | |
| 30 | + | pub const BTN_RIGHT: i32 = 1; | |
| 31 | + | pub const BTN_LEFT: i32 = 2; | |
[No content changes]
| @@ -0,0 +1,18 @@ | |||
| 1 | + | use crate::board::pins::*; | |
| 2 | + | ||
| 3 | + | pub struct Display { | |
| 4 | + | } | |
| 5 | + | ||
| 6 | + | impl Display { | |
| 7 | + | pub fn new() -> Self { | |
| 8 | + | Self {} | |
| 9 | + | } | |
| 10 | + | ||
| 11 | + | pub fn init(&mut self) { | |
| 12 | + | log::info!("display Initialized!!"); | |
| 13 | + | } | |
| 14 | + | ||
| 15 | + | pub fn draw_text(&mut self, text: &str) { | |
| 16 | + | log::info!("{}", text); | |
| 17 | + | } | |
| 18 | + | } | |
| @@ -0,0 +1 @@ | |||
| 1 | + | pub mod display; | |
| @@ -1,3 +1,9 @@ | |||
| 1 | + | ||
| 2 | + | mod board; | |
| 3 | + | mod drivers; | |
| 4 | + | ||
| 5 | + | use drivers::display::Display; | |
| 6 | + | ||
| 1 | 7 | fn main() { | |
| 2 | 8 | // It is necessary to call this function once. Otherwise, some patches to the runtime | |
| 3 | 9 | // 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() { | |||
| 6 | 12 | // Bind the log crate to the ESP Logging facilities | |
| 7 | 13 | esp_idf_svc::log::EspLogger::initialize_default(); | |
| 8 | 14 | ||
| 9 | − | log::info!("Hello, world!"); | |
| 15 | + | log::info!("ORION-RF Booted!!"); | |
| 16 | + | let mut display = Display::new(); | |
| 17 | + | ||
| 18 | + | display.init(); | |
| 19 | + | display.draw_text("ORION-RF"); | |
| 20 | + | ||
| 10 | 21 | } | |