From d80736ab6e8e3cad2f1a30c6eaba2d6883dbe967 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sat, 26 Aug 2017 20:31:40 +0200 Subject: Remove AmForth --- amforth-6.5/examples/i2c-compass.frt | 55 ------------------------------------ 1 file changed, 55 deletions(-) delete mode 100644 amforth-6.5/examples/i2c-compass.frt (limited to 'amforth-6.5/examples/i2c-compass.frt') diff --git a/amforth-6.5/examples/i2c-compass.frt b/amforth-6.5/examples/i2c-compass.frt deleted file mode 100644 index 651af14..0000000 --- a/amforth-6.5/examples/i2c-compass.frt +++ /dev/null @@ -1,55 +0,0 @@ -\ -\ compass module mmc2120 (memsic) -\ hwid is always $30 -\ provides: -\ -\ i2c.compass.get ( -- status X Y) -\ X and Y are around 2000 (raw data) -\ status is 0 if no error occured - -\ further calculation? - -$30 constant i2c.compass - -\ internal commands -: i2c.compass.setcoil - i2c.compass i2c.begin - 0 i2c.tx - %00000010 i2c.tx \ set coil - i2c.end -; -: i2c.compass.resetcoil - i2c.compass i2c.begin - 0 i2c.tx - %00000100 i2c.tx \ reset coil - i2c.end -; - -: i2c.compass.measure - i2c.compass i2c.begin - 0 i2c.tx - %00000001 i2c.tx \ start measurement - i2c.end -; - -: i2c.compass.fetchdata ( -- status x y ) - i2c.compass i2c.begin - 0 i2c.tx - i2c.start \ rep-start - i2c.compass i2c.rd i2c.tx - 4 0 do i2c.rx loop i2c.rxn - i2c.end - ( -- status msb-x lsb-x msb-y lsb-y) - swap >< or $fff and >r \ Y - swap >< or $fff and r> \ X -; - -\ get the raw data from the module -\ the numbers for X/Y are usually around 2000. -\ status is 0 if everything is ok -: i2c.compass.get ( -- status x y ) - i2c.compass.resetcoil 1ms - i2c.compass.setcoil 5 ms - i2c.compass.measure 5 ms - i2c.compass.fetchdata -; -- cgit v1.2.3