Wednesday, July 14, 2010

July 13-14 avr clean-up +

avr code clean-up
Moving hardware related code out of avr_cntl and into their own class / source files.
So far: Buttons, Sensor (ports, led), Motor. The Sensors code will also need sub-class code. Generalized code will stay in Sensors.

Clearing out non-avr related code makes it much easier to see what the eCos thread is doing.  And what hardware is being set  or reset by what.

Buttons 

Besides moving existing button functions now

GetButtonVal function decodes the raw button value from avr.
(note: If speed becomes an issue an inline function or define macro can be used.)
 
Motor
- reset motor
- read tacho counts

options:
  • interrupts
  • motor thread
  • polling in avr thead
Which solution works and  is most accurate= right solution?

**Don't  use timer to generate signal because ecos uses it. ..._TC0 and ..._TC2 
That leaves the TC1 and TWI timers.

Sensors

- Moved sensor  functions and port managment out of avr_cntl 
- Consolidated all Led code in under Sensors.Before the led code was duplicated in at least 3 places:  lms main, avr cntl and led FB.
All led code is now in Sensors.c.  Currently #define macros are used since code in now under eCos, but a class method version is commented out under Forte code.






No comments:

Post a Comment