anchor.diff:    i2c-EV5
   
     i2c-DR!                   \ Sends address (write mode)
  -  i2c-EV6                       \ wait for completion of addressing or AF
  +  i2c-EV6a                       \ wait for completion of addressing or AF
   ;
   
   : i2c-xfer ( u -- nak) \ prepares for an nbyte reply. Use after i2c-addr. Stops i2c after completion.
  -    dup i2c.cnt !
  +  dup i2c.cnt !
  +  i2c-EV6b
       case
         2 of    \ cnt = 2
           i2c-start  \ set start bit,  wait for start condition
  
positive.code: 
          i2c-POS-1 i2c-ACK-1
  
          i2c-EV6 I2C1-SR2 @ drop \ wait for ADDR and clear
          i2c-ACK-0
          i2c-SR1-BTF i2c-SR1-wait \ wait for BTF
          i2c-stop!                \ set stop without waiting
          0 i2c.needstop !
        endof
        1 of endof                ( cnt = 1 )
        0 of                      ( cnt = 0, probe only )
          i2c-nak? i2c-AF-0 i2c-stop
          0 i2c.needstop !
  
negative.code: ;
  
  : >i2c  ( u -- ) \ Sends a byte over i2c. Use after i2c-addr
    i2c-EV6b                \ Just in case the ADDR needs clearing
    i2c-EV8_1
    i2c-DR!
  ;
  