Skip to content

Instantly share code, notes, and snippets.

View tstellanova's full-sized avatar
💭
growing excited

Todd Stellanova tstellanova

💭
growing excited
View GitHub Profile
@tstellanova
tstellanova / itm_en.rs
Created March 13, 2020 21:30 — forked from richardeoin/itm_en.rs
Enable ITM output over the SWO pin for STM32H7 parts. The output is manchester coded and can be received by a debugger - eg. blackmagic probe
/// Enables ITM
///
/// If swo_enable is true, then the SWO output pin will be enabled
fn low_level_itm(dbgmcu: &stm32::DBGMCU, swo_enable: bool) {
// ARMv7-M DEMCR: Set TRCENA. Enables DWT and ITM units
unsafe { *(0xE000_EDFC as *mut u32) |= 1 << 24 };
// Ensure debug blocks are clocked before interacting with them
dbgmcu.cr.modify(|_, w| {
w.d1dbgcken()
@tstellanova
tstellanova / STM32H7_SWO_Output_Solution.py
Created February 7, 2020 00:27 — forked from mofosyne/STM32H7_SWO_Output_Solution.py
This generates codes that enables SWO output for STM32H7 and was tested on NUCLEO-H743ZI2. This is required because stm32h7 changed the registers that OpenOCD expects for SWO output.
#!/usr/bin/env python3
"""
# STM32H7 SWO Output Solution
Author: Brian Khuu 2020
Main Copy: https://gist.github.com/mofosyne/178ad947fdff0f357eb0e03a42bcef5c
This generates codes that enables SWO output for STM32H7 and was tested on NUCLEO-H743ZI2.
This is required because stm32h7 changed the registers that OpenOCD expects for SWO output.
Best to use 400Mhz, tried lower... but had issue with getting stable uart output
@tstellanova
tstellanova / broadcastify_listen.py
Created June 25, 2019 13:45 — forked from wiseman/broadcastify_listen.py
Python 3 code for taking an mp3 stream, such as a police scanner feed from broadcastify, and running it through speech recognition.
"""Does utterance segmentation and speech recognition on an mp3 stream
(like from broadcastify...)
Requires that ffmpeg be installed, and a Microsoft cognitive speech
services API key
(see https://azure.microsoft.com/en-us/try/cognitive-services/?api=speech-services).
"""
import audioop
import collections
@tstellanova
tstellanova / Dockerfile-libfaketime
Last active January 17, 2019 04:25 — forked from miguelmota/Dockerfile
Docker faketime lib example
FROM node:8
WORKDIR /
RUN git clone https://github.com/wolfcw/libfaketime.git
WORKDIR /libfaketime/src
RUN make install
WORKDIR /usr/src/app
COPY package.json ./
@tstellanova
tstellanova / rpi3-wap-setup.sh
Last active February 10, 2018 00:11 — forked from Lewiscowles1986/rPi3-ap-setup.sh
Setup RPi3 (Raspberry Pi 3) as a wifi wireless access point (WAP)
#!/bin/bash
#
# Originally for September 2016 rpi jessie image
#
if [ "$EUID" -ne 0 ]
then echo "Must be root"
exit
fi
@tstellanova
tstellanova / bin2elf.sh
Created February 4, 2017 20:56 — forked from tangrs/bin2elf.sh
Convert a memory dump/raw binary image into an ELF file
#!/bin/sh
# Convert a raw binary image into an ELF file suitable for loading into a disassembler
cat > raw$$.ld <<EOF
SECTIONS
{
EOF
echo " . = $3;" >> raw$$.ld
@tstellanova
tstellanova / battery_info.sh
Created December 25, 2016 23:10 — forked from Jooshboy/battery_info.sh
Gets battery status information from an AXP209 PMU via I2C
#!/bin/sh
# This program gets the battery info from PMU
# Voltage and current charging/discharging
#
# Nota : temperature can be more than real because of self heating
#######################################################################
# Copyright (c) 2014 by RzBo, Bellesserre, France
#
# Permission is granted to use the source code within this
# file in whole or in part for any use, personal or commercial,
@tstellanova
tstellanova / install_flatcam.sh
Created September 12, 2016 15:03 — forked from natevw/install_flatcam.sh
how I got FlatCAM 8.1 working on OS X
brew update
brew install pyqt geos spatialindex
easy_install pip
pip install virtualenv
cd Development/Others\'/
mkdir FlatCAM
cd FlatCAM
virtualenv env
source env/bin/activate
@tstellanova
tstellanova / radar.py
Created December 20, 2015 20:37 — forked from cnelson/radar.py
Display radar.weather.gov images on APA102c LEDs via /dev/spidev
#!/usr/bin/env python
"""Display radar.weather.gov images on APA102c LEDs via /dev/SpiDev"""
# stdlib
import argparse
import colorsys
import datetime
import cStringIO as StringIO
import os.path
import sys
#include <SDKDDKVer.h>
#include <Windows.h>
#pragma warning(disable:4819)
#pragma warning(disable:4996)
// for OpenCV2
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/gpu/gpu.hpp"