eclair只支援兩種方向:rotation 0 and rotation 90
CyanogenMod有支援四個方向
最新的froyo應該是支援三個方向(等froyo release再把他的演算法po上來)
程式部份自己要去對旋轉的方向作處理,預設的setting程式就有支援四個方向,
//b2.c #include#include void play(unsigned int* freq, unsigned int* delay); int main(int argc, char* argv[]) { speaker(330, 5); speaker( 0, 5); speaker(330, 5); return 0; } int speaker(unsigned int freq,unsigned int delay) { static int flag=0,bit; if(flag==0) { flag=1; iopl(3); } outb(0xb6,0x43); outb((freq & 0xff),0x42); outb((freq >> 8),0x42); bit=inb(0x61); outb(3 | bit,0x61); usleep(10000*delay); outb(0xfc | bit,0x61); return; }
$* sudo ./b2
private boolean copyFile(String fName, int rawId){
InputStream inS = null;
OutputStream outS = null;
byte [] buf = new byte[1024];
int readByte = 0;
try {
inS = getApplicationContext().getResources().openRawResource(rawId);
outS = openFileOutput(fName,MODE_PRIVATE);
while((readByte = inS.read(buf, 0, 1024)) != -1){
outS.write(buf, 0, readByte);
}
inS.close();
outS.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return true;
}
X9D
|
Leonardo
|
NRF24L01
|
PPM(pin1)
|
pin2
|
|
Vout(battery
voltage, pin3)
|
Vin
|
|
GND(pin4)
|
GND
|
GND
|
SPI-MISO(pin14)
|
MISO
|
|
SPI-MOSI(pin15)
|
MOSI
|
|
SPI-SCK(pin16)
|
SCK
|
|
pin9
|
CE
|
|
pin10
|
CS
|
|
3.3V
|
VCC
|
|
DBG(pin6
to 5V or 0V)
|
||
