Sorry, previous message was sent before it was complete...

Hi,

You're right: alias is a way to create a generic device.

So something like (not checked):

alias debug_stream is serial_hw_data

const enable_debug = 1
var bit debug_level[10]

procedure debug_byte_dec(byte in level, byte in data) is
   pragma inline

   if (enable_debug) then
      if (debug_level[level]) then
         print_byte_dec(debug_stream, data)
      end if
   end if

end procedure

So:
- enable_debug = 0 will remove most of the code (compile time enable/disable
- the inline statement might or might not be a good idea. you should
check what the efffect is on code and ram size, both with enable_debug
0 and 1. It does save a stack level
- debug_level[x] = true / false allows runtime enble/disable of a
group of levels.
- the global use of debug_stream will save some code and ram space.

Anyway, lots of print statement are an efficient way to drain your
resources (trust me, I know ;) and a library like this will add some
to this. But on the other hand, good debug aids are very valuable and
printing to the serial port is my #1 debug tool (but I'd love to hear
how I could use tools with breakpoints and single step in more complex
apps!).

Joep

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to