etrobocon2018 feat.KatLab  770af34cce41ae9c30c41303275e1add2daae0c3 (with uncommitted changes)
 全て クラス 名前空間 ファイル 関数 変数 列挙型 列挙値 フレンド マクロ定義 ページ
lifter_check.cpp
[詳解]
1 
9 #include "Controller.h"
10 #include "Lifter.h"
11 #include "app.h"
12 #include "ev3api.h"
13 #include "util.h"
14 
15 #if defined(BUILD_MODULE)
16 #include "module_cfg.h"
17 #else
18 #include "kernel_cfg.h"
19 #endif
20 
21 #define DEBUG
22 
23 #ifdef DEBUG
24 #define _debug(x) (x)
25 #else
26 #define _debug(x)
27 #endif
28 
29 static int g_bluetooth_command = 0; // Bluetoothコマンド 1:リモートスタート
30 static FILE* g_bluetooth = NULL; // Bluetoothファイルハンドル
31 
32 /* メインタスク */
33 void main_task(intptr_t unused)
34 {
35  /* Open Bluetooth file */
36  g_bluetooth = ev3_serial_open_file(EV3_SERIAL_BT);
37  assert(g_bluetooth != NULL);
38 
39  /* Bluetooth通信タスクの起動 */
40  act_tsk(BT_TASK);
41 
42  msg_f("ET-Robocon2018", 1);
43  msg_f(" create from github.com/korosuke613/etrobocon2018", 2);
44 
45  Controller controller;
46  Lifter lifter{ controller };
47 
48  lifter.liftUp();
49  lifter.liftDown();
50 
51  ter_tsk(BT_TASK);
52  fclose(g_bluetooth);
53 
54  ext_tsk();
55 }
56 
64 void bt_task(intptr_t unused)
65 {
66  while(1) {
67  uint8_t c = fgetc(g_bluetooth); /* 受信 */
68  switch(c) {
69  case '1':
70  g_bluetooth_command = 1;
71  break;
72  default:
73  break;
74  }
75  fputc(c, g_bluetooth); /* エコーバック */
76  }
77 }
void msg_f(const char *str, int32_t line)
Definition: util.cpp:17
走行体のアームを操作するクラス。
Definition: Lifter.h:20
void main_task(intptr_t unused)
void bt_task(intptr_t unused)
走行体のアームを操作するクラス。