This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! `rtic_sync::arbiter::Arbiter`-based shared bus `SpiDevice` implementation. | |
// TODO: upstream to rtic-sync | |
use embedded_hal::digital::OutputPin; | |
use embedded_hal_async::{ | |
delay::DelayUs, | |
spi::{ErrorType, Operation, SpiBus, SpiDevice}, | |
}; | |
use embedded_hal_bus::spi::DeviceError; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RTIC Monotonic impl for the RTCs | |
use crate::hal::pac::{rtc0, RTC0, RTC1, RTC2}; | |
pub use fugit::{self, ExtU32}; | |
use rtic_monotonic::Monotonic; | |
pub struct MonoRtc<T: InstanceRtc> { | |
overflow: u8, | |
rtc: T, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Flashing /home/emifre/Git/widefind/anchor_cable/firmware/binary/target/thumbv7em-none-eabihf/release/anchor-cable-firmware | |
DEBUG jaylink > libusb 1.0.23.11397 | |
DEBUG jaylink > libusb has capability API: true | |
DEBUG jaylink > libusb has HID access: true | |
DEBUG jaylink > libusb has hotplug support: true | |
DEBUG jaylink > libusb can detach kernel driver: true | |
DEBUG probe_rs::probe::daplink::tools > Could not open 1209:da42 in CMSIS-DAP v2 mode | |
DEBUG probe_rs::probe::daplink::tools > Attempting to open 1209:da42 in CMSIS-DAP v1 mode | |
TRACE probe_rs::probe::daplink::commands > Send buffer: [00, 11, 00, 12, 7A, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00] | |
TRACE probe_rs::probe::daplink::commands > Receive buffer: [11, 00, 00, 00, 00, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! main.rs | |
#![no_main] | |
#![no_std] | |
use core::{ | |
cell::RefCell, | |
marker::{Send, Sync}, | |
}; | |
use cortex_m::interrupt::CriticalSection; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys, math | |
import pcbnew | |
""" | |
This is a script which adds the die to pad lengths to a package in a PCB design. | |
Based on the script here: https://forum.kicad.info/t/die-length-doesnt-seem-to-work/786 | |
By Emil Fresk (@korken89), https://www.github.com/korken89 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import os | |
import re | |
import time | |
import pcbnew | |
""" | |
This is a modified version of https://github.com/mithro/kicad-length-matching-checks.git | |
which also adds in the "Pad to die length" into the calculations (plus different formating). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Trait for implementing WideSlice | |
pub trait ToWideSlice<'a> { | |
fn to_wideslice(&'a mut self) -> WideSlice<'a>; | |
} | |
/// The platform independent data storage | |
#[derive(Debug)] | |
pub struct WideSlice<'a> { | |
slices: &'a mut [*mut f64], | |
len: usize, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Sin functions | |
// | |
const S1: f64 = -0.166666666416265235595; /* -0x15555554cbac77.0p-55 */ | |
const S2: f64 = 0.0083333293858894631756; /* 0x111110896efbb2.0p-59 */ | |
const S3: f64 = -0.000198393348360966317347; /* -0x1a00f9e2cae774.0p-65 */ | |
const S4: f64 = 0.0000027183114939898219064; /* 0x16cd878c3b46a7.0p-71 */ | |
pub fn k_sinf(x: f64) -> f32 { | |
let z = x * x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const S1: f64 = -0.166666666416265235595; /* -0x15555554cbac77.0p-55 */ | |
const S2: f64 = 0.0083333293858894631756; /* 0x111110896efbb2.0p-59 */ | |
const S3: f64 = -0.000198393348360966317347; /* -0x1a00f9e2cae774.0p-65 */ | |
const S4: f64 = 0.0000027183114939898219064; /* 0x16cd878c3b46a7.0p-71 */ | |
pub fn k_sinf(x: f64) -> f32 { | |
let z = x * x; | |
let w = z * z; | |
let r = S3 + z * S4; | |
let s = z * x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate rand; | |
use rand::Rng; | |
use std::cmp::Ordering; | |
use std::io; | |
fn main() { | |
println!("Guess the number!"); | |
let secret_number = rand::thread_rng().gen_range(1, 101); |
NewerOlder