Skip to content

Instantly share code, notes, and snippets.

View diondokter's full-sized avatar

Dion Dokter diondokter

View GitHub Profile
@diondokter
diondokter / timestamp_check.cpp
Created January 30, 2024 09:16
Timestamp check
// main.cpp in a Console App project.
#include <stdio.h>
#include <winsock2.h>
#include <iphlpapi.h>
#pragma comment(lib, "Iphlpapi")
BOOL
IsPTPv2HardwareTimestampingSupportedForIPv4(PINTERFACE_TIMESTAMP_CAPABILITIES timestampCapabilities)
{
@diondokter
diondokter / On a changing world.md
Last active January 22, 2024 11:17
Why is it that suddenly everything started changing?

On a changing world

For the first time ever I felt something was off.
Something was changing.
That something turns out to be world.

Ukraine, Gaza, AI, climate change and ever more popular authoritarianism in democratic countries.

Why is it that suddenly everything started moving and shifting?

Running `target\debug\probe-rs-cli.exe download --chip nrf9160 ..\TG\dis-workspace\artifacts\bootloader\dis-bootloader-feather.elf`
DEBUG probe_rs::config::registry > Searching registry for chip with name nrf9160
DEBUG probe_rs::config::registry > Partial match for chip name: nRF9160_xxAA
WARN probe_rs::config::registry > Found chip nRF9160_xxAA which matches given partial name nrf9160. Consider specifying its full name.
WARN probe_rs::config::registry > Matching nrf9160 based on wildcard. Consider specifying the chip as nRF9160_xxAA instead.
WARN probe_rs::config::target > Using custom sequence for nRF9160
DEBUG probe_rs::probe::cmsisdap::tools > Searching for CMSIS-DAP probes using libusb
DEBUG probe_rs::probe::cmsisdap::tools > Found 0 CMSIS-DAP probes using libusb, searching HID
DEBUG probe_rs::probe::cmsisdap::tools > Found 0 CMSIS-DAP probes total
DEBUG jaylink > libusb 1.0.26.11724
DEBUG probe_rs::architecture::arm::ap > Writing register TAR, value=TAR { address: e000201c }
DEBUG probe_rs::probe::cmsisdap > Adding command to batch: Write(port=AccessPort, addr=4, data=0xe000201c
DEBUG probe_rs::architecture::arm::ap > Reading register DRW
DEBUG probe_rs::probe::cmsisdap > Adding command to batch: Read(port=AccessPort, addr=12)
DEBUG probe_rs::probe::cmsisdap > 2 items in batch
DEBUG probe_rs::probe::cmsisdap > Attempting batch of 2 items
TRACE probe_rs::probe::cmsisdap::commands > Transmit buffer: [00, 05, 00, 02, 05, 1C, 20, 00, E0, 0F]...
TRACE probe_rs::probe::cmsisdap::commands > Receive buffer: [05, 02, 01, FE, FF, FF, FF]...
DEBUG probe_rs::probe::cmsisdap > 2 of batch of 2 items suceeded
TRACE probe_rs::p
pub struct LocalTimer {
local_timer: TIM5,
overflows: u32,
next_compare_value: Option<u64>,
}
impl LocalTimer {
const CLOCK_SPEED: u32 = 240_000_000;
const CLOCK_DIVIDER: u16 = 1;
const TIMER_SPEED: u32 = Self::CLOCK_SPEED / Self::CLOCK_DIVIDER as u32;
@diondokter
diondokter / lib.rs
Created July 18, 2020 09:34
Final rust code for Oxidize talk of Dion Dokter: How can we write the best device driver?
use std::marker::PhantomData;
// -------------------- HARDWARE INTERFACE --------------------
pub trait Interface {
fn enable_cs(&mut self);
fn disable_cs(&mut self);
fn transfer(&mut self, value: u8) -> u8;
}
// -------------------- LOW LEVEL DEVICE INTERFACE --------------------
@diondokter
diondokter / README.md
Last active August 4, 2020 23:03
STM32H7 ITM setup

ITM setup for the STM32H7 with OpenOCD

Currently the ITM is broken. This is my current setup.

  • VSCode with Cortex Debug plugin
  • STM32H743

Both .cfg files are put in the project folder so OpenOCD can find them.