Skip to content

Instantly share code, notes, and snippets.

macro_rules! println {
($($arg:tt)*) => {
cortex_m::interrupt::free(|_| {
let itm = unsafe { &mut *cortex_m::peripheral::ITM::ptr() };
cortex_m::iprintln!(&mut itm.stim[0], $($arg)*);
});
}
}
macro_rules! println {
($($arg:tt)*) => {
cortex_m::interrupt::free(|_| {
let itm = unsafe { &mut *cortex_m::peripheral::ITM::ptr() };
cortex_m::iprintln!(&mut itm.stim[0], $($arg)*);
});
}
}
use core::{cmp, mem, ptr, slice};
use usb_device::class_prelude::*;
use usb_device::Result;
use crate::cdc_acm::*;
use stlinky::sprintln;
// TODO: Replace this buffer with something that memmoves less, maybe a bip-buffer.
struct Buffer {
data: [u8; 128],
function Example() {
const [count, setCount] = useState(0);
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>
Click me
</button>
</div>
# not usable as-is but has all the correct version numbers in case they make a difference
[package]
name = "usb-tests"
version = "0.1.0"
authors = ["Matti Virkkunen <[email protected]>"]
edition = "2018"
[dependencies]
bare-metal = "0.2.4"
root@router:/etc/config# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 84.250.112.1 0.0.0.0 UG 0 0 0 veth2
10.137.1.0 0.0.0.0 255.255.255.0 U 0 0 0 br-private
10.137.2.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0-2
10.137.3.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
84.250.112.0 0.0.0.0 255.255.240.0 U 0 0 0 veth0
84.250.112.0 0.0.0.0 255.255.240.0 U 0 0 0 veth1
84.250.112.0 0.0.0.0 255.255.240.0 U 0 0 0 veth2
sink="$1"
card="alsa_output.pci-0000_00_1b.0.analog-surround-71"
pactl set-default-sink "$sink"
pactl list short sink-inputs|while read input; do
id=$(echo "$input"| cut -f1)
driver=$(echo "$input" | cut -f4)
if [[ $driver == *remap-sink* ]]; then
#ifndef F_CPU
#define F_CPU 8000000UL
#endif
#include <stdint.h>
#include <stdlib.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <avr/sleep.h>
matti@yuno:~/devel/armwat/target/thumbv7m-none-eabi/release/deps$ cat armwat-f6e0bc02c29dab2b.ll
; ModuleID = 'armwat.3vuafqk3-cgu.0'
source_filename = "armwat.3vuafqk3-cgu.0"
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "thumbv7m-none--eabi"
%"core::panic::PanicInfo" = type { [0 x i32], { {}*, [4 x i32]* }, [0 x i32], i32*, [0 x i32], %"core::panic::Location", [0 x i32] }
%"core::panic::Location" = type { [0 x i32], { [0 x i8]*, i32 }, [0 x i32], i32, [0 x i32], i32, [0 x i32] }
@0 = private unnamed_addr constant <{ [27 x i8] }> <{ [27 x i8] c"cell not mutably borrowable" }>, align 1
matti@yuno:~/devel/armwat$ cargo +nightly build --release
warning: unused manifest key: profile.debug
warning: use `[profile.dev]` to configure debug builds
Compiling armwat v0.1.0 (file:///home/matti/devel/armwat)
warning: field is never used: `value`
--> src/main.rs:27:5
|
27 | value: u32,
| ^^^^^^^^^^
|