]> git.ayabusa.dev Git - numworks-zeta-os.git/commitdiff
added LCD skeleton (broken)
authorayabusa <lebgpub@gmail.com>
Thu, 25 Apr 2024 13:31:30 +0000 (15:31 +0200)
committerayabusa <lebgpub@gmail.com>
Thu, 25 Apr 2024 13:31:30 +0000 (15:31 +0200)
26 files changed:
.vscode/settings.json
Makefile
build/Laplace/clock.o
build/Laplace/gpio_helper.o
build/Laplace/keyboard.o
build/Laplace/laplace.o
build/Laplace/lcd.o [new file with mode: 0644]
build/Laplace/led.o
build/Laplace/time.o
build/info_headers.o
build/main.bin
build/main.elf
build/main.o
build/start_handler.o
build/vector_table.o
build/working_main.bin [new file with mode: 0755]
build/working_main.elf [new file with mode: 0755]
src/Laplace/clock.c
src/Laplace/clock.h
src/Laplace/keyboard.h
src/Laplace/laplace.c
src/Laplace/laplace.h
src/Laplace/lcd.c [new file with mode: 0644]
src/Laplace/lcd.h [new file with mode: 0644]
src/main.c
src/main.h

index 90879a8d26724668467db26caf8214f50c49c984..77d7cb8882a63c65913355d3e27097bb54d5d004 100644 (file)
@@ -22,6 +22,7 @@
         "stm32f730xx.h": "c",
         "keyboard.h": "c",
         "gpio_helper.h": "c",
-        "stdint.h": "c"
+        "stdint.h": "c",
+        "clock.h": "c"
     }
 }
\ No newline at end of file
index 455c30a4a4451ea46712627ce5c284a044603e93..2854feac853abbb42346ca1854e5e313fff38ea9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -47,6 +47,7 @@ CFLAGS += -g
 CFLAGS += -fmessage-length=0
 # (Set system to ignore semihosted junk)
 CFLAGS += --specs=nosys.specs
+CFLAGS += -O0
 
 # Linker directives.
 LSCRIPT = $(LD_SCRIPT)
index 182dca0591fd19ee99e8a3fc074898c12f34103b..11186027471716767e9920ea125a674f99825bf3 100644 (file)
Binary files a/build/Laplace/clock.o and b/build/Laplace/clock.o differ
index 1b90e95773a4b61fd31851ae5e564fcded8da67c..0216c7913cb0a98a54974da14f12e0ad52093e9f 100644 (file)
Binary files a/build/Laplace/gpio_helper.o and b/build/Laplace/gpio_helper.o differ
index b517e5973fb5923a0ee31f003b963a6f515ac4cf..d20518ce9b7bed3d76eba1c41a73c0da1c5c47af 100644 (file)
Binary files a/build/Laplace/keyboard.o and b/build/Laplace/keyboard.o differ
index b93b56a1428b53c79f810292e9ac3844968930c8..a45af194d57827994756bd130a1184436ebcbc08 100644 (file)
Binary files a/build/Laplace/laplace.o and b/build/Laplace/laplace.o differ
diff --git a/build/Laplace/lcd.o b/build/Laplace/lcd.o
new file mode 100644 (file)
index 0000000..f583644
Binary files /dev/null and b/build/Laplace/lcd.o differ
index fb9c2e21c7c2a63a1ecb841b797ba2280a5e1190..345b97c9fa826d5d954adf839a99c324edf58d4b 100644 (file)
Binary files a/build/Laplace/led.o and b/build/Laplace/led.o differ
index 5d25b1ec0f7556fed8e3d433f89c69cb85887503..ab9a9f4b879ee6568709467a055e54424d0e46b8 100644 (file)
Binary files a/build/Laplace/time.o and b/build/Laplace/time.o differ
index f52abfde37b4040bc1c1554ddf9e39fd7cfae8ee..f29ae2835c50c0298a069007713efa2a6aeeeab0 100644 (file)
Binary files a/build/info_headers.o and b/build/info_headers.o differ
index e40322c3bc03ec15c5c559d8a5e6ace69cc9be7c..9fc84eefe8395cef042f7847738d816dc3c33391 100755 (executable)
Binary files a/build/main.bin and b/build/main.bin differ
index 444eedcc1ae2edb78ae29f29dc31dbfc2219661e..9187d1d37c1235f1c2f3fc6b97394340755b3bd7 100755 (executable)
Binary files a/build/main.elf and b/build/main.elf differ
index b5601668f96494505469d464e8935eb3ca931e65..b36488c31be8afe035d8195a6a97b6b3d46f704a 100644 (file)
Binary files a/build/main.o and b/build/main.o differ
index 7dbb8092057accd2b112952c2f3f843bd7e04ad5..24f8e3dac76e08aa5e98076fbe71a923313a78e2 100644 (file)
Binary files a/build/start_handler.o and b/build/start_handler.o differ
index e543fb5d3c24334df87f1bca11f1c5c9ada6b5e6..f996f5f715566fcb2f01498713f3128aaad73aa4 100644 (file)
Binary files a/build/vector_table.o and b/build/vector_table.o differ
diff --git a/build/working_main.bin b/build/working_main.bin
new file mode 100755 (executable)
index 0000000..db52213
Binary files /dev/null and b/build/working_main.bin differ
diff --git a/build/working_main.elf b/build/working_main.elf
new file mode 100755 (executable)
index 0000000..6d5e910
Binary files /dev/null and b/build/working_main.elf differ
index 78033029230e512b3ca205a351926e4a17f16d6e..e292f4a1e19846a642d99957c898e8f961a39489 100644 (file)
@@ -1,4 +1,5 @@
 #include "clock.h"
