thumby 0.0.3

Library for TinyCircuits Thumby device
#![no_std]
#![no_main]

use cortex_m::asm;
use thumby::Thumby;
use embedded_graphics::{
    pixelcolor::BinaryColor,
    prelude::*,
    primitives::{Circle, PrimitiveStyleBuilder},
};
// Ensure we halt the program on panic (if we don't mention this crate it won't
// be linked)
use panic_halt as _;

/// The linker will place this boot block at the start of our program image. We
/// need this to help the ROM bootloader get our code up and running.
/// Note: This boot block is not necessary when using a rp-hal based BSP
/// as the BSPs already perform this step.
#[link_section = ".boot2"]
#[used]
pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_GENERIC_03H;

/// Entry point to our bare-metal application.
///
/// The `#[rp2040_hal::entry]` macro ensures the Cortex-M start-up code calls this function
/// as soon as all global variables and the spinlock are initialised.
#[rp2040_hal::entry]
fn main() -> ! {
    let mut thumby = Thumby::new();

    let style = PrimitiveStyleBuilder::new()
        .stroke_width(1)
        .stroke_color(BinaryColor::On)
        .build();

    for i in (4..88).step_by(4) {
        Circle::new(Point::new(36 - i / 2, 20 - i / 2), i as u32)
            .into_styled(style)
            .draw(&mut thumby.display)
            .unwrap();
    }

    thumby.display.flush().unwrap();

     loop {
        asm::wfe();
    }
}