Skip to content

Instantly share code, notes, and snippets.

View jamwaffles's full-sized avatar
💼
Hireable - Rust full time or part time

James Waples jamwaffles

💼
Hireable - Rust full time or part time
View GitHub Profile
//! Interface factory
//!
//! This is the easiest way to create a driver instance. You can set various parameters of the
//! driver and give it an interface to use. The builder will return a
//! [`mode::RawMode`](../mode/raw/struct.RawMode.html) object which you should coerce to a richer
//! display mode, like [mode::Graphics](../mode/graphics/struct.GraphicsMode.html) for drawing
//! primitives and text.
//!
//! # Examples
//!
#![no_std]
#![no_main]
use panic_semihosting as _;
use rtfm::app;
use stm32f1xx_hal::{
device, gpio,
gpio::{gpioc::PC13, Edge, ExtiPin, Output, PushPull, State},
prelude::*,
stm32,
linux_steps: &linux_steps
docker:
- image: cimg/rust:1.47.0
steps:
- checkout
- restore_cache:
keys:
- v1-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cargo.lock" }}
- run: ./linux_build_script_1_here.sh
- run: ./linux_build_script_2_here.sh
@jamwaffles
jamwaffles / docker-compose.yml
Created December 6, 2020 22:03
Grafana + Postgres
version: "3"
services:
adminer:
image: adminer:4.7.7
ports:
- "8081:8080"
networks:
- bbench
postgres:
@jamwaffles
jamwaffles / monotonic.rs
Created May 10, 2021 09:26
L0xx monotonic impl for TIM2
use rtic::{rtic_monotonic::Clock, Monotonic};
use stm32l0xx_hal::pac::TIM2;
pub struct Tim2Monotonic {
local_timer: TIM2,
overflows: u16,
next_compare_value: Option<u32>,
}
impl Tim2Monotonic {
@jamwaffles
jamwaffles / monotonic.rs
Created September 13, 2021 08:20
32 bit monotonic from STM32Lxx 16 bit timer
use core::convert::TryFrom;
use embedded_time::rate::{Extensions, Hertz};
use rtic::{rtic_monotonic::Clock, Monotonic};
use stm32l0xx_hal::{
pac::{TIM2, TIM21, TIM22, TIM3},
rcc::Rcc,
};
pub trait TimExt {
fn configure(&mut self, rcc: &mut Rcc, frequency: Hertz);