Author: sebastien.lelong
Date: Tue Oct  7 06:57:26 2008
New Revision: 368

Modified:
    wiki/JallibStyleGuide.wiki

Log:
few words about pin direction setup + update example related to this

Modified: wiki/JallibStyleGuide.wiki
==============================================================================
--- wiki/JallibStyleGuide.wiki  (original)
+++ wiki/JallibStyleGuide.wiki  Tue Oct  7 06:57:26 2008
@@ -1,4 +1,4 @@
-#summary jallib style guide, a recipe to write a standard jalv2 library
+#summary jallib style guide, a recipe to write a standard jalv2 library
  #labels Phase-Implementation

  The *jallib style guide* defines the standards used to write jalv2 code.
@@ -100,19 +100,21 @@

  *Name your pins according to the context*, to what your library is doing.  
Client code, ie. users, will have to define those variables before actually  
include your great library.

+*Let the user set the pin directions, except if the library is supposed to  
modify direction during execution*
+
  Ex: how to use your library (doing amazing things with the GP2D02 IR  
ranger)
  {{{
    -- declare in/out pins for the ranger
    var bit ranger_pin_in            is pin_A0
-  var bit ranger_pin_in_direction  is pin_A0_direction
    var bit ranger_pin_out           is pin_A1
-  var bit ranger_pin_out_direction is pin_A1_direction
  }}}
  and make sure the pins work as required:
  {{{
    -- specify the direction of the pins
-  ranger_pin_in_direction  = input
-  ranger_pin_out_direction = output
+  -- Since directions won't change during execution, this is
+  -- done here, during the setup, before including the library
+  pin_A0_direction = input
+  pin_A1_direction = output
  }}}
  and now include the library:
  {{{
@@ -279,4 +281,4 @@
  == Comment your code ==

  It helps readers understand what's going on.
-The comment should describe *why* your code does its thing, not what is  
does. That should be obvious from the code itself.
\ No newline at end of file
+The comment should describe *why* your code does its thing, not what is  
does. That should be obvious from the code itself.

--~--~---------~--~----~------------~-------~--~----~
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