IM315を用いてDS2(PS2コントローラー)を扱うライブラリ
Diff: IM315.cpp
- Revision:
- 1:9ad38dad969c
- Parent:
- 0:06c265b1fbd1
--- a/IM315.cpp Mon Apr 04 06:15:23 2022 +0000 +++ b/IM315.cpp Mon Apr 04 06:19:27 2022 +0000 @@ -24,6 +24,7 @@ dev = new Serial(TX, RX); dev -> baud(19200); _pc -> baud(baud); + dev -> printf("SRST\r\n"); dev -> attach(callback(this,&IM315::get),Serial::RxIrq); } @@ -73,9 +74,7 @@ void IM315::button_state(){_pc -> printf("U: %d, D: %d, R: %d, L: %d, TRI: %d, X: %d, O: %d, SQU: %d, L1: %d, L2: %d, R1: %d, R2: %d, STA: %d, SEL: %d, L3: %3d, R3: %3d LSX: %3d, LSY: %3d, RSX: %3d, RY: %3d\n",up(), down(), right(), left(), tri(), cross(), circle(), square(), l1(), l2(), r1(), r2(), start(), select(), l3(), r3(), lsx(), lsy(), rsx(), rsy());} -void IM315::data_print(){ - _pc -> printf("%2x %2x %2x %2x %2x %2x %2x %2x\n", DATA[0], DATA[1], DATA[2], DATA[3], DATA[4], DATA[5], DATA[6], DATA[7]); -} +void IM315::data_print(){_pc -> printf("%2x %2x %2x %2x %2x %2x %2x %2x\n", DATA[0], DATA[1], DATA[2], DATA[3], DATA[4], DATA[5], DATA[6], DATA[7]);} bool IM315::up(){return DATA[2] & UP ? 1 : 0;}