[ECOS] Bugfix for hal/arm/at91/at91sam7sek/current/src/at91sam7sek_misc.c error in bitmask offset

Rasmus Stougaard rasmus.stougaard@gmail.com
Tue Oct 16 08:06:00 GMT 2007


Hi,

I found a bug in

hal/arm/at91/at91sam7sek/current/src/at91sam7sek_misc.c
in the function hal_at91_led().
By mistake the pins are not addressed correctly, the bitmask for the
diodes should start at PA0 instead of PA1.

I am not sure whether it has been corrected in the current cvs version.

The original is:
 // Set the bits. The logic is inverted
  HAL_ARM_AT91_GPIO_PUT(AT91_GPIO_PA1, !(val & 1));
  HAL_ARM_AT91_GPIO_PUT(AT91_GPIO_PA2, !(val & 2));
  HAL_ARM_AT91_GPIO_PUT(AT91_GPIO_PA3, !(val & 4));
  HAL_ARM_AT91_GPIO_PUT(AT91_GPIO_PA4, !(val & 8));


here is the fix:

 // Set the bits. The logic is inverted
  HAL_ARM_AT91_GPIO_PUT(AT91_GPIO_PA0, !(val & 1));
  HAL_ARM_AT91_GPIO_PUT(AT91_GPIO_PA1, !(val & 2));
  HAL_ARM_AT91_GPIO_PUT(AT91_GPIO_PA2, !(val & 4));
  HAL_ARM_AT91_GPIO_PUT(AT91_GPIO_PA3, !(val & 8));


Could someone please insert it such that others might benefit.

Regards
Rasmus Stougaard

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list