Skip to content

Instantly share code, notes, and snippets.

function rtp = rtp_assign(rtp, param)
% faster impl of `Simulink.BlockDiagram.modifyTunableParameters` for batch
% modification from struct
for i = 1:numel(rtp.parameters)
m = rtp.parameters(i).map;
n = numel(m);
for j = 1:n
k = m(j).ValueIndices;
name = m(j).Identifier;
@summivox
summivox / build.rs
Created August 21, 2023 06:37
Minimal example of DCD support in `imxrt-rs`
use std::io::Result;
use imxrt_ral as ral;
macro_rules! reg_addr {
($block:expr, $reg:ident) => {
unsafe { ::core::ptr::addr_of!((*($block)).$reg) as u32 }
}
}
@summivox
summivox / imxrt-dcd.hexpat
Created August 20, 2023 18:15
ImHex pattern file for i.MX RT1060 series MCU Device Configuration Data (DCD) binary
#pragma endian big
#pragma eval_depth 100
enum CommandType : u8 {
Nop = 0xC0,
Write = 0xCC,
Check = 0xCF,
Dcd = 0xD2,
};
@summivox
summivox / teensy_flexio_ws2812.ino
Created July 15, 2023 09:12
Teensy4.1 FlexIO WS2812B driver
#include <array>
#include "imxrt.h"
constexpr uint8_t kShifterIndex = 0;
constexpr uint8_t kTimerBaudIndex = 0;
constexpr uint8_t kTimerLowIndex = 1;
constexpr uint8_t kTimerHighIndex = 2;
constexpr uint8_t kOutputPin = 0;
constexpr uint8_t kShifterPin = 1;
@summivox
summivox / gpmf.hexpat
Created November 25, 2022 07:37
MP4 & GPMF ImHex Pattern definitions (partial)
#pragma eval_depth 50
#pragma endian big
#include <std/io.pat>
enum GpmfElemType : char {
CONTAINER = '\x00',
COMPLEX = '?',
I8 = 'b',
U8 = 'B',
@summivox
summivox / esp32_i2c_helper.hpp
Last active June 20, 2021 23:50
Thin C++ wrapper for the C API of ESP-IDF I2C master transactions (for ESP32 + ESP-IDF)
#pragma once
#include "driver/i2c.h"
#include "esp_err.h"
#include "freertos/FreeRTOS.h"
/// Thin C++ wrapper for the C API of ESP-IDF I2C master transactions.
///
/// Features:
///
@summivox
summivox / task.hpp
Created February 7, 2021 21:41
FreeRTOS task wrapper base class for ESP32 (C++11 header only)
#pragma once
#include <atomic>
#include "esp_err.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
/// Bare-minimum wrapper base class for a FreeRTOS task. This allows encapsulation of a task
/// alongside with its context.
@summivox
summivox / amznymous.md
Created May 22, 2020 00:31 — forked from bricker/amznymous.md
An Amazon Programmer's Perspective (http://pastebin.com/BjD84BQ3)

Originally posted at http://pastebin.com/BjD84BQ3

Trigger warning: mention of suicidal ideation

tl;dr: I burned out as a developer at Amazon at the end of my second year. I’ve since found a healthy and sustainable work-life balance and enjoy work again. I write this to A) raise awareness, especially for new-hires and their families, and B) help give hope and advice to people going through the same at Amazon or other companies.

Hello, world

There’s been no shortage of anecdotes, opinions, and rebuttals regarding Amazon’s corporate culture as of late. I write this not to capitalize on the latest news-feed fad, but to share what I had already written and promptly deleted. I didn’t think anyone would want to hear my story, but it’s apparent people are going through a similar experience and don’t have a voice.

I’m a Software Development Engineer II at Amazon; SDE II basically means a software developer with at least 2–3 years of industry experience. I started at Amazon as an SDE I.

@summivox
summivox / fanatec_shifter.ino
Last active December 10, 2023 15:50
DIY USB adapter for Fanatec ClubSport Shifter SQ v1.5 (Arduino Due)
#include <cstdint>
#include "Joystick.h"
const int16_t gate_r = 3340;
const int16_t gate_12 = 2690;
const int16_t gate_34 = 2000;
const int16_t gate_56 = 1230;
const int16_t gate_7 = 550;
@summivox
summivox / untz-4.6.cfg
Created October 21, 2017 02:44
XHRA-2HPA configuration file for Untz v4.6
# vim: ft=python
from itertools import chain
def flatten(x):
return list(chain.from_iterable(x))
G = globals()
# USB Identification