-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathled_function.cpp
More file actions
58 lines (49 loc) · 1.17 KB
/
led_function.cpp
File metadata and controls
58 lines (49 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <string.h>
#include <matrix_hal/everloop.h>
#include <matrix_hal/everloop_image.h>
#include <matrix_hal/matrixio_bus.h>
extern "C" int led_change(int input_from_c)
{
namespace hal = matrix_hal;
static hal::MatrixIOBus bus;
static hal::EverloopImage image1d(18);
static hal::Everloop everloop;
if (input_from_c == 0)
{
if (!bus.Init()) return false;
// this line just resizes the EverloopImage object to the number of LEDs on the board
everloop.Setup(&bus);
// Clear all LEDs
/* for (hal::LedValue &led : image1d.leds)
{
led.red = 30;
led.green = 20;
led.blue = 0;
led.white = 0;
}
*/
for (int i=0;i<18;i++)
{
image1d.leds[i].red = 10;
image1d.leds[i].green = 0;
image1d.leds[i].blue= 0;
image1d.leds[i].white = 5;
}
everloop.Write(&image1d);
}
else if (input_from_c == 1)
{
// bus.Init();
// everloop.Setup(&bus);
printf ("led call 2\n");
for (int i=0;i<18;i++)
{
image1d.leds[i].red = 0;
image1d.leds[i].green = 10;
image1d.leds[i].blue= 10;
image1d.leds[i].white = 0;
}
everloop.Write(&image1d);
}
return 1;
}