summaryrefslogtreecommitdiff
path: root/ucoo/hal/spi/test
diff options
context:
space:
mode:
authorNicolas Schodet2016-07-25 15:18:40 +0200
committerNicolas Schodet2019-10-09 23:05:44 +0200
commit4695b47da68a5b2f75270bea21e15b8f1b9fd6ff (patch)
tree6e5ef4d34ee69bcd6c6627f25a0ca3aa902d47e3 /ucoo/hal/spi/test
parentd7df91926bdb529e68eff9a215aef72072803b6e (diff)
Switch to CMSIS
Diffstat (limited to 'ucoo/hal/spi/test')
-rw-r--r--ucoo/hal/spi/test/test_spi.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/ucoo/hal/spi/test/test_spi.cc b/ucoo/hal/spi/test/test_spi.cc
index de155b7..73225ce 100644
--- a/ucoo/hal/spi/test/test_spi.cc
+++ b/ucoo/hal/spi/test/test_spi.cc
@@ -29,8 +29,6 @@
#include "ucoo/arch/arch.hh"
#include "ucoo/base/test/test.hh"
-#include <libopencm3/stm32/rcc.h>
-
#include <algorithm>
#include <cstdio>
@@ -41,15 +39,16 @@ main (int argc, const char **argv)
ucoo::Stream &ts = ucoo::test_stream ();
// Use connection to LIS302DL device on discovery board revision MB997B.
// Revision MB997C uses a different device.
- rcc_periph_clock_enable (RCC_GPIOA);
- rcc_periph_clock_enable (RCC_GPIOE);
- ucoo::Gpio ss (GPIOE, 3);
+ ucoo::GPIOA.enable ();
+ ucoo::GPIOE.enable ();
+ ucoo::Gpio ss = ucoo::GPIOE[3];
ss.set ();
ss.output ();
- ucoo::Gpio sck (GPIOA, 5), mosi (GPIOA, 7), miso (GPIOA, 6);
+ ucoo::Gpio sck = ucoo::GPIOA[5], mosi = ucoo::GPIOA[7],
+ miso = ucoo::GPIOA[6];
ucoo::SpiSoftMaster spis (sck, mosi, miso);
spis.enable (1000000, ucoo::SPI_MODE_3);
- ucoo::SpiHardMaster spih (0);
+ ucoo::SpiHardMaster spih (ucoo::SpiHardMaster::Instance::SPI1);
ucoo::SpiMaster *spi = &spis;
// Loop with simple IU.
char buf[64];
@@ -115,9 +114,9 @@ main (int argc, const char **argv)
case 'h':
spi->disable ();
spi = &spih;
- gpio_mode_setup (GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE,
- GPIO5 | GPIO6 | GPIO7);
- gpio_set_af (GPIOA, GPIO_AF5, GPIO5 | GPIO6 | GPIO7);
+ miso.af (5);
+ mosi.af (5);
+ sck.af (5);
spi->enable (1000000, ucoo::SPI_MODE_3);
break;
case 's':