Skip to content

Instantly share code, notes, and snippets.

View bagbag's full-sized avatar

Patrick Hein bagbag

View GitHub Profile
@bagbag
bagbag / trace.rs
Created April 3, 2025 12:51
embassy trace
use core::sync::atomic::{AtomicU32, Ordering};
use defmt::trace;
use embassy_sync::{
blocking_mutex::{CriticalSectionMutex, raw::CriticalSectionRawMutex},
signal::Signal,
};
use embassy_time::{Duration, Instant};
use heapless::Vec;
// type PendingTasksMap = FnvIndexMap<u32, TaskInstant, 16>;
@bagbag
bagbag / stepper_decoder.rs
Created March 26, 2025 16:24
stepper decoder
use embassy_futures::select::{Either, select, select_array};
use embassy_time::Timer;
use esp_hal::{
gpio::{Input, InputConfig, InputPin, Pull},
peripheral::Peripheral,
};
const STATE_A: u8 = 0b1000;
const STATE_AB: u8 = 0b1100;
const STATE_B: u8 = 0b0100;
@bagbag
bagbag / cloudSettings
Last active October 8, 2021 09:58
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-10-08T09:58:29.031Z","extensionVersion":"v3.4.3"}
(<any>Symbol).asyncIterator = Symbol.asyncIterator || Symbol.for("Symbol.asyncIterator");
const sleep = async (ms: number) => new Promise((resolve, reject) => setTimeout(() => resolve(), ms));
class TestClass {
private awaitable = Promise.resolve([1, 2, 3, 4, 5]);
async *count(count: number): AsyncIterableIterator<number> {
for (let i = 0; i < count; i++) {
yield* (async function* () {
await sleep(100);
@bagbag
bagbag / index.html
Last active October 29, 2023 10:20
MediathekViewWeb API Samplecode
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>MediathekViewWeb API</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>