"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
CFLAGS += -fmessage-length=0
# (Set system to ignore semihosted junk)
CFLAGS += --specs=nosys.specs
+CFLAGS += -O0
# Linker directives.
LSCRIPT = $(LD_SCRIPT)
#include "clock.h"
+#include "../device/stm32f730xx.h"
/* This should set the speed to 216MHz intead of just 48MHz */
void init_clock(){
// Set normal speed
RCC->CFGR &= ~(RCC_CFGR_HPRE_Msk);
-
+ /*
// UNSAFE CODE
// 23999<=>0b0101 1101 1011 1111
SysTick->LOAD &= ~(0b00000000111111111111111111111111);
SysTick->VAL &= ~(0b00000000111111111111111111111111);
//set some things in CSR
SysTick->CTRL &= ~(0b00000000000000000000000000000111);
- SysTick->CTRL |= 0b00000000000000000000000000000011;
+ SysTick->CTRL |= 0b00000000000000000000000000000011;*/
+
+ set_led_green(true);
}
/* OLD
#ifndef CLOCK_H
#define CLOCK_H
-#include "stdint.h"
#include "../device/stm32f730xx.h"
+#include "stdint.h"
#include "led.h"
/*
#define KEYBOARD_H
#include "gpio_helper.h"
+#include "time.h"
struct button{
uint8_t column; // ie: 2
/* 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();
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
#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();
--- /dev/null
+#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
--- /dev/null
+/** @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
}*/
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
#include "Laplace/led.h"
#include "Laplace/keyboard.h"
#include "Laplace/time.h"
+#include "Laplace/clock.h"
/* our main function */
void main_entry();