RT-USB-9AXIS-00
総合概要
モジュール
データ構造
ファイル
ファイル一覧
大域各種
mode_outputSelect.c
1
#include "mode_outputSelect.h"
2
#include "type.h"
3
#include "MainFunction.h"
4
#include "
UserInterface.h
"
5
#include "SystemTickTimer.h"
6
#include "debug.h"
7
#include "mpu9250.h"
8
9
10
static
void
outputModeSelectInfo(
void
)
11
{
12
13
myPrintfUSB(
"############ output mode select ################\n"
);
14
myPrintfUSB(
"++++++++++++++++++++++++++++++++\n"
);
15
myPrintfUSB(
" Choose the mode .\n"
);
16
myPrintfUSB(
" Short press SW: mode change \n"
);
17
myPrintfUSB(
" Long press SW: enter \n"
);
18
myPrintfUSB(
"++++++++++++++++++++++++++++++++\n"
);
19
myPrintfUSB(
" 0 output this info. :Green LED OFF \n"
);
20
myPrintfUSB(
" 1 USB ASCII 9AXIS mode :Green LED ON \n"
);
21
myPrintfUSB(
" 2 UART 57600 USB BINARY 9AXIS mode :flashing Green LED 1Hz \n"
);
22
23
}
24
25
26
void
mode_outputSelect(
void
)
27
{
28
uint8_t md_select = 0;
29
uint32_t sw_count_max = 0;
30
turnGreenLED
(0);
31
setSendDataEnable
(0);
32
33
outputModeSelectInfo();
34
35
while
(1)
36
{
37
wait1msec(1);
38
if
(
getSWcount
() > 0 )
//SWでモード選択
39
{
40
while
(
getSWcount
() != 0 )
41
{
42
sw_count_max =
getSWcount
();
43
wait1msec(1);
44
if
(sw_count_max >3000)
break
;
45
};
46
//スイッチ短押し
47
if
(sw_count_max <3000)
48
{
49
md_select++;
50
md_select = md_select % 3;
51
myPrintfUSB(
"\t md_select = %d \n "
,md_select);
52
switch
(md_select){
53
case
0:
turnGreenLED
(0);
54
outputModeSelectInfo();
55
break
;
56
case
1:
turnGreenLED
(1);
57
break
;
58
case
2:
flashGreenLED
(800,200);
59
break
;
60
}
61
}
62
else
//スイッチ長押し
63
{
64
break
;
65
}
66
}
67
}
//end while
68
69
myPrintfUSB(
"\t enter\n"
);
70
flashGreenLED
(20,80);
71
wait1msec(3000);
72
turnGreenLED
(0);
73
74
if
(md_select != 0)
setOutputMode
(md_select-1);
75
76
flashGreenLED
(160,40);
77
wait1msec(3000);
78
turnGreenLED
(0);
79
80
}
setOutputMode
void setOutputMode(uint8_t mode)
Definition:
MainFunction.c:92
getSWcount
uint16_t getSWcount(void)
Definition:
UserInterface.c:78
UserInterface.h
LED,SW,電源電圧の監視等の機能の実装
flashGreenLED
void flashGreenLED(uint16_t on_count, uint16_t off_count)
Definition:
UserInterface.c:183
setSendDataEnable
void setSendDataEnable(uint8_t en)
Definition:
MainFunction.c:63
turnGreenLED
void turnGreenLED(uint8_t state)
Definition:
UserInterface.c:150
RT-USB-9AXIS-sample
src
MODE
mode_outputSelect.c
構築:
1.8.10