mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[ion] Define FRAMEBUFFER_LENGTH
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include <ion.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "display/gpio.h"
|
||||
#include "display/spi.h"
|
||||
@@ -52,5 +53,13 @@ void init_display() {
|
||||
|
||||
st7586_set_display_area(controller, 0, FRAMEBUFFER_WIDTH, 0, FRAMEBUFFER_HEIGHT);
|
||||
|
||||
st7586_enable_frame_data_upload(controller);
|
||||
|
||||
memset(FRAMEBUFFER_ADDRESS, 0, FRAMEBUFFER_LENGTH);
|
||||
|
||||
for (int i=0;i<10;i++) {
|
||||
ion_set_pixel(i,i,0x3);
|
||||
}
|
||||
|
||||
display_dma_init();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#include "../registers/registers.h"
|
||||
#include "../framebuffer.h"
|
||||
|
||||
// DMA 1, channel 0, stream 4 = SPI2_TX
|
||||
#define LCD_DMA_CHANNEL 0
|
||||
#define LCD_DMA_STREAM 4
|
||||
|
||||
extern char _framebuffer_start, _framebuffer_end;
|
||||
|
||||
void display_dma_init() {
|
||||
// 0 - ENable DMA clock!
|
||||
RCC_AHB1ENR |= DMA1EN;
|
||||
@@ -20,11 +19,10 @@ void display_dma_init() {
|
||||
DMA_SPAR(DMA1,LCD_DMA_STREAM) = (uint32_t)&SPI_DR(SPI2);
|
||||
|
||||
// 3 - Set the memory address
|
||||
DMA_SMA0R(DMA1,LCD_DMA_STREAM) = (uint32_t)&_framebuffer_start;
|
||||
DMA_SMA0R(DMA1,LCD_DMA_STREAM) = (uint32_t)FRAMEBUFFER_ADDRESS;
|
||||
|
||||
// 4 - Number of data items
|
||||
//DMA_SNDTR(DMA1,LCD_DMA_STREAM) = &_framebuffer_end-&_framebuffer_start;
|
||||
REGISTER_SET_VALUE(DMA_SNDTR(DMA1,LCD_DMA_STREAM), DMA_SNDTR, &_framebuffer_end-&_framebuffer_start);
|
||||
REGISTER_SET_VALUE(DMA_SNDTR(DMA1,LCD_DMA_STREAM), DMA_SNDTR, FRAMEBUFFER_LENGTH);
|
||||
|
||||
// 5 - Select the DMA channel
|
||||
REGISTER_SET_VALUE(DMA_SCR(DMA1,LCD_DMA_STREAM), DMA_CHSEL, LCD_DMA_CHANNEL);
|
||||
|
||||
@@ -2,6 +2,7 @@ extern char _framebuffer_start;
|
||||
extern char _framebuffer_end;
|
||||
|
||||
#define FRAMEBUFFER_ADDRESS (&_framebuffer_start)
|
||||
#define FRAMEBUFFER_LENGTH (&_framebuffer_end-&_framebuffer_start)
|
||||
#define FRAMEBUFFER_WIDTH 160
|
||||
#define FRAMEBUFFER_HEIGHT 160
|
||||
#define FRAMEBUFFER_BITS_PER_PIXEL 4
|
||||
|
||||
Reference in New Issue
Block a user