Skip to content

Instantly share code, notes, and snippets.

@fpigerre
fpigerre / interrupts.md
Last active April 17, 2022 23:31
Timer/Counter and Interrupt cheat-sheets for the Atmel ATMega324A microcontroller

AVR Interrupts

Each of the pins on the AVR may have multiple functions. For example, pin D0 and D1 are able to serve as receive and transmit pins for serial port one, respectively. Similarly, a number of pins on the AVR are able to transmit interrupt requests to the CPU when they receive a particular signal. How to implement this functionality is shown below.

Register Summary

Register Name Purpose of Register
PCICR Pin Change Interrupt Control Register (Enable interrupts for a particular set of PCINT ports)
PCIFR Pin Change Interrupt Flag Register (When a logic change triggers an interrupt on a particular PCINT pin, the corresponding flag will be set)
PCMSK0 Pin Change Mask Register (Select whether interrupts are enabled on a particular PCINT pin)
@fpigerre
fpigerre / operations.asm
Last active January 17, 2022 13:28
Common multi-byte operations in Assembly for the Atmel AVR instruction set
; Include constants for the ATMega324A micro-controller
; This file defines register names and names for I/O ports
.include "m324adef.inc"
; Attempt to perform operations on multi-byte values
; It is assumed the following values are unsigned
; First value = r15:r14 = 0xF8AD
; Second value = r17:r16 = 0xFFDE
START:
ldi r19, 0xF8
@fpigerre
fpigerre / gulpfile.js
Last active December 20, 2016 05:35
Configuration files that could be used to automate Semantic-UI installation for 2factorauth/twofactorauth.
var gulp = require('gulp');
var uncss = require('gulp-uncss');
var spawn = require('child_process').spawn;
var cleanCSS = require('gulp-clean-css');
gulp.task('default', function() {
console.log("### Please run 'gulp build', then 'gulp clean'.");
});
gulp.task('build', function() {
@fpigerre
fpigerre / app.js
Created January 13, 2016 07:06
This JavaScript file implements the functionality contained within the new layout of the TwoFactorAuth website -- https://twofactorauth.org.
// When DOM elements are ready, excluding images
$(document).ready(function () {
// Check if URL references specific category
if (window.location.hash && window.location.hash.indexOf('#') > -1) {
openCategory(window.location.hash.substring(1));
}
// Unveil images 50px before they appear
$('img').unveil(50);
});
<text>
```java
<code>
```
(Documentation [here](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown))
@fpigerre
fpigerre / metro.scss
Created June 11, 2015 08:44
SASS styling of metro-like interface
#metro {
color: white;
display: table;
float: right;
height: 30%;
margin-top: 20px;
width: 75%;
@for $i from 1 through length($colors) {
.metro-box:nth-of-type(#{$i}) {
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
@fpigerre
fpigerre / crash.log
Created October 22, 2014 10:53
Error logs and StackTraces pertaining to a crash that occurs when uSkyBlock 1.1.0-u is loaded. More information can be found at https://github.com/AEMNetwork/Issues/issues/4
[22:58:52 ERROR]: ------------------------------
[22:58:52 ERROR]: Current Thread: Server console handler
[22:58:52 ERROR]: PID: 19 | Suspended: false | Native: true | State: RUNNABLE
[22:58:52 ERROR]: Thread is waiting on monitor(s):
[22:58:52 ERROR]: Locked on:java.io.BufferedInputStream.read(BufferedInputStream.java:265)
[22:58:52 ERROR]: Locked on:org.bukkit.craftbukkit.libs.jline.internal.InputStreamReader.read(InputStreamReader.java:267)
[22:58:52 ERROR]: Locked on:org.bukkit.craftbukkit.libs.jline.internal.InputStreamReader.read(InputStreamReader.java:204)
[22:58:52 ERROR]: Stack:
[22:58:52 ERROR]: java.io.FileInputStream.readBytes(Native Method)
[22:58:52 ERROR]: java.io.FileInputStream.read(FileInputStream.java:234)
@fpigerre
fpigerre / gitchainerror.log
Created May 23, 2014 07:18
An error that occurred when running 'make' on a GitChain fork.
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
C:\Users\psgs\Documents\GitHub\gitchain [master]> make prepare
C:\Users\psgs\Documents\GitHub\gitchain [master]> make
main.go:14:2: cannot find package "github.com/gitchain/gitchain/server" in any o
f:
C:\Go\src\pkg\github.com\gitchain\gitchain\server (from $GOROOT)
C:\Users\psgs\GoRoot\src\github.com\gitchain\gitchain\server (from $
GOPATH)
@fpigerre
fpigerre / animation.js
Created May 17, 2014 01:54
Minecraftt JavaScript Skin Animation
/**
* Code by djazz as part of his Minecraft Skin Viewer
* http://djazz.mine.nu/apps/MinecraftSkin/
*/
var MSP = (function (global, undefined) {
'use strict';
// shim layer with setTimeout fallback
window.requestAnimFrame = (function () {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||