diff options
author | Karl Palsson <karlp@tweak.net.au> | 2018-02-19 22:04:59 +0000 |
---|---|---|
committer | Karl Palsson <karlp@tweak.net.au> | 2018-02-19 22:04:59 +0000 |
commit | d5fd0d101240152d14ac3a8c27dbebbc1ce471e4 (patch) | |
tree | 158b3e5d16839bf8324f60bb8959dcdfbb5f1a2a /tests | |
parent | 02d5cff752e942138dc1bc8f66b07a47bbb75788 (diff) | |
download | olsndot-d5fd0d101240152d14ac3a8c27dbebbc1ce471e4.tar.gz olsndot-d5fd0d101240152d14ac3a8c27dbebbc1ce471e4.tar.bz2 olsndot-d5fd0d101240152d14ac3a8c27dbebbc1ce471e4.zip |
spi-master: update to run on the hw1 host board
"TRIGGER" is now D0 on the fx2 port
"LED" is now D1 on the fx2 port,
"SPI MOSI" is now D4 on the fx2
"SPI MISO" is now D5
"SPI CLOCK" is now D6
Diffstat (limited to 'tests')
-rw-r--r-- | tests/spi-master/main-stm32l1-generic.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/tests/spi-master/main-stm32l1-generic.c b/tests/spi-master/main-stm32l1-generic.c index 1763995..38d3525 100644 --- a/tests/spi-master/main-stm32l1-generic.c +++ b/tests/spi-master/main-stm32l1-generic.c @@ -13,10 +13,9 @@ #include "trace.h" #include "hw.h" -//#include "i2c-master.h" #define LED_DISCO_GREEN_PORT GPIOB -#define LED_DISCO_GREEN_PIN GPIO7 +#define LED_DISCO_GREEN_PIN GPIO8 struct hw_detail hw_details = { @@ -28,7 +27,7 @@ struct hw_detail hw_details = { .port_rcc = RCC_GPIOB, .trigger_rcc = RCC_GPIOB, .trigger_port = GPIOB, - .trigger_pin = GPIO11, + .trigger_pin = GPIO9, }; @@ -84,8 +83,21 @@ static void setup(void) int main(void) { + const struct rcc_clock_scale myclock = { + .pll_source = RCC_CFGR_PLLSRC_HSE_CLK, + .pll_mul = RCC_CFGR_PLLMUL_MUL4, + .pll_div = RCC_CFGR_PLLDIV_DIV2, + .hpre = RCC_CFGR_HPRE_SYSCLK_NODIV, + .ppre1 = RCC_CFGR_PPRE1_HCLK_NODIV, + .ppre2 = RCC_CFGR_PPRE2_HCLK_NODIV, + .voltage_scale = PWR_SCALE1, + .flash_waitstates = 1, + .ahb_frequency = 32e6, + .apb1_frequency = 32e6, + .apb2_frequency = 32e6, + }; int i, j; - rcc_clock_setup_pll(&rcc_clock_config[RCC_CLOCK_VRANGE1_HSI_PLL_32MHZ]); + rcc_clock_setup_pll(&myclock); /* green led for ticking */ rcc_periph_clock_enable(RCC_GPIOB); gpio_mode_setup(LED_DISCO_GREEN_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, |