anchor.diff:    SDA ioc! i2c-half SCL ios! i2c-half SDA ios! i2c-half ;
   
   : b>i2c ( f -- )  \ send one I2C bit
  -  0<> SDA io! i2c-half SCL ios! i2c-half SCL ioc! ;
  +  0<> SDA io! i2c-half SCL-ios! i2c-half SCL ioc! ;
   : i2c>b ( -- b )  \ receive one I2C bit
  -  SDA ios! i2c-half SCL ios! i2c-half SDA io@ SCL ioc! ;
  +  SDA ios! i2c-half SCL-ios! i2c-half SDA io@ SCL ioc! ;
   
   : x>i2c ( b -- nak )  \ send one byte
     8 0 do dup 128 and b>i2c shl loop drop i2c>b ;
  
positive.code:   dup i2c.cnt !  if
      i2c-start i2c.adr @ 1+ i2c.prv ! i2c-flush
    else
      SCL ios!  \ i2c-stop
    then
    i2c.nak @
    dup if i2c-stop 0 i2c.cnt ! then  \ ignore reads if we had a nak
  
negative.code: \ bit-banged i2c driver
  \ adapted from http://excamera.com/sphinx/article-forth-i2c.html
  \
  \ This driver is master-only. It supports clock stretching.
  \ There have to be 1..10 kΩ resistors on SDA and SCL to pull them up to idle state.
  
  [ifndef] SCL  PB6 constant SCL  [then]
  [ifndef] SDA  PB7 constant SDA  [then]
  