Skip to content

Commit

Permalink
Executed make prepush
Browse files Browse the repository at this point in the history
  • Loading branch information
CristianSLazar committed Jan 19, 2024
1 parent a1e212e commit 65f6426
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 25 deletions.
6 changes: 3 additions & 3 deletions boards/components/src/bus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ macro_rules! spi_bus_component_static {

#[macro_export]
macro_rules! i2c_master_bus_component_static {
() => {{
($I:ty $(,)?) => {{
let address_buffer = kernel::static_buf!([u8; 1]);
let bus = kernel::static_buf!(capsules_extra::bus::I2CMasterBus<'static>);
let bus = kernel::static_buf!(capsules_extra::bus::I2CMasterBus<'static, $I>);
let i2c_device =
kernel::static_buf!(capsules_core::virtualizers::virtual_i2c::I2CDevice<'static>);
kernel::static_buf!(capsules_core::virtualizers::virtual_i2c::I2CDevice<'static, $I>);

(bus, i2c_device, address_buffer)
};};
Expand Down
4 changes: 2 additions & 2 deletions boards/components/src/graphic_display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
//! .finalize(components::graphic_display_component_static!(40960));
//! ```
use core::mem::MaybeUninit;
use capsules_extra::graphic_display::GraphicDisplay;
use kernel::hil::display;
use core::mem::MaybeUninit;
use kernel::capabilities;
use kernel::component::Component;
use kernel::create_capability;
use kernel::hil::display;

#[macro_export]
macro_rules! graphic_display_component_static {
Expand Down
2 changes: 1 addition & 1 deletion boards/components/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ pub mod si7021;
pub mod siphash;
pub mod sound_pressure;
pub mod spi;
pub mod st77xx;
pub mod ssd1306;
pub mod st77xx;
pub mod temperature;
pub mod temperature_rp2040;
pub mod temperature_stm;
Expand Down
4 changes: 2 additions & 2 deletions boards/components/src/ssd1306.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::mem::MaybeUninit;
use capsules_extra::bus;
use capsules_extra::ssd1306;
use core::mem::MaybeUninit;
use kernel::component::Component;
use kernel::deferred_call::DeferredCall;
use kernel::deferred_call::DeferredCallClient;
Expand Down Expand Up @@ -97,7 +97,7 @@ impl<B: 'static + bus::Bus<'static>> Component for SSD1306Component<B> {
));
self.bus.set_client(ssd1306);

// todo remove ssd1306.initialize_callback_handle(self.deferred_caller.register(ssd1306).unwrap());
// todo remove ssd1306.initialize_callback_handle(self.deferred_caller.register(ssd1306).unwrap());

ssd1306.register();
ssd1306
Expand Down
29 changes: 18 additions & 11 deletions boards/nucleo_f429zi/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ struct NucleoF429ZI {
'static,
stm32f429zi::rtc::Rtc<'static>,
>,
display: &'static capsules_extra::graphic_display::GraphicDisplay<'static>,
}

/// Mapping of integer syscalls to objects that implement syscalls.
Expand Down Expand Up @@ -638,23 +639,28 @@ pub unsafe fn main() {

// I2C SSD1306 screen
let i2c_mux = components::i2c::I2CMuxComponent::new(&peripherals.stm32f4.i2c1, None).finalize(
components::i2c_mux_component_static!(stm32f4xx::i2c::I2C<'static>));
// static_init!(
// MuxI2C<'static, stm32f4xx::i2c::I2C>,
// MuxI2C::new(&peripherals.stm32f4.i2c1, None)
// );
components::i2c_mux_component_static!(stm32f4xx::i2c::I2C<'static>),
);
kernel::deferred_call::DeferredCallClient::register(i2c_mux);

//todo: bus initialization
let bus = components::bus::I2CMasterBusComponent::new(
i2c_mux,
capsules_extra::ssd1306::SLAVE_ADDRESS_WRITE,
)
.finalize(components::i2c_master_bus_component_static!()); //todo

let ssd1306_screen = components::ssd1306::SSD1306Component::new(bus)
.finalize(components::ssd1306_component_static!(
capsules_extra::bus::I2CMasterBus<'static, capsules_core::virtualizers::virtual_i2c::I2CDevice<'static, stm32f4xx::i2c::I2C>>,
));
.finalize(components::i2c_master_bus_component_static!());

let ssd1306_screen = components::ssd1306::SSD1306Component::new(bus).finalize(
components::ssd1306_component_static!(
capsules_extra::bus::I2CMasterBus<
'static,
capsules_core::virtualizers::virtual_i2c::I2CDevice<
'static,
stm32f4xx::i2c::I2C<'static>,
>,
>,
),
);

let _ = ssd1306_screen.init();

Expand Down Expand Up @@ -702,6 +708,7 @@ pub unsafe fn main() {
systick: cortexm4::systick::SysTick::new(),
can: can,
date_time,
display,
};

// // Optional kernel tests
Expand Down
2 changes: 1 addition & 1 deletion capsules/extra/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ pub mod sht4x;
pub mod si7021;
pub mod sip_hash;
pub mod sound_pressure;
pub mod st77xx;
pub mod ssd1306;
pub mod st77xx;
pub mod symmetric_encryption;
pub mod temperature;
pub mod temperature_rp2040;
Expand Down
6 changes: 2 additions & 4 deletions capsules/extra/src/ssd1306.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ use kernel::{
ErrorCode,
};

use kernel::deferred_call::{
DeferredCall, DeferredCallClient
};
use kernel::deferred_call::{DeferredCall, DeferredCallClient};

use crate::bus::{self, Bus, BusWidth};
use core::cell::Cell;
use kernel::hil::display::{
Align, FrameBuffer, FrameBufferClient, FrameBufferSetup, GraphicsFrame, GraphicsMode,
PixelFormat, Point, Rotation, Screen, ScreenClient, Tile,
};
use core::cell::Cell;

pub const SLAVE_ADDRESS_WRITE: u8 = 0b0111100;
pub const SLAVE_ADDRESS_READ: u8 = 0b0111101;
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/hil/display.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Interface for screens and displays.
use crate::ErrorCode;
use core::ops::Add;
use core::ops::Sub;
use crate::ErrorCode;

pub const MAX_BRIGHTNESS: u16 = 65535;

Expand Down

0 comments on commit 65f6426

Please sign in to comment.