Skip to content

Instantly share code, notes, and snippets.

@ytsuboi
ytsuboi / pca9622_test.cpp
Created November 15, 2014 14:45
EdisonでPCA9622を使ってみた
#include "mraa.hpp"
int main() {
mraa::I2c* i2c;
i2c = new mraa::I2c(6);
i2c->address(0x50);
char init[] = {0x80, 0x00, 0x05, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0x00};
i2c->write(init, 21);
@ytsuboi
ytsuboi / LPC1114.cfg
Created October 27, 2014 14:21
OpenOCDでmbed LPC1114FN28に書いてみた。
#LPC1114.cfg
source [find interface/cmsis-dap.cfg]
# chip name
set CHIPNAME LPC1114FN28
source [find target/lpc11xx.cfg]
$CHIPNAME.cpu configure -event gdb-attach {
echo "halting"
@ytsuboi
ytsuboi / erase_nrf51822.py
Created June 28, 2014 06:59
nRF51822のflashをCMSIS-DAPで消すツール(要pyOCD)
#!/usr/bin/env python
import argparse
from time import sleep, time
from struct import unpack
import sys
import subprocess
from pyOCD.interface import INTERFACE, usb_backend
from pyOCD.board import MbedBoard
@ytsuboi
ytsuboi / gist:7367769
Created November 8, 2013 08:04
Galileoのdmesg
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 3.8.7-yocto-standard (clntonsw@irsswdev001) (gcc version 4.7.2 (GCC) ) #1 Tue Oct 1 00:07:32 IST 2013
[ 0.000000] e820: BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x0000000000096fff] usable
[ 0.000000] BIOS-e820: [mem 0x0000000000097000-0x0000000000097fff] reserved
[ 0.000000] BIOS-e820: [mem 0x0000000000098000-0x000000000009ffff] usable
[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000000f0defff] usable
[ 0.000000] BIOS-e820: [mem 0x000000000f0df000-0x000000000f11efff] ACPI data
[ 0.000000] BIOS-e820: [mem 0x000000000f11f000-0x000000000f1defff] reserved
@ytsuboi
ytsuboi / DAP_config.patch
Created April 2, 2013 09:33
a patch for DAP_config.h of NXP's AN11321, to get works on my CMSIS-DAP adapter.
--- DAP_config.h.orig 2013-04-02 16:54:01.248627100 +0900
+++ DAP_config.h 2013-03-31 13:48:38.999248900 +0900
@@ -38,6 +38,7 @@
//#include <LPC43xx.H> // Debug Unit Cortex-M Processor Header File
#include <LPC11Uxx.h>
+#include "gpio.h"
/// Processor Clock of the Cortex-M MCU used in the Debug Unit.
/// This value is used to calculate the SWD/JTAG clock speed.
@ytsuboi
ytsuboi / ir_send.ino
Created January 8, 2013 14:20
Arduinoを赤外線リモコンにするスケッチ。 とりあえず家電協とNECフォーマットに対応。たぶんSONYフォーマットにも対応させます。
/*
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2013 Yoshihiro TSUBOI <ytsuboi-at-gmail.com>
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
@ytsuboi
ytsuboi / gist:3027999
Created July 1, 2012 11:16
Raspberry Piのdmesg
Linux version 3.1.9+ (grayg@dc4-arm-01) (gcc version 4.5.1 (Broadcom-2708) ) #90 Wed Apr 18 18:23:05 BST 2012
CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: BCM2708
Memory policy: ECC disabled, Data cache writeback
On node 0 totalpages: 49152
free_area_init_node: node 0, pgdat c03b5660, node_mem_map c0402000
Normal zone: 384 pages used for memmap
Normal zone: 0 pages reserved
Normal zone: 48768 pages, LIFO batch:15
@ytsuboi
ytsuboi / gist:3018311
Created June 29, 2012 14:38
How to download the ADK ( Accessory Development Kit ) 2012 source
On my Mac, I did this.
-- Install repo to MacPorts directory
$ sudo curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > /opt/local/bin/repo
$ sudo chmod a+x /opt/local/bin/repo
-- Grab the source
$ mkdir android-accessories
$ cd android-accessories/
$ repo init -u https://android.googlesource.com/accessories/manifest
$ repo sync
@ytsuboi
ytsuboi / cream-dxf6.ulp
Created June 1, 2012 14:23
cream-dxfのEAGLE 6対応版(開発中)
まじめにやって、
https://github.com/SWITCHSCIENCE/ssci-eagle-public/blob/master/cream-dxf.ulp
こちらに置きました。
EAGLE 6では、スケールが1/31.75と聞いていましたが、ドキュメントによると1/32なので、そのように直してあります。
一応、10x5mmのtCreamレイヤを書いてEAGLE 6で1/32したところ、10x5mmだったので、1/32を採用しました。
@ytsuboi
ytsuboi / Portfile
Created December 11, 2011 15:59
MacPorts Portfile for avr-binutils @2.20.1a_1
# $Id: Portfile 78408 2011-05-07 00:01:50Z jmr@macports.org $
PortSystem 1.0
name avr-binutils
version 2.20.1a
revision 1
# Parameters for this port.
set crossgcc-target avr