etrobocon2018 feat.KatLab  770af34cce41ae9c30c41303275e1add2daae0c3 (with uncommitted changes)
 全て クラス 名前空間 ファイル 関数 変数 列挙型 列挙値 フレンド マクロ定義 ページ
マクロ定義 | 関数
app.cpp ファイル
#include "ev3api.h"
#include "app.h"
#include "util.h"
#include "ColorSensor.h"
#include "SonarSensor.h"
#include "TouchSensor.h"
#include <string>
#include "kernel_cfg.h"
app.cpp の依存先関係図:

[ソースコード]

マクロ定義

#define DEBUG
 
#define _debug(x)   (x)
 

関数

void main_task (intptr_t unused)
 
void bt_task (intptr_t unused)
 

マクロ定義詳解

#define _debug (   x)    (x)

app.cpp28 行目に定義があります。

#define DEBUG

app.cpp25 行目に定義があります。

関数詳解

void bt_task ( intptr_t  unused)

概要 : Bluetooth通信によるリモートスタート。 Tera Termなどのターミナルソフトから、 ASCIIコードで1を送信すると、リモートスタートする。 引数 : unused 返り値 : なし

app.cpp97 行目に定義があります。

98 {
99  while(1) {
100  uint8_t c = fgetc(g_bluetooth); /* 受信 */
101  switch(c) {
102  case '1':
103  g_bluetooth_command = 1;
104  break;
105  default:
106  break;
107  }
108  fputc(c, g_bluetooth); /* エコーバック */
109  }
110 }
void main_task ( intptr_t  unused)

app.cpp37 行目に定義があります。

38 {
39  /* Open Bluetooth file */
40  g_bluetooth = ev3_serial_open_file(EV3_SERIAL_BT);
41  assert(g_bluetooth != NULL);
42 
43  /* Bluetooth通信タスクの起動 */
44  act_tsk(BT_TASK);
45 
46  msg_f("Check Colors", 1);
47  msg_f(" create from github.com/korosuke613/etrobocon2017", 2);
48  ColorSensor colorSensor(PORT_3);
49  TouchSensor touchSensor(PORT_1);
50  SonarSensor sonarSensor(PORT_2);
51  int time_count = 0;
52  char msg[32];
53  int color_num;
54  std::string color_name[8]
55  = { "NONE", "BLACK", "BLUE", "GREEN", "YELLOW", "RED", "WHITE", "BROWN" };
56  rgb_raw_t rgb;
57  while(1) {
58  color_num = (int)colorSensor.getColorNumber();
59  colorSensor.getRawColor(rgb);
60  // sprintf(msg, "LightValue: %d", colorSensor.getBrightness());
61  // msg_f(msg, 4);
62 
63  sprintf(msg, "ColorNumber: %s", color_name[color_num].c_str());
64  msg_f(msg, 5);
65  sprintf(msg, " R:%3d G:%3d B:%3d", rgb.r, rgb.g, rgb.b);
66  msg_f(msg, 6);
67 
68  sprintf(msg, "DistanceEye: %d", sonarSensor.getDistance());
69  msg_f(msg, 7);
70 
71  if(sonarSensor.getDistance() < 10) {
72  time_count++;
73  }
74 
75  sprintf(msg, "DistanceTime: %d", time_count);
76  msg_f(msg, 8);
77 
78  if(touchSensor.isPressed() == 1) {
79  break; /* タッチセンサが押された */
80  }
81  tslp_tsk(4);
82  }
83 
84  ter_tsk(BT_TASK);
85  fclose(g_bluetooth);
86 
87  ext_tsk();
88 }
void msg_f(const char *str, int32_t line)
Definition: util.cpp:17
Definition: Port.h:20
Definition: Port.h:22
Definition: Port.h:21

呼び出し関係図: