Author: sebastien.lelong
Date: Wed Jan 21 22:52:01 2009
New Revision: 742
Modified:
trunk/sample/test/peripheral/i2c/test_i2c_hw_slave_echo.jal
trunk/sample/test/peripheral/i2c/test_i2c_sw_master_echo.jal
Log:
use 1-byte long TX buffer + renamed callbacks + blink
Modified: trunk/sample/test/peripheral/i2c/test_i2c_hw_slave_echo.jal
==============================================================================
--- trunk/sample/test/peripheral/i2c/test_i2c_hw_slave_echo.jal (original)
+++ trunk/sample/test/peripheral/i2c/test_i2c_hw_slave_echo.jal Wed Jan 21
22:52:01 2009
@@ -48,7 +48,7 @@
-- this callback is used when master wants to talk to us
-- and our i2c address has been recognized
-procedure i2c_hw_slave_on_master_talks(byte in _trash) is
+procedure i2c_hw_slave_on_state_1(byte in _trash) is
pragma inline
-- _trash is read from master, but it's a dummy data
-- usually (always ?) ignored
@@ -56,7 +56,7 @@
-- This callback is used when master sends a data byte
-procedure i2c_hw_slave_on_master_writes(byte in rcv) is
+procedure i2c_hw_slave_on_state_2(byte in rcv) is
pragma inline
-- ultimate data processing... :)
data = rcv + 1
@@ -65,7 +65,7 @@
-- this callback is used when master wants to read something
-- from us. It should use i2c_hw_slave_write() to send something
-procedure i2c_hw_slave_on_master_reads() is
+procedure i2c_hw_slave_on_state_3() is
pragma inline
i2c_hw_slave_write_i2c(data)
end procedure
@@ -73,7 +73,7 @@
-- this callback is used when master, after having read something,
-- still wants to read and get data from us.
-procedure i2c_hw_slave_on_master_stillreads() is
+procedure i2c_hw_slave_on_state_4() is
pragma inline
i2c_hw_slave_write_i2c(data)
-- note: this shouldn't occur in our i2c echo example
@@ -83,7 +83,7 @@
-- this callback is used when master does not want to talk
-- with us anymore... This is an appropriate place to reset
-- data for instance
-procedure i2c_hw_slave_on_master_hangsup() is
+procedure i2c_hw_slave_on_state_5() is
pragma inline
data = 0
end procedure
@@ -101,7 +101,16 @@
-- callbacks are defined, now include ISR
include i2c_hw_slave_isr
+;@jallib use led
+-- blink a little to tell the world we're up
+led_direction = output
+for 4 loop
+ led = on
+ _usec_delay(100000)
+ led = off
+ _usec_delay(100000)
+end loop
+-- just loop until interrupt is raised
forever loop
- -- just loop until interrupt is raised
end loop
Modified: trunk/sample/test/peripheral/i2c/test_i2c_sw_master_echo.jal
==============================================================================
--- trunk/sample/test/peripheral/i2c/test_i2c_sw_master_echo.jal
(original)
+++ trunk/sample/test/peripheral/i2c/test_i2c_sw_master_echo.jal Wed Jan
21
22:52:01 2009
@@ -28,7 +28,8 @@
include i2c_software
i2c_initialize()
-var byte i2c_tx_buffer[2]
+const single_byte_tx_buffer = 1
+var byte i2c_tx_buffer[1]
var byte i2c_rx_buffer[1]
include i2c_level1
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---