blob: b68eded153879a423855d43e9e0c5863463c08cc (
plain)
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
|
#define STM32F1
#include <stdint.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/gpio.h>
#include <ili9341.h>
#define LED_PIN GPIO13
int main(void) {
// Enabling peripheral clocks
rcc_periph_clock_enable(RCC_GPIOA);
rcc_periph_clock_enable(RCC_GPIOB);
rcc_periph_clock_enable(RCC_GPIOC);
rcc_periph_clock_enable(RCC_SPI1);
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, LED_PIN);
gpio_set(GPIOC, GPIO13);
ILI_SetupGPIO();
ILI_Setup();
// gpio_set(GPIOC, GPIO13);
// for (uint32_t i = 0; i < 1000000; i++) {
// __asm__("nop");
// }
uint16_t colour = 0x0000;
while (1) {
ILI_setAddrWindow(0, 0, 9, 9);
for (int i = 0; i < 100; i++) {
ILI_sendData((colour >> 8) & 0xFF);
ILI_sendData(colour & 0xFF);
}
colour++;
}
}
|