Skip to content

Commit

Permalink
Use available color conversion from u16
Browse files Browse the repository at this point in the history
  • Loading branch information
tstellanova committed Apr 8, 2020
1 parent d7421d9 commit 3956d50
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions examples/touchpad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use p_hal::{delay::Delay, rng::RngExt, spim, twim};
use cortex_m_rt as rt;
use cortex_m_semihosting::hprintln;
use cst816s::{CST816S};
use embedded_graphics::pixelcolor::Rgb565;
use embedded_graphics::pixelcolor::{raw::RawU16, Rgb565};
use embedded_graphics::{prelude::*, primitives::*, style::*};
use embedded_hal::digital::v2::OutputPin;
use rt::entry;
Expand Down Expand Up @@ -119,11 +119,7 @@ fn main() -> ! {
let mut refresh_count = 0;
loop {
let rand_val = rng.random_u16();
let rand_color = Rgb565::new(
(rand_val >> 11) as u8,
(rand_val >> 5) as u8 & 0x3F,
(rand_val & 0x1F) as u8,
);
let rand_color = Rgb565::from(RawU16::new(rand_val));

if refresh_count > 10000 {
draw_background(&mut display);
Expand Down

0 comments on commit 3956d50

Please sign in to comment.