-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[examples] Add TLC594x Blue Pill example
- Loading branch information
Showing
4 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (c) 2019, Linas Nikiperavicius | ||
* | ||
* 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/tlc594x.hpp> | ||
|
||
using namespace Board; | ||
|
||
/* | ||
* Turns on each TLC594* output in ascending order. | ||
* Each output is active for 500 milliseconds. | ||
*/ | ||
|
||
#define CHANNELS 24 | ||
|
||
modm::TLC594X< CHANNELS, SpiMaster1, GpioA4, GpioA3 > tlc594x; | ||
|
||
int | ||
main() | ||
{ | ||
Board::initialize(); | ||
|
||
SpiMaster1::connect< GpioA5::Sck, GpioA7::Mosi > (); | ||
SpiMaster1::initialize< Board::SystemClock, 1125_kBd>(); | ||
|
||
tlc594x.initialize(0, -1, true, false, true); | ||
|
||
while (true) | ||
{ | ||
for (uint16_t i = 0; i < CHANNELS; ++i) | ||
{ | ||
tlc594x.setAllChannels(0x000); | ||
tlc594x.setChannel(i, 0xfff); | ||
RF_CALL_BLOCKING(tlc594x.writeChannels()); | ||
|
||
modm::delayMilliseconds(500); | ||
} | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Replace this with your custom programmer | ||
source [find interface/stlink-v2.cfg] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<library> | ||
<extends>modm:blue-pill</extends> | ||
<options> | ||
<option name="modm:build:build.path">../../../build/stm32f103c8t6_blue_pill/tlc594x</option> | ||
<option name="modm:build:openocd.cfg">openocd.cfg</option> | ||
</options> | ||
<modules> | ||
<module>modm:platform:spi:1</module> | ||
<module>modm:driver:tlc594x</module> | ||
<module>modm:build:scons</module> | ||
</modules> | ||
</library> |