Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed move3wheel
Fork of F3RC-mbed-new2 by
User.cpp
- Committer:
- hirokimineshita
- Date:
- 2015-04-30
- Revision:
- 7:4bddbd4549a1
- Parent:
- 6:ef9eb4859743
- Child:
- 9:e5437ba3e920
File content as of revision 7:4bddbd4549a1:
#include "Utils.h"
#include "USBHost.h"
#include "hci.h"
#include "ps3.h"
#include "User.h"
#include "mbed.h"
//ここに関数外に書く要素を記入する
int RSX,RSY,LSX,LSY,BSU,BSL;
PwmOut led1(LED1);
PwmOut led2(LED2);
DigitalOut led3(LED3);
DigitalOut led4(LED4);
void UserLoopSetting(){
//一度だけ行いたい初期設定をここに書く
led1.period_ms(20);
}
void UserLoop(char n,const u8* data){
u16 ButtonState;
if(n==0){//有線Ps3USB.cpp
RSX = ((ps3report*)data)->RightStickX;
RSY = ((ps3report*)data)->RightStickY;
LSX = ((ps3report*)data)->LeftStickX;
LSY = ((ps3report*)data)->LeftStickY;
BSU = (u8)(((ps3report*)data)->ButtonState & 0x00ff);
BSL = (u8)(((ps3report*)data)->ButtonState >> 8);
//ボタンの処理
ButtonState = ((ps3report*)data)->ButtonState;
}else {//無線TestShell.cpp
RSX = ((ps3report*)(data + 1))->RightStickX;
RSY = ((ps3report*)(data + 1))->RightStickY;
LSX = ((ps3report*)(data + 1))->LeftStickX;
LSY = ((ps3report*)(data + 1))->LeftStickY;
BSU = (u8)(((ps3report*)(data + 1))->ButtonState & 0x00ff);
BSL = (u8)(((ps3report*)(data + 1))->ButtonState >> 8);
//ボタンの処理
ButtonState = ((ps3report*)(data + 1))->ButtonState;
}
//ここより下にプログラムを書く
//データ取得例
if((ButtonState >> BUTTONCIRCLE)&1) {
//○が押されたとき
}
led1=LSX/256.0f;
led2=LSY/256.0f;
led3=ButtonState & 0x0400; //L1の状態
led4=ButtonState & 0x0800; //R1の状態
//値の取得はps3.hを参照
}
