Last change
on this file since 457 was 457, checked in by coas-nagasima, 4 years ago |
ファイルを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
1.4 KB
|
Line | |
---|
1 | // https://github.com/ms-iotkithol-jp/IoTKitHoLV3/blob/master/PinKitIoTHubApp/PinKitIoTHubApp/PinKit/BoardFullColorLED.cs
|
---|
2 |
|
---|
3 | #include <kernel.h>
|
---|
4 | #include "pinkit.h"
|
---|
5 | #include "kernel_cfg.h"
|
---|
6 |
|
---|
7 | extern uint16_t led_state;
|
---|
8 |
|
---|
9 | // コンストラクター
|
---|
10 | void BoardFullColorLED_Init()
|
---|
11 | {
|
---|
12 | // 各 LED の InputPort インスタンス
|
---|
13 | led_state = 0;
|
---|
14 | }
|
---|
15 |
|
---|
16 | /// <summary>
|
---|
17 | /// 指定の色で LED を点灯、消灯する
|
---|
18 | /// </summary>
|
---|
19 | /// <param name="redOn">true ならば赤を点灯</param>
|
---|
20 | /// <param name="greenOn">true ならば緑を点灯</param>
|
---|
21 | /// <param name="blueOn">true ならば青を点灯</param>
|
---|
22 | void BoardFullColorLED_SetRgb(bool redOn, bool greenOn, bool blueOn)
|
---|
23 | {
|
---|
24 | if (redOn)
|
---|
25 | led_state |= LED01;
|
---|
26 | else
|
---|
27 | led_state &= ~LED01;
|
---|
28 | if (greenOn)
|
---|
29 | led_state |= LED02;
|
---|
30 | else
|
---|
31 | led_state &= ~LED02;
|
---|
32 | if (blueOn)
|
---|
33 | led_state |= LED03;
|
---|
34 | else
|
---|
35 | led_state &= ~LED03;
|
---|
36 | led_out(led_state);
|
---|
37 | }
|
---|
38 |
|
---|
39 | /// <summary>
|
---|
40 | /// 色名指定で LED を点灯する
|
---|
41 | /// </summary>
|
---|
42 | /// <param name="color"></param>
|
---|
43 | void BoardFullColorLED_SetColor(Colors color)
|
---|
44 | {
|
---|
45 | int redFlag = (int)color & (int)Colors_Red;
|
---|
46 | int greenFlag = (int)color & (int)Colors_Green;
|
---|
47 | int blueFlag = (int)color & (int)Colors_Blue;
|
---|
48 | if (redFlag != 0)
|
---|
49 | led_state |= LED01;
|
---|
50 | else
|
---|
51 | led_state &= ~LED01;
|
---|
52 | if (greenFlag != 0)
|
---|
53 | led_state |= LED02;
|
---|
54 | else
|
---|
55 | led_state &= ~LED02;
|
---|
56 | if (blueFlag != 0)
|
---|
57 | led_state |= LED03;
|
---|
58 | else
|
---|
59 | led_state &= ~LED03;
|
---|
60 | led_out(led_state);
|
---|
61 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.