Colibri Forth Cookbook
Useful Forth routines for Colibri family of products, listed in no particular order. This will also act as in informal tutorial in how to program the Colibri System.
All examples assumes `hex` mode, unless otherwise stated or indicated.
Get GPIO pin
portA pin5 gpio@
Set GPIO pin
portA pin5 high gpio! ( set gpio PA5 high )
portA pin5 low gpio! ( set gpio PA5 low )
Write byte to I2C
41 1 61 >i2c1 ( writes 0x41, 0x42 and 0x43 to I2C address 0x61 )
Write 3 bytes to I2C
41 42 43 3 61 >i2c1 ( writes 0x41, 0x42 and 0x43 to I2C address 0x61 )
Read byte from I2C
1 61 i2c1> ( reads 1 byte from I2C address 0x61 on to the stack )
Read 5 bytes from I2C
5 61 i2c1> ( reads 5 bytes from I2C address 0x61 )