Skip to content

Instantly share code, notes, and snippets.

View jboone's full-sized avatar

Jared Boone jboone

View GitHub Profile
@jboone
jboone / sgpio.c
Created October 10, 2012 20:17
SGPIO Source Code
void sgpio_irqhandler() {
SGPIO_CLR_STATUS_1 = 0xFFFFFFFF;
uint32_t* const p32 = &usb_bulk_buffer[buffer_offset];
volatile const uint32_t* const sgpio_reg_ss_base = SGPIO_PORT_BASE + 0x100;
p32[7] = SGPIO_REG_SS(SGPIO_SLICE_A);
p32[6] = SGPIO_REG_SS(SGPIO_SLICE_I);
p32[5] = SGPIO_REG_SS(SGPIO_SLICE_E);
p32[4] = SGPIO_REG_SS(SGPIO_SLICE_J);
@jboone
jboone / bit_band_peripheral.c
Created June 5, 2012 18:43
LPC43xx code for configuring Si5351 and internal clock tree.
volatile uint_fast8_t* peripheral_bitband_address(volatile void* const address, const uint_fast8_t bit_number) {
const uint32_t bit_band_base = 0x42000000;
const uint32_t byte_offset = (uint32_t)address - 0x40000000;
const uint32_t bit_word_offset = (byte_offset * 32) + (bit_number * 4);
const uint32_t bit_word_address = bit_band_base + bit_word_offset;
return (volatile uint_fast8_t*)bit_word_address;
}
void peripheral_bitband_set(volatile void* const peripheral_address, const uint_fast8_t bit_number) {
volatile uint_fast8_t* const bitband_address = peripheral_bitband_address(peripheral_address, bit_number);
@jboone
jboone / kicad-boost-polygon-sort-adaptor.patch
Created May 21, 2012 16:51
KiCAD and wxWidgets patches to build on Mac OS X and add my hacked-in "magnify" touchpad support
=== modified file 'include/boost/polygon/polygon.hpp'
--- include/boost/polygon/polygon.hpp 2012-05-16 01:42:04 +0000
+++ include/boost/polygon/polygon.hpp 2012-05-21 06:11:22 +0000
@@ -23,6 +23,7 @@
#include "transform.hpp"
#include "detail/transform_detail.hpp"
+#include "detail/polygon_sort_adaptor.hpp"
//interval
@jboone
jboone / lsusb -v of Jellybean
Created May 18, 2012 23:46
First hacked-up attempt at high-speed USB bulk transfers to LPC43xx microcontroller
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libusb.h>
bool read_file_to_buffer(const char* const filename, uint8_t* const buffer, uint32_t buffer_size) {
memset(buffer, 0x69, buffer_size);
FILE* f = fopen(filename, "rb");
if( f == NULL ) {
@jboone
jboone / gist:2728082
Created May 18, 2012 23:20
First hacked-up attempt at high-speed USB bulk transfers to LPC43xx microcontroller
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libusb.h>
bool read_file_to_buffer(const char* const filename, uint8_t* const buffer, uint32_t buffer_size) {
memset(buffer, 0x69, buffer_size);
FILE* f = fopen(filename, "rb");
if( f == NULL ) {