i am learning at the moment the handle of graphical displays… specially the waveform display
now i stuckking, i already have X-Y coordinates, and a timline… in theory it is working, it works with Characters… but i need pixels
i stuck by writing a single pixel to the display, i want to write a pixel every millisecond, and after the time of the loop (loop point 0) it should clear the display… (APP_LCD_Clear();))
is there a way to directly draw a single pixel, without the must of " changing a bitmap, and print the whole bitmap again…"
i can set the courser with:
APP_LCD_Clear();
APP_LCD_Cmd(0x75); // Row
APP_LCD_Data(V);
APP_LCD_Cmd(0x15); // Column
APP_LCD_Data(H);
but then i have no command to activate a pixel, has it something to do with the write ram >>> APP_LCD_Cmd(0x5C);
// calculate H V Positions V = v \* aout[x].lfo[y];if(V \<= 0) { V=0;}if(V \>= 63){ V=63;} H = h / time \* counter[x][y];if(H \<= 0) { H=0;}if(H \>= 127) { H=127;} MUTEX\_LCD\_TAKE;//////// show WAVE-FORM - S C O P E //////// MIOS32\_LCD\_DeviceSet(14); // clear screen if ( sync\_waiting == 1 ) { int h; int v; for (h=0; h\<128; h++) { for (v=0; v\<64; v++) { APP\_LCD\_BitmapPixelSet(bitmap, h, v, 0); }}} APP\_LCD\_BitmapPixelSet(bitmap, H, V, 1); MIOS32\_LCD\_DeviceSet(14); MIOS32\_LCD\_CursorSet(0, 0); MIOS32\_LCD\_BitmapPrint(bitmap); MUTEX\_LCD\_GIVE;
gave me 8 lines on the display
and i did not know why! — really no clue (had the same result yesterday…)
un words of the night: STRUCTS and TYPES… may it be easy when you are the architect of it, but for me it is horror!
Quote
app.c:503:57: error: incompatible types when assigning to type ‘mios32_lcd_bitmap_t’ from type ‘struct mios32_lcd_bitmap_t (*)(u8 *, u16, u16, u16, u8)’
damm i hate that structs… where are the simple arrays, code, bam ready, next task… after 6 ours of trying to come to an end with that structs - i make a end and go to bed … i hate structs!
and som other highlights:
Quote
app.c:503:21: error: ‘bitmap’ has an incomplete type
app.c:503:57: error: lvalue required as left operand of assignment
app.c:505:21: error: incompatible type for argument 1 of ‘APP_LCD_BitmapPixelSet’
/home/mios32/trunk/modules/app_lcd/universal/app_lcd.h:45:12: note: expected ‘mios32_lcd_bitmap_t’ but argument is of type ‘struct mios32_lcd_bitmap_t (*)(u8 *, u16, u16, u16, u8)’
app.c:510:25: error: incompatible type for argument 1 of ‘MIOS32_LCD_BitmapPrint’
/home/triggermatrix/mios32/trunk/include/mios32/mios32_lcd.h:125:12: note: expected ‘mios32_lcd_bitmap_t’ but argument is of type ‘struct mios32_lcd_bitmap_t (*)(u8 *, u16, u16, u16, u8)’
specially i wanted to get the bitmap thing to run, these documentation, did not help, and got no results after 6 ours:
here i know what is going on… when using them i just write
beat.swing_16th… o
r copy them with memcpy by typing beat or beat_cpy and so on…
maybe its easyier to just understand following code (i tryed by my own, but it seems that it cant work with arrays…), to make things more directly - in sense of outputing matrices without converting them (my matrice data is most of the time x-y-z generated), maybe anyone can explain this part more exactly ( special that pointer and bitshifts things, and how to more simplyfy the code, for simple arrays as input - and not some crypted file "con"structs) & alternativly how to adapt it for realtime operation (output Pixel @ position [y])
// calculate pointer to bitmap line
u8 *memory_ptr = bitmap.memory + line * bitmap.line_offset;
// transfer bitmap
int x;
for(x=0; x<bitmap.width; ++x)
APP_LCD_Data(*memory_ptr++);
}
// fix graphical cursor if more than one line has been print
if( y_lines >= 1 ) {
mios32_lcd_y = mios32_lcd_y - (bitmap.height-8);
APP_LCD_GCursorSet(mios32_lcd_x, mios32_lcd_y);
i can break it down to:
int line; for(line=0; line\<8; ++line) { // count from 0-7 & do 8x following code: APP\_LCD\_GCursorSet(0,0);// set insert Position for Bitmap APP\_LCD\_Cmd(0x5c);// send command "Write RAM" to GLCD // calculate pointer to bitmap line u8 \*memory\_ptr = bitmap.memory + line \* bitmap.line\_offset; // transfer bitmap int x; for(x=0; x\<128; ++x) APP\_LCD\_Data(\*memory\_ptr++); }
just a very short note - if you want to create an oscilloscope output (i.e a waveform display) with many set (and cleared) pixels per frame, it might make sense to just send a whole framebuffer update for every frame (buffer pixels in ram, then send full screen) instead of individual pixels - you can have a look at playground/hawkeye/mbprogramma to see how it works there (implemented a .pcx bitmap loader for label OLEDs) - it is quite simple and should be fast enough if you only want to update a single display. But you need to manipulate single pixel data in a way Bruno wrote, i.e. with bitwise or, and, xor operators because of the packed memory format… The advantage of this is, that a screen only takes (128*64)/8 bytes of ram.
MUTEX\_LCD\_TAKE;//////// CLEAR S C O P E //////// MIOS32\_LCD\_DeviceSet(14); MIOS32\_LCD\_Clear(); MUTEX\_LCD\_GIVE;}
will clear all connected displays! not only the selected device, thats bad, because 8 displays are showing static values (describtion of UI)
a Horiz Vertic - Position will make it not better:
MUTEX\_LCD\_TAKE;//////// CLEAR S C O P E //////// MIOS32\_LCD\_DeviceSet(14); APP\_LCD\_GCursorSet(H,V);// (h, v) set insert Position for Bitmap MIOS32\_LCD\_Clear(); MUTEX\_LCD\_GIVE;}
and this is the worst (not usable slow), but @ least it dont kill the other displays:
MUTEX\_LCD\_TAKE; //////// CLEAR S C O P E //////// MIOS32\_LCD\_DeviceSet(14); int ho; int ve; for(ho=0; ho\<128; ho++) { for (ve=0; ve\<64; ve++) { APP\_LCD\_GCursorSet(ho,ve); // (h, v) set insert Position for pixel APP\_LCD\_Cmd(0x5c); // send command "Write RAM" to GLCD APP\_LCD\_Data(0); }} MUTEX\_LCD\_GIVE;
this code for printing out Pixel is working, but it will shift all other and itself vertically about 32pixel! - what i dont understand:
//////// show WAVE-FORM - S C O P E //////// MUTEX\_LCD\_TAKE; MIOS32\_LCD\_DeviceSet(14); APP\_LCD\_GCursorSet(H,V);// (h, v) set insert Position for Bitmap APP\_LCD\_Cmd(0x5c);// send command "Write RAM" to GLCD APP\_LCD\_Data(1 \<\< ( V % 8 )); MUTEX\_LCD\_GIVE;
ok i got rid of the 32pixel offset, by removing that cmd(0x5c)
//////// show WAVE-FORM - S C O P E //////// MUTEX\_LCD\_TAKE; MIOS32\_LCD\_DeviceSet(14); APP\_LCD\_GCursorSet(H,V);// (h, v) set insert Position for Bitmap APP\_LCD\_Data(1 \<\< ( V % 8 )); MUTEX\_LCD\_GIVE;
now i have to find out a smart way to clear a display
just a very short note - if you want to create an oscilloscope output (i.e a waveform display) with many set (and cleared) pixels per frame, it might make sense to just send a whole framebuffer update for every frame (buffer pixels in ram, then send full screen) instead of individual pixels - you can have a look at playground/hawkeye/mbprogramma to see how it works there (implemented a .pcx bitmap loader for label OLEDs) - it is quite simple and should be fast enough if you only want to update a single display. But you need to manipulate single pixel data in a way Bruno wrote, i.e. with bitwise or, and, xor operators because of the packed memory format… The advantage of this is, that a screen only takes (128*64)/8 bytes of ram.
Have fun and good luck!
Peter
ja i of course a deep look in programmer and loopa and others — but dont find it soo easy, i am still new to this task, and to crystalize the information in a environment like a programmer - had not worked, it worked not out most of the time in my life… i need the root, but the root itself -for me- is sooo boring that i cant learn it… i am a bit in reverse engenieering… i know what have to done to get what i want, but the syntax is my problem…
i already have the problems with the “many cleared” pixel per frame… i have to clear every lfo,cycle or env.trigger 1to8 displays, and pixelwise - it is not working
-of course i saw already the lcd-clear mios_lcd_clear(), but that clears all displays - also the 8 that need no update the whole runtime (UI-describtion)
is just confusing, and for me not working, it always sayst that it is a function, and for that, the parameters are not right, and it have to initalize, and its not a struct and this and that…
is there no “blank” command, that let do this work the ssd1306 by itself?
i have this LFO screen 4times, and i have also 4 screens for Envelope too (=8x scope displays - that are showing 4x8=32ENV/LFOs - i have 4 Channelstrips - this CV-Application will drive Distortion, ACs Filters…)
The same is for Envelope, except that when a Note-sustains - it will hold Position and it is not growing, until note is released… its pretty much the same., the LCD-Clear is triggered with a incoming note-on
i have in booth cases the knowledge about -how long is the duty cycle, so i dont need to shift or sync display to left or right, the lines is growing and thats it.
but also look @ the video i already posted - in the video it does what it should too (ok there are bugs, and the V-Axis has to scaled from 0-63 to 63-0, and the clear-screen is a problem…) the video:
//////// show WAVE-FORM - S C O P E ////////
MUTEX_LCD_TAKE; MIOS32_LCD_DeviceSet(14);
APP_LCD_GCursorSet(H,(63-V)); // (h, v) set insert Position for Bitmap
APP_LCD_Data(0x80 >> ((63-V) % 8));
MUTEX_LCD_GIVE;
got it… this works: (will post video once timing gets better…)
// SCOPEs // WAVE FORM DISPLAY static u16 upd\_count = 0; upd\_count++; if ( upd\_count \>= Scope\_Upd\_Rate|| flag.update\_LCD == 1) { upd\_count = 0; // U P D A T E R A T E // Scope Lines static float h = APP\_LCD\_WIDTH; static float v = APP\_LCD\_HEIGHT/65536.0;// scale u16 range to 0-64 //u16 range = 0 - 65536 half is: 32768 static int H = 0; // horizontal position static int V = 0; // vertical position static int y = 0; // scope/lfo number static int x = 0; // use "channel\_strip" float time = lfo\_cycle[x][y]; // calculate H V Positions V = (65536-aout[x].lfo[y])\* v;if(V \<= 0) { V=0;}if(V \>= 63){ V=63;} //65536-lfo: invert screen v-whise H = h / time \* counter[x][y];if(H \<= 0) { H=0;}if(H \>= 127) { H=127;} if ( sync\_waiting == 1 ) { MUTEX\_LCD\_TAKE;//////// CLEAR S C O P E //////// MIOS32\_LCD\_DeviceSet(14); MIOS32\_LCD\_CursorSet(0, 0); MIOS32\_LCD\_PrintFormattedString(" "); MIOS32\_LCD\_CursorSet(0, 1); MIOS32\_LCD\_PrintFormattedString(" "); MIOS32\_LCD\_CursorSet(0, 2); MIOS32\_LCD\_PrintFormattedString(" "); MIOS32\_LCD\_CursorSet(0, 3); MIOS32\_LCD\_PrintFormattedString(" "); MIOS32\_LCD\_CursorSet(0, 4); MIOS32\_LCD\_PrintFormattedString(" "); MIOS32\_LCD\_CursorSet(0, 5); MIOS32\_LCD\_PrintFormattedString(" "); MIOS32\_LCD\_CursorSet(0, 6); MIOS32\_LCD\_PrintFormattedString(" "); MIOS32\_LCD\_CursorSet(0, 7); MIOS32\_LCD\_PrintFormattedString(" "); MUTEX\_LCD\_GIVE; } //////// show WAVE-FORM - S C O P E //////// MUTEX\_LCD\_TAKE; MIOS32\_LCD\_DeviceSet(14); APP\_LCD\_GCursorSet(H,V);// (h, v) set insert Position for Bitmap APP\_LCD\_Data(1 \<\< ( V % 8 )); MUTEX\_LCD\_GIVE;