summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ili9341.c8
-rw-r--r--src/main.c19
2 files changed, 13 insertions, 14 deletions
diff --git a/lib/ili9341.c b/lib/ili9341.c
index 5aba148..6da22be 100644
--- a/lib/ili9341.c
+++ b/lib/ili9341.c
@@ -85,6 +85,8 @@ void ILI_Setup(void) {
ILI_hard_reset();
ILI_sendComand(ILI9341_SOFTRESET);
delayCycles(500000);
+
+ /*
ILI_sendComand(0xEF);
ILI_sendData(0x03);
@@ -107,6 +109,8 @@ void ILI_Setup(void) {
ILI_sendData(0x00);
ILI_sendData(0x78);
+ */
+
// Power control A
ILI_sendComand(ILI9341_POWERCONTROL_A);
ILI_sendData(0x39);
@@ -231,13 +235,13 @@ void ILI_Setup(void) {
// Set position to write to
void ILI_setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) {
- ILI_sendComand(ILI9341_SET_COLUMN);
+ ILI_sendComand(ILI9341_SET_ROW);
ILI_sendData((x0 >> 8) & 0xFF);
ILI_sendData(x0 & 0xFF);
ILI_sendData((x1 >> 8) & 0xFF);
ILI_sendData(x1 & 0xFF);
- ILI_sendComand(ILI9341_SET_ROW);
+ ILI_sendComand(ILI9341_SET_COLUMN);
ILI_sendData((y0 >> 8) & 0xFF);
ILI_sendData(y0 & 0xFF);
ILI_sendData((y1 >> 8) & 0xFF);
diff --git a/src/main.c b/src/main.c
index b68eded..233757b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -18,20 +18,15 @@ int main(void) {
ILI_SetupGPIO();
ILI_Setup();
-
- // gpio_set(GPIOC, GPIO13);
- // for (uint32_t i = 0; i < 1000000; i++) {
- // __asm__("nop");
- // }
-
+
+ delayCycles(1000000);
uint16_t colour = 0x0000;
+ ILI_setAddrWindow(0, 0, 9, 9);
+ for (int i = 0; i < 100; i++) {
+ ILI_sendData((colour >> 8) & 0xFF);
+ ILI_sendData(colour & 0xFF);
+ }
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++;
}
}