summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorPhysick <96335032+DegustatorPonos@users.noreply.github.com>2026-01-02 22:41:25 +0500
committerPhysick <96335032+DegustatorPonos@users.noreply.github.com>2026-01-02 22:41:25 +0500
commit9477bf2b6cce08f648b1d9b3c37a2bf697854e70 (patch)
tree7c94f575961e41e50d65052d473735b6daa11f0e /src/main.c
Not working version
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..b68eded
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,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++;
+ }
+}