From b489a1b12f2f574ed24237601b3797b58d302196 Mon Sep 17 00:00:00 2001 From: jaseg Date: Thu, 27 Feb 2020 14:39:18 +0100 Subject: Add a bunch of deps --- controller/fw/main.c | 76 ---------------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 controller/fw/main.c (limited to 'controller/fw/main.c') diff --git a/controller/fw/main.c b/controller/fw/main.c deleted file mode 100644 index 3131df1..0000000 --- a/controller/fw/main.c +++ /dev/null @@ -1,76 +0,0 @@ - -#include - -#include -#include -#include - -#include "spi_flash.h" - -static struct spi_flash_if spif; - -static void clock_setup(void) -{ - rcc_clock_setup_pll(&rcc_hse_8mhz_3v3[RCC_CLOCK_3V3_168MHZ]); - rcc_periph_clock_enable(RCC_GPIOA); - rcc_periph_clock_enable(RCC_GPIOB); - rcc_periph_clock_enable(RCC_SPI1); -} - -static void led_setup(void) -{ - gpio_mode_setup(GPIOA, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO6 | GPIO7); -} - -static void spi_flash_if_set_cs(bool val) { - if (val) - gpio_set(GPIOB, GPIO0); - else - gpio_clear(GPIOB, GPIO0); -} - -static void spi_flash_setup(void) -{ - gpio_mode_setup(GPIOB, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO3 | GPIO4 | GPIO5); /* SPI flash SCK/MISO/MOSI */ - gpio_mode_setup(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO0); /* SPI flash CS */ - gpio_set_output_options(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO0 | GPIO3 | GPIO4 | GPIO5); - gpio_set_af(GPIOB, 5, GPIO3 | GPIO4 | GPIO5); - - spif_init(&spif, 256, SPI1, &spi_flash_if_set_cs); -} - -/* -void spi_flash_test(void) { - spif_clear_mem(&spif); - - uint32_t buf[1024]; - for (size_t addr=0; addr<0x10000; addr += sizeof(buf)) { - for (size_t i=0; i