regenerate cargo.lock and make clippy happy

This commit is contained in:
Sebastian Hugentobler 2024-09-25 14:04:01 +02:00
parent 19202249b9
commit 22d5f33541
Signed by: shu
GPG Key ID: BB32CF3CA052C2F0
4 changed files with 1087 additions and 15 deletions

1077
display/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -38,8 +38,9 @@ const SET_DDRAM_ADDR: u8 = 0x80;
const EN: u8 = 0b000_00100; const EN: u8 = 0b000_00100;
const RS: u8 = 0b000_00001; const RS: u8 = 0b000_00001;
const ROWS: usize = 2;
const LINE_LENGTH: usize = 16; const LINE_LENGTH: usize = 16;
const LINE_OFFSETS: [u8; 2] = [0x00, 0x40]; const LINE_OFFSETS: [u8; ROWS] = [0x00, 0x40];
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub enum Lines { pub enum Lines {
@ -49,7 +50,7 @@ pub enum Lines {
pub struct Lcd<'a> { pub struct Lcd<'a> {
i2c: Twim<'a, TWISPI0>, i2c: Twim<'a, TWISPI0>,
lines: [&'a str; 2], lines: [&'a str; ROWS],
address: u8, address: u8,
} }
@ -125,13 +126,11 @@ impl<'a> Lcd<'a> {
} }
async fn write_buffer(&mut self) -> Result<(), twim::Error> { async fn write_buffer(&mut self) -> Result<(), twim::Error> {
for line in 0..2 { #[allow(clippy::needless_range_loop)]
let mut position = 0; for line in 0..ROWS {
for (position, c) in self.lines[line].chars().enumerate() {
for c in self.lines[line].chars() { self.write_character(c, position as u8, LINE_OFFSETS[line])
self.write_character(c, position, LINE_OFFSETS[line])
.await?; .await?;
position += 1;
} }
} }
@ -146,7 +145,8 @@ impl<'a> Lcd<'a> {
} }
async fn set_cursor(&mut self, position: u8, line_offset: u8) -> Result<(), twim::Error> { async fn set_cursor(&mut self, position: u8, line_offset: u8) -> Result<(), twim::Error> {
self.cmd(SET_DDRAM_ADDR | line_offset + position, 0).await?; self.cmd(SET_DDRAM_ADDR | (line_offset + position), 0)
.await?;
Ok(()) Ok(())
} }

View File

@ -1,16 +1,11 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use core::cell::Cell;
use ble::gatt::Server; use ble::gatt::Server;
use cortex_m::interrupt::Mutex;
use defmt_rtt as _; use defmt_rtt as _;
use embassy_nrf as _; use embassy_nrf as _;
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
use embassy_time::Delay; use embassy_time::Delay;
use embedded_hal_async::delay::DelayNs; use embedded_hal_async::delay::DelayNs;
use flash::Config;
use futures::pin_mut; use futures::pin_mut;
use nrf_softdevice::{Flash, Softdevice}; use nrf_softdevice::{Flash, Softdevice};
use panic_probe as _; use panic_probe as _;

View File

@ -34,7 +34,7 @@ fn configure(device_name: &str) -> nrf_softdevice::Config {
_bitfield_1: raw::ble_gap_cfg_role_count_t::new_bitfield_1(0), _bitfield_1: raw::ble_gap_cfg_role_count_t::new_bitfield_1(0),
}), }),
gap_device_name: Some(raw::ble_gap_cfg_device_name_t { gap_device_name: Some(raw::ble_gap_cfg_device_name_t {
p_value: device_name.as_bytes().as_ptr() as *const u8 as _, p_value: device_name.as_bytes().as_ptr() as _,
current_len: 9, current_len: 9,
max_len: 9, max_len: 9,
write_perm: unsafe { mem::zeroed() }, write_perm: unsafe { mem::zeroed() },