Forum > Embedded - AVR
Progmem from Pascal
(1/1)
dseligo:
I have this definition:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---type TMenuItem = record miLevel: Byte; miText: String[20]; end; TMenuDef = array of TMenuItem; const glavni_izbornik: TMenuDef = ( (miLevel: 1; miText: '100 Edit'), (miLevel: 2; miText: '110 Cut'), (miLevel: 2; miText: '120 Copy') ); section '.progmem'; var FMenu: Pointer; s:String;
I was hoping that this would work, but I knew there was only a slim chance:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---FMenu := @glavni_izbornik;Count := Length(TMenuDef(FMenu));s := TMenuDef(FMenu)[1].miText;
Is there a simpler way to access data in progmem from Pascal, or is using LPM instruction directly only option?
Can I at least get number of elements in array (at compile time)?
Thaddy:
--- Quote ---Can I at least get number of elements in array (at compile time)?
--- End quote ---
Length(TMenuDef); you can set the length with SetLength()
Note the const structure you use is probably wrong.
In general you can get at the resources Through Tmenu.Items[].TMenuItem
Through Tmenu.Items[].TMenuItem
Count := TMenu.Items.count or submenu: TmenuItem.Items.Count
Name is TMenu.Items[index].Name etc. You can iterate through all menu entries
ccrause:
Currently there is no build-in compiler support to access data not in RAM. So you have to write your own access function, for progmem, using LPM.
There is a merge request to implement support for progmem and eeprom sections. But this doesn't have a high priority on the core team's list.
Navigation
[0] Message Index