chiark / gitweb /
Send HELLO as a result of all slaves being online. Do not crash if slave is slow...
[trains.git] / detpic / i2clib.inc
index 5167a1329d09afc695f456520f227184c31b08a5..e91e31963f9ecdafd45d5fa945e6f2a660d8eed1 100644 (file)
 ;                       //        \  ,------------------<---. |   |
 ;                      //          \ |                      | |   |
 ;                     VV            VV                      | |   |
-;            [Writing-Setup]    [Reading-Busy]<---------.   | |   |
-;                   |                 |                 |   | |   |
-;    write_next_byte|                 |read_got_byte    |   | |   |
-;    must return NZ |                 |                 |   | |   |
-;                   V                 V                 |   | |   |
-;           ,-->[Writing]         [Reading-Wait]        |   | |   |
-;           `-------'  \            / ||  `.___________,'   | |   |
-;    write_next_byte    \          /  ||   read_another     | |   |
-;       returns NZ       |        /   ||                    | |   |
-;                        |       /    |`.__________________,' |   |
-;                        |      |     |        read_start     |   |
-;         write_next_byte|      |     `._____________________,'   |
-;             returns Z  |      |               write_start       |
-;                        |      |read_done                        |
-;                        V      V                                 |
+;            [Writing-Setup]   [Reading-Busy]<----------.   | |   |
+;                   |              |  |                 |   | |   |
+;                   |              |  |                 |   | |   |
+;                   |  slave_no_ack|  |                 |   | |   |
+;                   |      (1st    |  |                 |   | |   |
+;    write_next_byte|       byte  /   |read_got_byte    |   | |   |
+;    must return NZ |       only)/    |                 |   | |   |
+;                   V           /     V                 |   | |   |
+;           ,-->[Writing]      /  [Reading-Wait]        |   | |   |
+;           `-------'  \      |     / ||  `.___________,'   | |   |
+;    write_next_byte    \     |    /  ||   read_another     | |   |
+;       returns NZ       |    |   /   ||                    | |   |
+;                        |    |  /    |`.__________________,' |   |
+;                        |    | |     |        read_start     |   |
+;         write_next_byte|    | |     `._____________________,'   |
+;             returns Z  |    | |               write_start       |
+;                        |    | |read_done                        |
+;                        V    V V                                 |
 ;                       [Stopping]                                |
 ;                           |           done                      |
 ;                           `-------------------------------------'
 ; been finished as requested.  The i2c system is now available and
 ; i2cm_*_start can be called.
 ;
-; (Note: If this arrangment means that main program ends up needing to
-; keep track of whether the I2C is Idle or not, it would probably be
-; straightforward to enhance the interface to be enhanced to make that
-; unnecessary, since this information is already tracked by i2clib.)
-;
 ;              Beforehand      At call
 ;   State      Stopping        Idle
 
+;--------------------
+  extern i2cmu_slave_no_ack
+
+; Called to notify that the slave did not acknowledge its address when
+; we attempted to read from it.  The i2c system is now clearing down
+; the i2c bus to prepare for another transaction.
+;
+;              Beforehand      At call
+;   State      Reading-Busy*   Stopping
+;
+;  * only Reading-Busy reached by calling read_start;
+;    not Reading-Busy due to read_another.
+
 ;========================================
 ; MASTER - WRITES (ie, transmission of data to the slave)