+#include "../device/stm32f730xx.h"
 
 /* This should set the speed to 216MHz intead of just 48MHz */
 void init_clock(){
@@ -78,7 +79,7 @@ void init_clock(){
 
     // Set normal speed
     RCC->CFGR &= ~(RCC_CFGR_HPRE_Msk);
-
+    /*
     // UNSAFE CODE
     // 23999<=>0b0101 1101 1011 1111
     SysTick->LOAD &= ~(0b00000000111111111111111111111111);
@@ -87,7 +88,9 @@ void init_clock(){
     SysTick->VAL &= ~(0b00000000111111111111111111111111);
     //set some things in CSR
     SysTick->CTRL &= ~(0b00000000000000000000000000000111);
-    SysTick->CTRL |= 0b00000000000000000000000000000011;
+    SysTick->CTRL |= 0b00000000000000000000000000000011;*/
+
+    set_led_green(true);
 }
 
 /* OLD
index da7fd2f2580a1fb62c34e05d2f1ec60226d3ddea..f60c307a667ea6a4ac7d2138d2b757c18410c96e 100644 (file)
@@ -7,8 +7,8 @@
 #ifndef CLOCK_H
 #define CLOCK_H
 
-#include "stdint.h"
 #include "../device/stm32f730xx.h"
+#include "stdint.h"
 #include "led.h"
 
 /*
index 942c240e7dc43b33de6cc0c2749eee376f3fe2cd..fd742fe23c94c6a274afa4872cabfe7187ed2c6c 100644 (file)
@@ -8,6 +8,7 @@
 #define KEYBOARD_H
 
 #include "gpio_helper.h"
+#include "time.h"
 
 struct button{
        uint8_t column; // ie: 2
index abc4c1b9bcf488774c94d7bfc4120f9011c131ef..8133c5652f939c0e714fe5332dab61f2c725203f 100644 (file)
@@ -2,6 +2,7 @@
 
 /* Initialize all needed peripherals, should be called early in your program */
 void laplace_init(){
+    init_clock();
     /* led init */
     enable_gpio_x_rcc(GPIO_B);
     led_init();
@@ -10,5 +11,5 @@ void laplace_init(){
     enable_gpio_x_rcc(GPIO_C); //column (in)
     enable_gpio_x_rcc(GPIO_A); //row (out)
     keyboard_init();
-    init_clock();
+    lcd_init();
 }
\ No newline at end of file
index e66addd0b67085ff163fb55920f63e8c1233891b..fca4239c76c4e17b43f561f9f579806f446eaf37 100644 (file)
@@ -11,6 +11,7 @@
 #include "led.h"
 #include "keyboard.h"
 #include "clock.h"
+#include "lcd.h"
 
 /* Initialize all needed peripherals, should be called early in your program */
 void laplace_init();
diff --git a/src/Laplace/lcd.c b/src/Laplace/lcd.c
new file mode 100644 (file)
index 0000000..dfa300d
--- /dev/null
@@ -0,0 +1,55 @@
+#include "lcd.h"
+
+/* This should be called before accessing any other led related feature
+   as it sets up all led related peripherals */
+void lcd_init(){
+    int _var = 1336+1;
+    //init_DMA();
+    draw_screen();
+}
+
+void draw_screen(){
+
+}
+
+// send command to the LCD
+void send_command(uint16_t command){
+    *COMMAND_ADDRESS = command;
+}
+
+// send data to the LCD, should be called after sending the command
+void send_data(uint16_t data){
+    *DATA_ADDRESS = data;
+}
+
+// we assume orientations is portrait
+void set_drawing_area(r/*TODO*/){
+    send_command(MEMORY_ACCESS_CONTROL);
+    send_data(0x00);
+
+    send_command(COLUMN_ADDRESS_SET);
+    send_data();
+
+    send_command(PAGE_ADDRESS_SET);
+    send_data();
+}
+
+void start_DMA_upload(){
+
+}
+
+/*void init_DMA(){
+    // clear specified bits
+    DMA2_Stream0->CR &= ~(0b00000001111000000111110011000001);
+    // set them to the correct value*/
+    /* DIR = 2 = 0b10
+     * MSIZE = 1 = 0b1
+     * PSIZE = 1 = 0b1
+     * MBURST = 1 = 0b1
+     * PBURST =  1 = 0b1
+     * MINC = false = 0b0 */
+    /*DMA2_Stream0->CR |= 0b00000000101000000010100010000000;
+    // DataAddress is 0x60020000 = 0b0110 0000 0000 0010 0000 0000 0000 0000
+    DMA2_Stream0->M0AR &= ~(0b11111111111111111111111111111111);
+    DMA2_Stream0->M0AR |= 0b01100000000000100000000000000000;
+}*/
\ No newline at end of file
diff --git a/src/Laplace/lcd.h b/src/Laplace/lcd.h
new file mode 100644 (file)
index 0000000..d148df7
--- /dev/null
@@ -0,0 +1,40 @@
+/** @file lcd.h
+ * 
+ * @brief Control the lcd
+ *
+ */ 
+
+#ifndef LCD_H
+#define LCD_H
+
+#include <stdint.h>
+#include "../device/stm32f730xx.h"
+
+uint16_t volatile * const COMMAND_ADDRESS = (uint16_t *) 0x60000000;
+uint16_t volatile * const DATA_ADDRESS = (uint16_t *) 0x60020000;
+// to set them use : *COMMAND_ADDRESS = 0x1234;
+
+// define the differents command
+#define NOP 0x00
+#define RESET 0x01
+#define READ_DISPLAY_ID 0x04
+#define SLEEP_IN 0x10
+#define SLEEP_OUT 0x11
+#define DISPLAY_INVERSION_OFF 0x20
+#define DISPLAY_INVERSION_ON 0x21
+#define DISPLAY_OFF 0x28
+#define DISPLAY_ON 0x29
+#define COLUMN_ADDRESS_SET 0x2A
+#define PAGE_ADDRESS_SET 0x2B
+#define MEMORY_WRITE 0x2C
+#define MEMORY_READ 0x2E
+#define TEARING_EFFECT_LINE_ON 0x35
+#define MEMORY_ACCESS_CONTROL 0x36
+#define PIXEL_FORMAT_SET 0x3A
+#define FRAME_RATE_CONTROL 0xC6
+#define POSITIVE_VOLTAGE_GAMMA_CONTROL 0xE0
+#define NEGATIVE_VOLTAGE_GAMMA_CONTROL 0xE1
+
+void lcd_init();
+
+#endif
\ No newline at end of file
index 235f83e120485dc0aa7528f38a2c97af6568796e..b520001d28a7012a21d44bf9a24476c5f1f48d89 100644 (file)
@@ -34,9 +34,9 @@ void main_entry(){
         }*/
 
         set_led_blue(true);
-        ms_wait(5000);
+        ms_wait(500);
         set_led_blue(false);
-        ms_wait(5000);
+        ms_wait(500);
     }
     
 }
\ No newline at end of file
index 8626abb891800dcd51f9a658bd3c5494726e788f..a4991d38f8bc8db868ba6bafa3c6b9b8c64b4289 100644 (file)
@@ -11,6 +11,7 @@
 #include "Laplace/led.h"
 #include "Laplace/keyboard.h"
 #include "Laplace/time.h"
+#include "Laplace/clock.h"
 
 /* our main function */
 void main_entry();