Skip to content

Commit

Permalink
[stm32] Add NUCLEO-L432KC SPI USART example
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-durand committed Nov 10, 2018
1 parent 7a21104 commit efa41ff
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
32 changes: 32 additions & 0 deletions examples/nucleo_l432kc/uart_spi/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2013, Kevin Läufer
* Copyright (c) 2013-2018, Niklas Hauser
* Copyright (c) 2018, Christopher Durand
*
* 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>


int
main()
{
Board::initialize();

// Enable Uart SPI 1
UartSpiMaster1::connect<GpioA8::Ck, GpioA9::Tx, GpioA10::Rx>();
UartSpiMaster1::initialize<Board::systemClock, 1'000'000, modm::Tolerance::Exact>();

while (1)
{
UartSpiMaster1::transferBlocking(0xF0);
}

return 0;
}
11 changes: 11 additions & 0 deletions examples/nucleo_l432kc/uart_spi/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<library>
<extends>modm:board:nucleo-l432kc</extends>
<options>
<option name=":build:build.path">../../../build/nucleo_l432kc/uart_spi</option>
</options>
<modules>
<module>:platform:gpio</module>
<module>:platform:uart.spi:1</module>
<module>:build:scons</module>
</modules>
</library>

0 comments on commit efa41ff

Please sign in to comment.