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/appl/arduino/blocks/wiring_analog.frt | 65 ----------------------- 1 file changed, 65 deletions(-) delete mode 100644 amforth-6.5/appl/arduino/blocks/wiring_analog.frt (limited to 'amforth-6.5/appl/arduino/blocks/wiring_analog.frt') diff --git a/amforth-6.5/appl/arduino/blocks/wiring_analog.frt b/amforth-6.5/appl/arduino/blocks/wiring_analog.frt deleted file mode 100644 index e3faa9a..0000000 --- a/amforth-6.5/appl/arduino/blocks/wiring_analog.frt +++ /dev/null @@ -1,65 +0,0 @@ -\ analog read functions for arduino. -\ -\ usage -\ once (in turnkey): adc.init (sets up the subsystem) -\ repeated: analog.X analog_read ( -- n) -\ - -\ \\\\\\\\\\\\\\\\\\\\\\\\\\\ -\ HELPER ROUTINES \ -\ \\\\\\\\\\\\\\\\\\\\\\\\\\\ -\ pin>channel -\ convert bitmask of portpin: back to value (bitposition) -: pin>channel ( pinmask portaddr -- pos ) - drop ( -- pinmask ) - log2 ( -- pos_of_most_significant_bit ) -; - -: adc.init ( -- ) - \ ADMUX - \ A_ref is NOT connected externally - \ ==> need to set bit REFS0 in register ADMUX - [ 0 5 lshift \ ADLAR off, makes read operation simpler - 1 6 lshift or \ REFS0 - ] literal ADMUX c! - \ ADCSRA - [ 1 7 lshift \ ADEN ADC enabled - 1 2 lshift or \ ADPS2 prescaler = 128 - 1 1 lshift or \ ADPS1 . - 1 or \ ADPS0 . - ] literal ADCSRA c! -; -: adc.init.pin ( bitmask portaddr -- ) - over over high - pin_input -; - -1 6 lshift constant ADSC_MSK \ ADStartConversion bitmask -: adc.start - \ start conversion - ADSC_MSK ADCSRA high -; -: adc.wait - \ wait for completion of conversion - begin - ADCSRA c@ ADSC_MSK and 0= - until -; -: adc.channel! ( channel -- ) - 7 and \ clip channel to 0..7 - ADMUX c@ 7 invert and \ read ADMUX, clear old channel - or \ add new channel - ADMUX c! \ write -; - -: adc.get ( namedpin -- a ) - pin>channel adc.channel! adc.start adc.wait - ADC @ \ always 10bit -; - -\ make sure the ports are set up and do one -\ conversion. -: analog_read ( pinmask portaddr -- n ) - 2dup adc.init.pin - adc.get -; -- cgit v1.2.3