RetroBSD

2.11BSD operating system for microcontrollers
It is currently Fri Oct 23, 2020 12:34 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: LED_POLARITY atc.
PostPosted: Sat Aug 20, 2011 12:33 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
I've seen Rob's patch for Maximite in the machdep.c and I would recommend following:
1. change the LED_POLARITY to something like (an example) LED_POLARITY_CCathode or LED_POLARITY_CAnode as LED_POLARITY means nothing in respect how the LED's are connected on the particular board.
2. there is an LED mask defined in machparam.h - (masks - 1, 2, 4, 8)there is a danger to do it in this way - what when somebody will connected them to (for example) D12, 13, 14, 15..
3. I would recommend to rethink the way those 4 LEDS are handled, and maybe to write/use a simple function
led_on(name, pin, polarity)
led_off(name, pin, polarity)
where name is AUX, KERNEL, UART.., pin is RE0, or RD12 or RF4, .. and polarity is for example AG or AV ( connected against ground or against Vcc).
P.

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sat Aug 20, 2011 1:05 am 

Joined: Sun Aug 14, 2011 10:26 am
Posts: 28
pito,

I did think about this. Comments:

1. Standard polarity has already been defined as the system used by the UBW32. i.e. pull down to activate.
2. LED_POLARITY switch in the Makefile inverts all the LEDS.
3. On any other board, we would not expect to see some high and some low as a default condition, so this is adequate for now.

Sometimes it's best to use the simplest solution.

A more useful general function would be PIN_ON and PIN_OFF regardless of what was attached. I'm sure this will be added eventually. Or you could do it for us, instead of just making endless theoretical comments. :-)

Rob


Top
 Profile  
 
PostPosted: Sat Aug 20, 2011 2:32 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
It is better to think twice now as to spend days rewriting the code in the future.. There will be a lot of boards in the future..
p.

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron




Powered by phpBB® Forum Software © phpBB Group

BSD Daemon used with permission