// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // BV4506 - I2C Keypa ** NOTE default address on this is 0x62 // This is a library of words inteded for this device it is an I2C // device. The user should set the device address // using the word 4506-default. // This will load as a stand alone file or can be used as a library // providing the parent file includes the files in the REQUIRES // section // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // REQUIRES: // #URL-lib "http://pin1.org/forthlib/flb/General/soft1.flb" sid=0 // #URL-lib "http://pin1.org/forthlib/flb/General/pinsel.flb" sid=101 // #URL-Lib "http://pin1.org/forthlib/flb/I2C/i2c.flb" sid=103 // #URL-Lib "http://pin1.org/forthlib/flb/I2C/bvsys.flb" // CONSTANTS: // device variable is in bvsys.lib // These are simple commands following the device commands. : a1 ( -- kb ) device s 1 sb device 1+ rs rl p ; // # keys in buffer : a2 ( -- ) device s 2 sb p ; // clear key buffer : a3 ( -- kd ) device s 3 sb device 1+ rs rl p ; // ret 1 if key down : a4 { #keys -- } device s 4 sb // reads number of keys in buffer #keys 0= if escape then device 1+ rs #keys 1 = if rl p escape then #keys 1- for rn next rl p ; : 4506-default &62 bv-init i2cfull ;