blob: 73ccb17d8dfe24b282d6bc04b9c912a2de0a3de3 (
plain) (
blame)
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
48
49
50
51
52
|
#include "arch.h"
#include "core/clock.h"
#include "core/dma.h"
#include "core/gpio.h"
#include "core/isr_vector.h"
#include "core/system.h"
#include "core/usart.h"
#include "delay.h"
#include "lib.h"
#include "mem.h"
#include "spin.h"
#include "string.h"
#ifdef ARCH_STM32L4
/** Overrides the default systick irq handler. */
void on_systick()
{
static int is_on = 0;
__IO gpio_port_t* port_b = enable_gpio(GPIO_PORT_B);
gpio_output_pin_t pin3 = set_gpio_pin_output(port_b, PIN_3);
if (is_on) {
pin_off(pin3);
} else {
pin_on(pin3);
}
is_on = ! is_on;
}
/* Main function. This gets executed from the interrupt vector defined above. */
int main()
{
/* Enable a higher clock frequency. */
set_system_clock_MHz(80);
/* Set the countdown to start from 1,000,0000. */
SCB.strv_r = 10000000;
/* Enable interrupts. */
SCB.stcs_bf.tickint = 1;
/* Start the systick. */
SCB.stcs_bf.enable = 1;
}
#endif
|