Author: sebastien.lelong
Date: Sat Jan 17 12:11:14 2009
New Revision: 736

Added:
    trunk/sample/test/peripheral/i2c/test_i2c_hw_slave_check_bus.jal
       - copied, changed from r733,  
/trunk/sample/test/peripheral/i2c/test_i2c_check_bus.jal
    trunk/sample/test/peripheral/i2c/test_i2c_sw_master_check_bus.jal
Removed:
    trunk/sample/test/peripheral/i2c/test_i2c_check_bus.jal

Log:
renamed to split slave/master tests

Copied: trunk/sample/test/peripheral/i2c/test_i2c_hw_slave_check_bus.jal  
(from r733, /trunk/sample/test/peripheral/i2c/test_i2c_check_bus.jal)
==============================================================================
--- /trunk/sample/test/peripheral/i2c/test_i2c_check_bus.jal    (original)
+++ trunk/sample/test/peripheral/i2c/test_i2c_hw_slave_check_bus.jal    Sat  
Jan 17 12:11:14 2009
@@ -21,13 +21,6 @@

  ;@jallib use led

--- ok, now setup serial
-const usart_hw_serial = true   -- true = RS232, false = SPI
-;@jallib use serial
-include serial_hardware
-serial_hw_init()
-
-
  -- i2c setup
  include i2c_hw_slave
  const SLAVE_ADDRESS = 0x23 -- whatever, it's not important, and can be
@@ -48,8 +41,6 @@
     -- tmp store SSPSTAT and mask out unimportant bit
     var byte tmpstat
     tmpstat = SSPSTAT
-   -- debug
-   serial_hw_write(tmpstat)
     -- check start signals
     if (tmpstat == 0b_1000) then
          -- If we get there, this means this is an SSP/I2C interrupts

Added: trunk/sample/test/peripheral/i2c/test_i2c_sw_master_check_bus.jal
==============================================================================
--- (empty file)
+++ trunk/sample/test/peripheral/i2c/test_i2c_sw_master_check_bus.jal   Sat  
Jan 17 12:11:14 2009
@@ -0,0 +1,53 @@
+-- Title: Master part of i2c slave check bus test
+-- Author: Sebastien Lelong, Copyright (c) 2008-2009, all rights reserved.
+-- Adapted-by:
+-- Compiler: >=2.4i
+--
+-- This file is part of jallib  (http://jallib.googlecode.com)
+-- Released under the BSD license  
(http://www.opensource.org/licenses/bsd-license.php)
+--
+-- Description: this test corresponds to the master part
+-- of i2c hardware slave bus check testing program. It blinks a little,
+-- then send a i2c command, then infinitely loop.
+-- This is a one-shot test, if you want to run it again, reset your PICs
+-- (or switch the power off/on...)
+--
+-- Sources:
+--
+
+;@jallib use chipdef
+enable_digital_io()
+
+
+;@jallib use led
+-- blink a little, then send i2c command
+for 8 loop
+   led = on
+   _usec_delay(250000)
+   led = off
+   _usec_delay(250000)
+end loop
+
+
+;@jallib use i2c
+-- i2c setup
+const word _i2c_bus_speed = 4 ; 400kHz
+const bit _i2c_level = true   ; i2c levels (not SMB)
+include i2c_software
+i2c_initialize()
+
+var byte i2c_tx_buffer[2]
+var byte i2c_rx_buffer[1]
+include i2c_level1
+var byte icaddress = 0x1F      -- slave address, can be anything
+
+-- go! If slave starts to flash at high speed,
+-- it works !
+-- dummy command
+i2c_tx_buffer[0] = "."
+var bit _trash = i2c_send_receive(icaddress, 1, 1)
+
+forever loop
+   -- reached the end of test
+end loop
+

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