mirror of
https://github.com/ayabusa/Numworks-zeta-os.git
synced 2024-11-21 18:53:24 +00:00
added LCD skeleton (broken)
This commit is contained in:
parent
c11db55fdc
commit
73681aa79c
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -22,6 +22,7 @@
|
|||||||
"stm32f730xx.h": "c",
|
"stm32f730xx.h": "c",
|
||||||
"keyboard.h": "c",
|
"keyboard.h": "c",
|
||||||
"gpio_helper.h": "c",
|
"gpio_helper.h": "c",
|
||||||
"stdint.h": "c"
|
"stdint.h": "c",
|
||||||
|
"clock.h": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
1
Makefile
1
Makefile
@ -47,6 +47,7 @@ CFLAGS += -g
|
|||||||
CFLAGS += -fmessage-length=0
|
CFLAGS += -fmessage-length=0
|
||||||
# (Set system to ignore semihosted junk)
|
# (Set system to ignore semihosted junk)
|
||||||
CFLAGS += --specs=nosys.specs
|
CFLAGS += --specs=nosys.specs
|
||||||
|
CFLAGS += -O0
|
||||||
|
|
||||||
# Linker directives.
|
# Linker directives.
|
||||||
LSCRIPT = $(LD_SCRIPT)
|
LSCRIPT = $(LD_SCRIPT)
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
build/Laplace/lcd.o
Normal file
BIN
build/Laplace/lcd.o
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
build/main.bin
BIN
build/main.bin
Binary file not shown.
BIN
build/main.elf
BIN
build/main.elf
Binary file not shown.
BIN
build/main.o
BIN
build/main.o
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
build/working_main.bin
Executable file
BIN
build/working_main.bin
Executable file
Binary file not shown.
BIN
build/working_main.elf
Executable file
BIN
build/working_main.elf
Executable file
Binary file not shown.
@ -1,4 +1,5 @@
|
|||||||
#include "clock.h"
|
#include "clock.h"
|
||||||
|
#include "../device/stm32f730xx.h"
|
||||||
|
|
||||||
/* This should set the speed to 216MHz intead of just 48MHz */
|
/* This should set the speed to 216MHz intead of just 48MHz */
|
||||||
void init_clock(){
|
void init_clock(){
|
||||||
@ -78,7 +79,7 @@ void init_clock(){
|
|||||||
|
|
||||||
// Set normal speed
|
// Set normal speed
|
||||||
RCC->CFGR &= ~(RCC_CFGR_HPRE_Msk);
|
RCC->CFGR &= ~(RCC_CFGR_HPRE_Msk);
|
||||||
|
/*
|
||||||
// UNSAFE CODE
|
// UNSAFE CODE
|
||||||
// 23999<=>0b0101 1101 1011 1111
|
// 23999<=>0b0101 1101 1011 1111
|
||||||
SysTick->LOAD &= ~(0b00000000111111111111111111111111);
|
SysTick->LOAD &= ~(0b00000000111111111111111111111111);
|
||||||
@ -87,7 +88,9 @@ void init_clock(){
|
|||||||
SysTick->VAL &= ~(0b00000000111111111111111111111111);
|
SysTick->VAL &= ~(0b00000000111111111111111111111111);
|
||||||
//set some things in CSR
|
//set some things in CSR
|
||||||
SysTick->CTRL &= ~(0b00000000000000000000000000000111);
|
SysTick->CTRL &= ~(0b00000000000000000000000000000111);
|
||||||
SysTick->CTRL |= 0b00000000000000000000000000000011;
|
SysTick->CTRL |= 0b00000000000000000000000000000011;*/
|
||||||
|
|
||||||
|
set_led_green(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OLD
|
/* OLD
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
#ifndef CLOCK_H
|
#ifndef CLOCK_H
|
||||||
#define CLOCK_H
|
#define CLOCK_H
|
||||||
|
|
||||||
#include "stdint.h"
|
|
||||||
#include "../device/stm32f730xx.h"
|
#include "../device/stm32f730xx.h"
|
||||||
|
#include "stdint.h"
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#define KEYBOARD_H
|
#define KEYBOARD_H
|
||||||
|
|
||||||
#include "gpio_helper.h"
|
#include "gpio_helper.h"
|
||||||
|
#include "time.h"
|
||||||
|
|
||||||
struct button{
|
struct button{
|
||||||
uint8_t column; // ie: 2
|
uint8_t column; // ie: 2
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
/* Initialize all needed peripherals, should be called early in your program */
|
/* Initialize all needed peripherals, should be called early in your program */
|
||||||
void laplace_init(){
|
void laplace_init(){
|
||||||
|
init_clock();
|
||||||
/* led init */
|
/* led init */
|
||||||
enable_gpio_x_rcc(GPIO_B);
|
enable_gpio_x_rcc(GPIO_B);
|
||||||
led_init();
|
led_init();
|
||||||
@ -10,5 +11,5 @@ void laplace_init(){
|
|||||||
enable_gpio_x_rcc(GPIO_C); //column (in)
|
enable_gpio_x_rcc(GPIO_C); //column (in)
|
||||||
enable_gpio_x_rcc(GPIO_A); //row (out)
|
enable_gpio_x_rcc(GPIO_A); //row (out)
|
||||||
keyboard_init();
|
keyboard_init();
|
||||||
init_clock();
|
lcd_init();
|
||||||
}
|
}
|
@ -11,6 +11,7 @@
|
|||||||
#include "led.h"
|
#include "led.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "clock.h"
|
#include "clock.h"
|
||||||
|
#include "lcd.h"
|
||||||
|
|
||||||
/* Initialize all needed peripherals, should be called early in your program */
|
/* Initialize all needed peripherals, should be called early in your program */
|
||||||
void laplace_init();
|
void laplace_init();
|
||||||
|
55
src/Laplace/lcd.c
Normal file
55
src/Laplace/lcd.c
Normal file
@ -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;
|
||||||
|
}*/
|
40
src/Laplace/lcd.h
Normal file
40
src/Laplace/lcd.h
Normal file
@ -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
|
@ -34,9 +34,9 @@ void main_entry(){
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
set_led_blue(true);
|
set_led_blue(true);
|
||||||
ms_wait(5000);
|
ms_wait(500);
|
||||||
set_led_blue(false);
|
set_led_blue(false);
|
||||||
ms_wait(5000);
|
ms_wait(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -11,6 +11,7 @@
|
|||||||
#include "Laplace/led.h"
|
#include "Laplace/led.h"
|
||||||
#include "Laplace/keyboard.h"
|
#include "Laplace/keyboard.h"
|
||||||
#include "Laplace/time.h"
|
#include "Laplace/time.h"
|
||||||
|
#include "Laplace/clock.h"
|
||||||
|
|
||||||
/* our main function */
|
/* our main function */
|
||||||
void main_entry();
|
void main_entry();
|
||||||
|
Loading…
Reference in New Issue
Block a user