Author: jsuijs
Date: Sun Jan  4 04:45:31 2009
New Revision: 722

Modified:
    trunk/include/peripheral/i2c/i2c_level1.jal

Log:
You now can use a one-byte tx buffer if you realy want to.

Modified: trunk/include/peripheral/i2c/i2c_level1.jal
==============================================================================
--- trunk/include/peripheral/i2c/i2c_level1.jal (original)
+++ trunk/include/peripheral/i2c/i2c_level1.jal Sun Jan  4 04:45:31 2009
@@ -8,11 +8,22 @@
  --
  -- Description: Level1 implementation of I2C (single) master.
  --
+-- User must define the rx and tx buffer like:
+--    var byte i2c_tx_buffer[10]
+--    var byte i2c_rx_buffer[10]
+--
+-- tx_buffer[] should be at least 2 bytes long to support  
i2c_receive_wordaddr.
+-- if you desperatly want to use a 1-byte tx buffer, define (besides the  
buffer):
+-- const single_byte_tx_buffer = 1
+--
  -- TODO:
  --

-if (count(i2c_tx_buffer) < 2) then
-   pragma error  -- "Please make i2c_tx_buffer[] at least 2 long"
+-- some validations
+if (defined(single_byte_tx_buffer) ==  false) then
+   if (count(i2c_tx_buffer) < 2) then
+      pragma error  -- "Please make i2c_tx_buffer[] at least 2 long"
+   end if
  end if

  --  
-----------------------------------------------------------------------------
@@ -71,6 +82,7 @@
  end function


+if (defined(single_byte_tx_buffer) == false) then -- conditional compile
  --  
-----------------------------------------------------------------------------
  -- i2c_receive_wordaddr - send a word address and receive a string from an  
i2c slave
  --  
-----------------------------------------------------------------------------
@@ -81,3 +93,4 @@
     return i2c_send_receive(i2c_address, 2, i2c_rx_count)

  end function
+end if -- conditional compile
\ No newline at end of file

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