Skip to content

Instantly share code, notes, and snippets.

@charleskeepax
charleskeepax / axes.h
Last active December 21, 2015 06:09
Configuration examples for joytokey
static struct axis_map axes[] = {
[0] = {
.min_threshold = -32767,
.min_key = { .sym = XK_Left },
.max_threshold = 32767,
.max_key = { .sym = XK_Right },
},
[1] = {
.min_threshold = -32767,
.min_key = { .str = "p" },
@charleskeepax
charleskeepax / ihex.vim
Created January 23, 2012 22:28
Vim Script Intel HEX Checksum
function IHexChecksum()
let l:data = getline(".")
let l:dlen = strlen(data)
if (empty(matchstr(l:data, "^:\\(\\x\\x\\)\\{5,}$")))
echoerr("Input is not a valid Intel HEX line!")
return
endif
let l:byte = 0
@charleskeepax
charleskeepax / code_duplication.cpp
Created July 9, 2011 23:59
Embedded C++ issues.
template <typename T>
class Foo {
public:
void Get(T in) {
}
void Bar() {
}
};
int main() {
@charleskeepax
charleskeepax / part1.c
Created November 22, 2010 11:33
Blackfin Deep Sleep with RTC Stopwatch Wakeup
// ISTAT Register Bit Definitions
#define RTC_INT_CLEAR 0x807F
#define RTC_WRITE_COMPLETE 0x8000
// PREN Register Bit Definitions
#define RTC_PRESCALER_ENABLE 0x0001
void Init_RTC(void)
{
// Ensure clock is running at 1Hz by setting the prescalar