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
class Singleton { | |
public: | |
static Singleton& instance() { | |
static Singleton instance_; | |
return instance_; | |
} | |
private: // use protected: if it should be inherited from | |
Singleton() = default; | |
~Singleton() = default; |
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
1738.721042] usb 5-1.3: new high-speed USB device number 9 using xhci_hcd | |
[ 1738.821241] usb 5-1.3: New USB device found, idVendor=1a40, idProduct=0101 | |
[ 1738.821244] usb 5-1.3: New USB device strings: Mfr=0, Product=1, SerialNumber=0 | |
[ 1738.821245] usb 5-1.3: Product: USB 2.0 Hub | |
[ 1738.849689] hub 5-1.3:1.0: USB hub found | |
[ 1738.849717] hub 5-1.3:1.0: 4 ports detected | |
[ 1739.137051] usb 5-1.3.1: new full-speed USB device number 10 using xhci_hcd | |
[ 1739.603519] usb 5-1.3.1: New USB device found, idVendor=0403, idProduct=6001 | |
[ 1739.603522] usb 5-1.3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 | |
[ 1739.603523] usb 5-1.3.1: Product: FT232R USB UART |
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
(gdb) set debug remote 1 | |
(gdb) start | |
The program being debugged has been started already. | |
Start it from the beginning? (y or n) y | |
Sending packet: $k#6b...Ack | |
Sending packet: $?#3f...Ack | |
Packet received: W00 | |
Sending packet: $Hg0#df...Ack | |
Packet received: | |
Sending packet: $qXfer:memory-map:read::0,3fb#e5...Ack |
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); |
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
// | |
// 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
/// 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
#!/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
#!/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
//! main.rs | |
#![no_main] | |
#![no_std] | |
use core::{ | |
cell::RefCell, | |
marker::{Send, Sync}, | |
}; | |
use cortex_m::interrupt::CriticalSection; |
OlderNewer