Author: sebastien.lelong
Date: Sun Dec 21 03:14:48 2008
New Revision: 631
Modified:
trunk/unvalidated/include/peripheral/i2c/i2c_software.jal
Log:
reindent
Modified: trunk/unvalidated/include/peripheral/i2c/i2c_software.jal
==============================================================================
--- trunk/unvalidated/include/peripheral/i2c/i2c_software.jal (original)
+++ trunk/unvalidated/include/peripheral/i2c/i2c_software.jal Sun Dec 21
03:14:48 2008
@@ -31,21 +31,21 @@
i2c_sda = low
i2c_sda_direction = output
end procedure
-
+
-- ------------------------------------------------------------------------
-- i2c_start - output a start condition
-- ------------------------------------------------------------------------
-- ------------------------------------------------------------------------
procedure i2c_start() is
- _i2c_wait()
+ _i2c_wait()
i2c_sda_direction = high -- data high
- _i2c_wait()
+ _i2c_wait()
i2c_scl_direction = high -- clock high
- _i2c_wait()
+ _i2c_wait()
i2c_sda_direction = low -- data low
- _i2c_wait()
+ _i2c_wait()
i2c_scl_direction = low -- clock low
- _i2c_wait()
+ _i2c_wait()
end procedure
-- ------------------------------------------------------------------------
@@ -64,15 +64,15 @@
-- ------------------------------------------------------------------------
-- ------------------------------------------------------------------------
procedure i2c_stop() is
- _i2c_wait()
+ _i2c_wait()
i2c_sda_direction = low -- data low
- _i2c_wait()
+ _i2c_wait()
i2c_scl_direction = low -- clock low
- _i2c_wait()
+ _i2c_wait()
i2c_scl_direction = high -- clock high
- _i2c_wait()
+ _i2c_wait()
i2c_sda_direction = high -- data high
- _i2c_wait()
+ _i2c_wait()
end procedure
-- ------------------------------------------------------------------------
@@ -87,25 +87,25 @@
_i2c_bit_out( b )
x = x << 1
end loop
-
+
-- wait for an ack condition
- ;procedure _i2c_wait()_ack is
- _i2c_wait()
+ ;procedure _i2c_wait()_ack is
+ _i2c_wait()
i2c_sda_direction = high -- data open
- _i2c_wait()
+ _i2c_wait()
i2c_scl_direction = high -- clock high
- _i2c_wait()
+ _i2c_wait()
while i2c_scl == low loop
end loop -- wait for slow slave
-- a check for the slave's acknowledge
-- (data should be low)
-- could be added here
r = ! i2c_sda
- _i2c_wait()
+ _i2c_wait()
i2c_scl_direction = low -- clock low
- _i2c_wait()
+ _i2c_wait()
;end procedure
-
+
return r -- true = okay, false = no ack received
end function
@@ -127,15 +127,15 @@
ret = ret << 1
_i2c_bit_in( b )
end loop
-
+
if (ack) then
_i2c_bit_out( low ) -- ack
else
_i2c_bit_out( high ) -- nack
end if
-
+
return ret
-
+
end function
-- ------------------------------------------------------------------------
@@ -153,7 +153,7 @@
-- configured maximum.
-- ------------------------------------------------------------------------
procedure _i2c_wait() is
-
+
if _i2c_bus_speed == 10 then
; i2c_1MHz
delay_1us()
@@ -167,7 +167,7 @@
delay_3us()
return
end if
-
+
end procedure
-- ------------------------------------------------------------------------
@@ -177,14 +177,14 @@
procedure _i2c_bit_out(bit in x) is
; _i2c_wait()
i2c_sda_direction = x -- high data bit
- _i2c_wait()
+ _i2c_wait()
i2c_scl_direction = high -- clock high
- _i2c_wait()
+ _i2c_wait()
while i2c_scl == low loop
end loop -- wait for slow slave
- _i2c_wait()
+ _i2c_wait()
i2c_scl_direction = low -- clock low
- _i2c_wait()
+ _i2c_wait()
end procedure
-- ------------------------------------------------------------------------
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---