tutrcos
読み取り中…
検索中…
一致する文字列を見つけられません
tutrcos::module::PS3 クラス

#include <ps3.hpp>

公開型

enum class  Axis { LEFT_X , LEFT_Y , RIGHT_X , RIGHT_Y }
 
enum class  Key {
  UP , DOWN , RIGHT , LEFT ,
  TRIANGLE , CROSS , CIRCLE , SQUARE = 8 ,
  L1 , L2 , R1 , R2 ,
  START , SELECT
}
 

公開メンバ関数

 PS3 (peripheral::UART &uart)
 
void update ()
 
float get_axis (Axis axis)
 
bool get_key (Key key)
 
bool get_key_down (Key key)
 
bool get_key_up (Key key)
 

詳解

#include <cstdio>
#include <tutrcos.hpp>
extern UART_HandleTypeDef huart1;
extern UART_HandleTypeDef huart2;
extern "C" void main_thread(void *) {
using namespace tutrcos::core;
using namespace tutrcos::peripheral;
using namespace tutrcos::module;
UART uart2(&huart2); // デバッグ出力用
uart2.enable_stdout();
UART uart1(&huart1);
PS3 ps3(uart1);
while (true) {
ps3.update();
// DualShock 左スティックのx, y座標を出力
printf("%f %f\r\n", ps3.get_axis(PS3::Axis::LEFT_X),
ps3.get_axis(PS3::Axis::LEFT_Y));
if (ps3.get_key_down(PS3::Key::CIRCLE)) {
printf("O ボタンが押されたよ\r\n");
}
if (ps3.get_key_up(PS3::Key::CIRCLE)) {
printf("O ボタンが離されたよ\r\n");
}
Thread::delay(10);
}
}
Definition ps3.hpp:55
Definition uart.hpp:51
Definition kernel.hpp:8
Definition amt21.hpp:13
Definition can.hpp:15

列挙型メンバ詳解

◆ Axis

enum class tutrcos::module::PS3::Axis
strong
列挙値
LEFT_X 
LEFT_Y 
RIGHT_X 
RIGHT_Y 

◆ Key

enum class tutrcos::module::PS3::Key
strong
列挙値
UP 
DOWN 
RIGHT 
LEFT 
TRIANGLE 
CROSS 
CIRCLE 
SQUARE 
L1 
L2 
R1 
R2 
START 
SELECT 

構築子と解体子

◆ PS3()

tutrcos::module::PS3::PS3 ( peripheral::UART & uart)
inline

関数詳解

◆ get_axis()

float tutrcos::module::PS3::get_axis ( Axis axis)
inline

◆ get_key()

bool tutrcos::module::PS3::get_key ( Key key)
inline

◆ get_key_down()

bool tutrcos::module::PS3::get_key_down ( Key key)
inline

◆ get_key_up()

bool tutrcos::module::PS3::get_key_up ( Key key)
inline

◆ update()

void tutrcos::module::PS3::update ( )
inline

このクラス詳解は次のファイルから抽出されました: