Skip to content

Instantly share code, notes, and snippets.

View YuuichiAkagawa's full-sized avatar

Yuuichi Akagawa YuuichiAkagawa

View GitHub Profile
@YuuichiAkagawa
YuuichiAkagawa / MainActivity.java
Created February 16, 2014 15:04
konashi-android-sdkでSBBLEのLチカサンプル
package org.ammlab.android.konashitest;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.RelativeLayout;
import android.widget.ToggleButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
package org.ammlab.android.usbmiditest;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.LinkedList;
import android.hardware.usb.UsbConstants;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbEndpoint;
@YuuichiAkagawa
YuuichiAkagawa / MainActivity.java
Created November 13, 2013 15:58
SBBLE(Konashi) sample program
/*
* SBBLE(Konashi) sample program
* Copyright (C) 2013 Yuuichi Akagawa
*
* 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
*
@YuuichiAkagawa
YuuichiAkagawa / gist:6326737
Created August 24, 2013 07:52
Physicaloid UART config sample
UartConfig paramUart = new UartConfig(115200, UartConfig.DATA_BITS8, UartConfig.STOP_BITS1, UartConfig.PARITY_NONE, false, false);
if(mPhysicaloid.open(paramUart)) {
//...
} else {
//...
}
@YuuichiAkagawa
YuuichiAkagawa / gr_sketch.cpp
Created January 22, 2013 14:49
HelloADK sketch for RLduino78
/*
* HelloADK
* Android ADK(AOA1.0) sample sketch for RLduino78
* Copyright (C) 2013 Yuuichi Akagawa
*
* 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
@YuuichiAkagawa
YuuichiAkagawa / FTDriver_PO_S2
Created December 18, 2012 09:25
FTDriver 9600bps, Data:8bit, Parity:ODD, StopBit:2
mSerial.begin(FTDriver.BAUD19200);
mSerial.setSerialPropertyParity(FTDriver.FTDI_SET_DATA_PARITY_ODD, FTDriver.CH_A);
mSerial.setSerialPropertyStopBits(FTDriver.FTDI_SET_DATA_STOP_BITS_2, FTDriver.CH_A);
mSerial.setSerialPropertyToChip(FTDriver.CH_A);
@YuuichiAkagawa
YuuichiAkagawa / gr_sketch.cpp
Last active October 10, 2015 11:17
Kondo's SerialServo(ICS3.5) control sample for GR-SAKURA
#include <rxduino.h>
#include <iodefine_gcc63n.h>
void sendCommand(unsigned char *data, unsigned short len)
{
Serial.write((const unsigned char*)data, len);
delay(2);
}
void setServoPos(unsigned char ServoID, unsigned short pos)
@YuuichiAkagawa
YuuichiAkagawa / gist:3474852
Created August 26, 2012 06:08
GR-SAKURA Serial parity check enable
#include <rxduino.h>
#include <iodefine_gcc63n.h>
void setup()
{
Serial.begin( 115200, SCI_SCI0P2x );
//SCI0 偶数パリティ有効
SCI0.SCR.BIT.TE = 0;
SCI0.SCR.BIT.RE = 0;
SCI0.SMR.BIT.PE = 1;
SCI0.SMR.BIT.PM = 0;
@YuuichiAkagawa
YuuichiAkagawa / gist:3187576
Created July 27, 2012 11:54
USBH_MIDI send MIDI message sample
/*
*******************************************************************************
* USB-MIDI to Legacy Serial MIDI converter
* Copyright 2012 Yuuichi Akagawa
*
* Idea from LPK25 USB-MIDI to Serial MIDI converter
* by Collin Cunningham - makezine.com, narbotic.com
*
* for use with USB Host Shield 2.0 from Circuitsathome.com
* https://github.com/felis/USB_Host_Shield_2.0
@YuuichiAkagawa
YuuichiAkagawa / gist:2851004
Created June 1, 2012 10:22
FileInputStream.available() on Android Accessory read thread
W/System.err( 3981): java.io.IOException: Invalid argument
W/System.err( 3981): at org.apache.harmony.luni.platform.OSFileSystem.ioctlAvailable(Native Method)
W/System.err( 3981): at dalvik.system.BlockGuard$WrappedFileSystem.ioctlAvailable(BlockGuard.java:241)
W/System.err( 3981): at java.io.FileInputStream.available(FileInputStream.java:138)
W/System.err( 3981): at org.ammlab.android.helloadk.HelloADKActivity.run(HelloADKActivity.java:261)
W/System.err( 3981): at java.lang.Thread.run(Thread.java:1019)