Page 1 of 1

PAL-Driver Problem with groupmode

Posted: Sat Dec 31, 2011 2:58 am
by THaala
Dear Giovanni,

i seems i found a little problem here:

I tried to use the Group - Mode of GPIO with GPIOV2. I need to Group the Bits 8 - 15 of GPIOE.

I interpret the following define as information how to use the members "mask" and "offset".

Code: Select all

#define pal_lld_writegroup(port, mask, offset, bits)   \  
  ((port)->BSRR.W = ((~(bits) & (mask)) << (16 + (offset))) | (((bits) & (mask)) << (offset)))

this define is feeded with the call of palWriteBus (&LCD_Bus, 0x5A);
The idea was to shift the Bits 0-7 to the bits 8 - 15. (if using the BusIO descriptor LCD_Bus i got what i need!)

Problem:
Whithin initialization the BusIO - Member "offset" is not evaluated. if i use a BusIO

Code: Select all

{ 
   GPIOE,
   0xFF,
   8
}

The function pal_lld_writegroup writes to the correct bits 8 - 15 but the Init do the wrong IO's (0 -7).
A current workaround is to use different descriptors for init and for manipulating output:

Code: Select all

static BusIO LCD_Bus;
static BusIO LCDInit_Bus;

   LCD_Bus.portid = GPIOE;
   LCD_Bus.mask = 0xFF;
   LCD_Bus.offset = 8;

   LCDInit_Bus.portid = GPIOE;
   LCDInit_Bus.mask = 0xFF00;
   LCDInit_Bus.offset = 0 /* don't care */ ;

i think the best way was to evaluate the member "offset" also in _pal_lld_setgroupmode() while initialization. I use the trunk 2.3.6
What do you think about it ?

Re: PAL-Driver Problem with groupmode

Posted: Sat Dec 31, 2011 11:11 am
by Giovanni
Hi,

I fixed it into the pal_lld_setgroupmode() macro in order to not impact all the implementations. Please let me know if it is OK now.

Giovanni

Re: PAL-Driver Problem with groupmode

Posted: Sun Jan 01, 2012 8:32 pm
by THaala
Hello Giovanni,

thank you for your fast help.
The fix is working well.

Have a good new Year.
T.