-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.c
47 lines (43 loc) · 1.34 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* cm0test - Hello world program for Cortex-M0.
* Copyright (C) 2019-2019 Johannes Bauer
*
* This file is part of cm0test.
*
* cm0test 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; this program is ONLY licensed under
* version 3 of the License, later versions are explicitly excluded.
*
* cm0test 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 cm0test; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Johannes Bauer <JohannesBauer@gmx.de>
**/
#include <stdint.h>
#include <stdbool.h>
#include <stm32g0xx_hal_rcc.h>
#include <stm32g0xx_hal_gpio.h>
#include <stm32g0xx_hal_dma.h>
#include <stm32g0xx_hal_tim.h>
#include <stm32g0xx_ll_tim.h>
#include <stm32g031xx.h>
#include "main.h"
static void delay(uint32_t duration) {
volatile uint32_t ctr = duration;
while (ctr--);
}
int main(void) {
while (true) {
GPIOA->BSRR = GPIO_PIN_12;
delay(1000000);
GPIOA->BRR = GPIO_PIN_12;
delay(2000000);
}
}