Skip to content

Instantly share code, notes, and snippets.

View YuuichiAkagawa's full-sized avatar

Yuuichi Akagawa YuuichiAkagawa

View GitHub Profile
// Poll USB MIDI Controler and send to serial MIDI
void MIDI_poll()
{
uint8_t size;
uint8_t recvBuf[MIDI_EVENT_PACKET_SIZE];
uint8_t rcode = 0; //return code
uint16_t rcvd;
uint8_t readPtr = 0;
/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
This software may be distributed and modified under the terms of the GNU
General Public License version 2 (GPL2) as published by the Free Software
Foundation and appearing in the file GPL2.TXT included in the packaging of
this file. Please note that GPL2 Section 2[b] requires that all works based
on this software must also be made publicly available under the terms of
the GPL2 ("Copyleft").
Contact information
Arduino: 1.6.8 (Windows 7), Board: "Arduino/Genuino Uno"
D:\develop\arduino-1.6.8\arduino-builder -dump-prefs -logger=machine -hardware "D:\develop\arduino-1.6.8\hardware" -hardware "C:\Users\akagawa\AppData\Local\Arduino15\packages" -hardware "D:\develop\Projects\Arduino\hardware" -tools "D:\develop\arduino-1.6.8\tools-builder" -tools "D:\develop\arduino-1.6.8\hardware\tools\avr" -tools "C:\Users\akagawa\AppData\Local\Arduino15\packages" -built-in-libraries "D:\develop\arduino-1.6.8\libraries" -libraries "D:\develop\Projects\Arduino\libraries" -fqbn=arduino:avr:uno -ide-version=10608 -build-path "D:\users\akagawa\Temp\buildd45e51efecc2076611979ea3c516660c.tmp" -warnings=all -prefs=build.warn_data_percentage=75 -verbose "D:\develop\Projects\Arduino\libraries\USB_Host_Shield_2\examples\Bluetooth\WiiMulti\WiiMulti.ino"
D:\develop\arduino-1.6.8\arduino-builder -compile -logger=machine -hardware "D:\develop\arduino-1.6.8\hardware" -hardware "C:\Users\akagawa\AppData\Local\Arduino15\packages" -hardware "D:\develo
/* mbed Microcontroller Library
* Copyright (c) 2015 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
cat << EOT > /etc/udev/rules.d/51-usbblaster.rules
# USB-Blaster
ATTR{idVendor}=="09fb", ATTR{idProduct}=="6001", MODE="666"
ATTR{idVendor}=="09fb", ATTR{idProduct}=="6002", MODE="666"
ATTR{idVendor}=="09fb", ATTR{idProduct}=="6003", MODE="666"
# USB-Blaster II
ATTR{idVendor}=="09fb", ATTR{idProduct}=="6010", MODE="666"
ATTR{idVendor}=="09fb", ATTR{idProduct}=="6810", MODE="666"
/* GR-SAKURA Sketch Template V2.06 */
#include <Arduino.h>
//USBDesc
#include <usbhub.h>
#define Serial Serial1
#define BUFSIZE 256 //buffer size
#define LOBYTE(x) ((char*)(&(x)))[0]
#define HIBYTE(x) ((char*)(&(x)))[1]
void USB::initialise()
{
/* Configure the USB0 host pins(USB0_OVRCURA and USB0_VBUSEN) needed */
// protection got turned off in hardware setup
// MPC.PWPR.BIT.B0WI = 0; // Enable write to PFSWE bit
// MPC.PWPR.BIT.PFSWE = 1; // Disable write protection to PFS registers
/* Use this for GR-Sakura and RSK */
PORT1.PDR.BIT.B6 = 1; // P16 is an output pin
PORT1.PCR.BIT.B6 = 1; // P16 is an output pin
MPC.P16PFS.BIT.PSEL = 0x12; // Configure as USB0_VBUSEN pin
#include <usbh_midi.h>
#include <usbhub.h>
#ifdef dobogusinclude
#include <spi4teensy3.h>
#include <SPI.h>
#endif
USB Usb;
USBH_MIDI Midi(&Usb);
/*
* A piezo transducer is wired to pins 19 and 18 to trigger
* cycling through the Record/Play/Stop modes. The code can
* be altered to also work with a simple push button.
*/
#include <usbh_midi.h>
#include <usbhub.h>
#ifdef dobogusinclude
#include <spi4teensy3.h>
#include <Max3421e.h>
#include <Usb.h>
#include <AndroidAccessory2.h>
#define JOYSTICK_VERT A0
#define JOYSTICK_HORZ A1
#define JOYSTICK_SEL A2
#define DIVIDER 32
#define LED1 3