|
@@ -7,15 +7,9 @@ void spi0_init(void){
|
|
|
rcu_periph_clock_enable(RCU_GPIOA);
|
|
rcu_periph_clock_enable(RCU_GPIOA);
|
|
|
rcu_periph_clock_enable(RCU_GPIOB);
|
|
rcu_periph_clock_enable(RCU_GPIOB);
|
|
|
rcu_periph_clock_enable(RCU_SPI0);
|
|
rcu_periph_clock_enable(RCU_SPI0);
|
|
|
- //spi clk
|
|
|
|
|
- gpio_mode_output(GPIOB, GPIO_PUPD_NONE, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_3);
|
|
|
|
|
- //spi MISO
|
|
|
|
|
- gpio_mode_input(GPIOB, GPIO_PUPD_NONE, GPIO_PIN_4);
|
|
|
|
|
- //spi MOSI
|
|
|
|
|
- gpio_mode_output(GPIOB, GPIO_PUPD_NONE, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_5);
|
|
|
|
|
- gpio_af_set(GPIOB, GPIO_AF_0, GPIO_PIN_3);
|
|
|
|
|
- gpio_af_set(GPIOB, GPIO_AF_0, GPIO_PIN_4);
|
|
|
|
|
- gpio_af_set(GPIOB, GPIO_AF_0, GPIO_PIN_5);
|
|
|
|
|
|
|
+ gpio_mode_af(GPIOB, GPIO_PUPD_NONE, GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5);
|
|
|
|
|
+ gpio_af_set(GPIOB, GPIO_AF_0, GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5);
|
|
|
|
|
+ gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_3|GPIO_PIN_5);
|
|
|
|
|
|
|
|
ml5238_cs(1);
|
|
ml5238_cs(1);
|
|
|
|
|
|
|
@@ -46,15 +40,10 @@ void spi1_init(void){
|
|
|
rcu_periph_clock_enable(RCU_GPIOA);
|
|
rcu_periph_clock_enable(RCU_GPIOA);
|
|
|
rcu_periph_clock_enable(RCU_GPIOB);
|
|
rcu_periph_clock_enable(RCU_GPIOB);
|
|
|
rcu_periph_clock_enable(RCU_SPI1);
|
|
rcu_periph_clock_enable(RCU_SPI1);
|
|
|
- //spi clk
|
|
|
|
|
- gpio_mode_output(GPIOB, GPIO_PUPD_NONE, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_13);
|
|
|
|
|
- //spi MISO
|
|
|
|
|
- gpio_mode_input(GPIOB, GPIO_PUPD_NONE, GPIO_PIN_14);
|
|
|
|
|
- //spi MOSI
|
|
|
|
|
- gpio_mode_output(GPIOB, GPIO_PUPD_NONE, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_15);
|
|
|
|
|
- gpio_af_set(GPIOB, GPIO_AF_0, GPIO_PIN_13);
|
|
|
|
|
- gpio_af_set(GPIOB, GPIO_AF_0, GPIO_PIN_14);
|
|
|
|
|
- gpio_af_set(GPIOB, GPIO_AF_0, GPIO_PIN_15);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ gpio_mode_af(GPIOB, GPIO_PUPD_NONE, GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15);
|
|
|
|
|
+ gpio_af_set(GPIOB, GPIO_AF_0, GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15);
|
|
|
|
|
+ gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_13|GPIO_PIN_15);
|
|
|
|
|
|
|
|
cs1180_cs(1);
|
|
cs1180_cs(1);
|
|
|
|
|
|