-
Notifications
You must be signed in to change notification settings - Fork 164
Expand file tree
/
Copy pathmain.cpp
More file actions
52 lines (44 loc) · 1.11 KB
/
main.cpp
File metadata and controls
52 lines (44 loc) · 1.11 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
/*
* Copyright (c) 2016-2017, Niklas Hauser
* Copyright (c) 2017, Nick Sarten
*
* This file is part of the modm project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <modm/board.hpp>
#include <modm/driver/pwm/sk6812w.hpp>
#include <modm/ui/led/tables.hpp>
#include <modm/processing/timer.hpp>
using namespace Board;
using Output = Board::D11;
modm::Sk6812w<SpiMaster1, Output, 8*8> leds;
modm::ShortPeriodicTimer tmr{33ms};
int
main()
{
Board::initialize();
LedD13::setOutput();
leds.initialize<Board::SystemClock>();
constexpr uint8_t max = 62;
uint8_t r=0, g=max/3, b=max/3*2;
while (true)
{
for (size_t ii=0; ii < leds.size; ii++)
{
leds.setColor(ii,
{modm::ui::table22_8_256[r*3/2],
modm::ui::table22_8_256[g*3/2],
modm::ui::table22_8_256[b*3/2]});
if (r++ >= max) r = 0;
if (g++ >= max) g = 0;
if (b++ >= max) b = 0;
}
leds.write();
while(not tmr.execute()) ;
LedD13::toggle();
}
return 0;
}