Skip to content
Snippets Groups Projects
Commit cf1e47fc authored by moon2's avatar moon2 :speech_balloon:
Browse files

display: rotated scope 90deg for the usual orientation

parent 177f5c2a
No related branches found
No related tags found
No related merge requests found
...@@ -67,13 +67,8 @@ void display_fill(uint16_t col){ ...@@ -67,13 +67,8 @@ void display_fill(uint16_t col){
} }
void display_draw_scope(){ void display_draw_scope(){
uint16_t line[240]; if(!scope_active) return;
begin_scope_read(); scope_write_to_framebuffer(&ScreenBuff);
for(int y=0; y<240; y++){
read_line_from_scope(&(line[0]), y);
memcpy(&ScreenBuff[y * 240], line, sizeof(line));
}
end_scope_read();
GC9A01_Update(); GC9A01_Update();
} }
......
...@@ -10,6 +10,4 @@ typedef struct { ...@@ -10,6 +10,4 @@ typedef struct {
void init_scope(uint16_t size); void init_scope(uint16_t size);
void write_to_scope(int16_t value); void write_to_scope(int16_t value);
void begin_scope_read(); void scope_write_to_framebuffer(uint16_t * framebuffer);
void end_scope_read();
void read_line_from_scope(uint16_t * line, int16_t point);
...@@ -30,8 +30,17 @@ void begin_scope_read(){ ...@@ -30,8 +30,17 @@ void begin_scope_read(){
scope->is_being_read = 1; //best mutex scope->is_being_read = 1; //best mutex
} }
void read_line_from_scope(uint16_t * line, int16_t point){ void end_scope_read(){
memset(line, 0, 480); if(scope == NULL) return;
scope->is_being_read = 0; //best mutex
}
void scope_write_to_framebuffer(uint16_t * framebuffer){
//assumes 240x240 16bit framebuffer for now
begin_scope_read();
memset(framebuffer, 0, 240*240*sizeof(uint16_t));
for(int point = 0; point < 240; point++){
int16_t startpoint = scope->write_head_position - point; int16_t startpoint = scope->write_head_position - point;
while(startpoint < 0){ while(startpoint < 0){
startpoint += scope->buffer_size; startpoint += scope->buffer_size;
...@@ -53,11 +62,8 @@ void read_line_from_scope(uint16_t * line, int16_t point){ ...@@ -53,11 +62,8 @@ void read_line_from_scope(uint16_t * line, int16_t point){
stop = inter; stop = inter;
} }
for(int16_t i = start; i <= stop; i++){ for(int16_t i = start; i <= stop; i++){
line[i] = 255; framebuffer[point + i*240] = 255;
} }
} }
end_scope_read();
void end_scope_read(){
if(scope == NULL) return;
scope->is_being_read = 0; //best mutex
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment