[fpc-pascal] Assigning absolute record to variable
Koenraad Lelong
fpascal at brouwerij.homelinux.net
Tue May 8 22:41:19 CEST 2012
Hi,
I hope I can make myself clear.
I'm making a driver to control an LCD with an STM32 microcontroller,
using fpc-embedded-arm.
I want to make my driver re-usable, i.e. I want to be able to pass the
needed RST- and CS-pins only one time, so I don't need to modify the
code in multiple places if the needed pins change.
Since a pin-port is defined this way :
PortA: TPortRegisters absolute (APB2Base+$0800);
I thought of defining a record :
RSTPin : record
GPIO_Port : ^TPortRegisters;
GPIO_Pin : word;
end;
and assigned like this :
RSTPin.GPIO_Port:=@PortA;
This does not work, the pins are not initialised when used with the
initialising function :
GPIO_Init(RSTPin.GPIO_Port^, GPIO_InitStructure);
does not work while
GPIO_Init(PortA, GPIO_InitStructure);
does work.
What am I missing ? I'm out of ideas at the moment.
Thanks for any help you can give,
Regards,
Koenraad Lelong.
More information about the fpc-pascal
mailing list