diff options
author | jaseg <git@jaseg.de> | 2023-09-25 23:57:36 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2023-09-25 23:57:36 +0200 |
commit | 8cc05c79cea62609d02231492c054a0cca2b2289 (patch) | |
tree | e39d40456adefe9bb70bcd77ebdf97be1dcdc028 /center_fw/main.c | |
parent | 583ac10d1450610a4110849c26cc16f03154d26e (diff) | |
download | 8seg-8cc05c79cea62609d02231492c054a0cca2b2289.tar.gz 8seg-8cc05c79cea62609d02231492c054a0cca2b2289.tar.bz2 8seg-8cc05c79cea62609d02231492c054a0cca2b2289.zip |
Center firmware WIP
Diffstat (limited to 'center_fw/main.c')
-rw-r--r-- | center_fw/main.c | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/center_fw/main.c b/center_fw/main.c deleted file mode 100644 index 3008dd2..0000000 --- a/center_fw/main.c +++ /dev/null @@ -1,73 +0,0 @@ -/* Megumin LED display firmware - * Copyright (C) 2018 Sebastian Götte <code@jaseg.net> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "global.h" - -int main(void) { - //RCC->CR |= RCC_CR_HSEON; - //while (!(RCC->CR&RCC_CR_HSERDY)); - RCC->CFGR &= ~RCC_CFGR_PLLMUL_Msk & ~RCC_CFGR_SW_Msk & ~RCC_CFGR_PPRE_Msk & ~RCC_CFGR_HPRE_Msk; - RCC->CFGR |= ((12-2)<<RCC_CFGR_PLLMUL_Pos); /* PLL / 2 * 12 -> 48.0MHz */ - RCC->CR |= RCC_CR_PLLON; - while (!(RCC->CR&RCC_CR_PLLRDY)); - RCC->CFGR |= (2<<RCC_CFGR_SW_Pos); - SystemCoreClockUpdate(); - - /* Turn on lots of neat things */ - RCC->AHBENR |= RCC_AHBENR_GPIOAEN; - - GPIOA->MODER |= - (1<<GPIO_MODER_MODER0_Pos) - | (1<<GPIO_MODER_MODER1_Pos); - - int cnt = 0; - int ph = 0; - while (42) { - if (cnt > 5000) { - cnt = 0; - ph += 1; - ph %= 4; - } else { - cnt = cnt+1; - } - switch (ph) { - case 0: GPIOA->ODR = 1; break; - case 1: GPIOA->ODR = 3; break; - case 2: GPIOA->ODR = 2; break; - case 3: GPIOA->ODR = 0; break; - } - } -} - -void NMI_Handler(void) { - asm volatile ("bkpt"); -} - -void HardFault_Handler(void) __attribute__((naked)); -void HardFault_Handler() { - asm volatile ("bkpt"); -} - -void SVC_Handler(void) { - asm volatile ("bkpt"); -} - - -void PendSV_Handler(void) { - asm volatile ("bkpt"); -} - |