On 30 August 2011 03:28, Sebastian Kuzminsky <s...@highlab.com> wrote:

> I think I'd prefer to call hm2_set_pin_numbers() in
> hm2_read_pin_descriptors(), above, instead of initializing them to something
> invalid and hoping we don't need them too soon.  At
> hm2_read_pin_descriptor()-time we have enough information to set them
> correctly.

That makes sense. It was only late in the session that I started to
worry about code trying to use port_pin when it hadn't been
initialised,

> It might make sense to swallow the hm2_set_pin_numbers() function into its
> caller (whatever that is), since it's called exactly once per pin.  I guess
> it's a matter of taste, but having it be a separate function suggests to me
> that it's a more generally useful piece of code, rather than the very
> special-purpose, run-once-only thing it actually is.

It started off inlined, but didn't fit the style of the sub it was in :-)
Inlining it in read_pin_descriptors() seems like a rather better idea,
and suits the scope of that function.

> This sanity test should be done exactly once, in hm2_set_pin_numbers(), if
> you don't trust your own code that sets it in that function.

That was paranoia about not being sure that the pin numbering code had
been run.
Is it safe to assume the values are valid if the numbering is done in
read_pin_descriptors() ? I certainly think it _ought_ to be, but I am
not that used to having to make code bomb-proof for public
consumption.

I will get this looked at tonight.
(After blowing up my anti-surge device I am not going to be looking at
the hardware side of things for a day or two)

-- 
atp
"Torque wrenches are for the obedience of fools and the guidance of wise men"

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to