diff options
| author | Physick <96335032+DegustatorPonos@users.noreply.github.com> | 2026-01-02 22:41:25 +0500 |
|---|---|---|
| committer | Physick <96335032+DegustatorPonos@users.noreply.github.com> | 2026-01-02 22:41:25 +0500 |
| commit | 9477bf2b6cce08f648b1d9b3c37a2bf697854e70 (patch) | |
| tree | 7c94f575961e41e50d65052d473735b6daa11f0e /src | |
Not working version
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile | 19 | ||||
| -rw-r--r-- | src/main.c | 37 |
2 files changed, 56 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..a32c435 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,19 @@ +PROJECT = blink-led +BUILD_DIR = bin + +SHARED_DIR = ../lib +CFILES = main.c +CFILES += ili9341.c +CFILES += spi_sw.c + +# TODO - you will need to edit these two lines! +DEVICE=stm32f103c8 + +# You shouldn't have to edit anything below here. +VPATH += $(SHARED_DIR) +INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR)) +OPENCM3_DIR=../libopencm3 + +include $(OPENCM3_DIR)/mk/genlink-config.mk +include ../rules.mk +include $(OPENCM3_DIR)/mk/genlink-rules.mk 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++; + } +} |
