Hi Mathias! Thanks for nice example.
I believe I'm using register names right or at least same way wrong as you do :) I think I'll write some more constants to my projects so that those higher bytes are setted in reasonable way. > From: mtr...@web.de > To: amforth-devel@lists.sourceforge.net > Date: Mon, 17 Mar 2014 19:12:23 +0100 > Subject: Re: [Amforth] How amforth-shell register bitnames are intended to > use? > > SPCR %00001100 bitmask: spi.mode > $0 constant spi.mode0 \ sample rising/-- > $4 constant spi.mode1 \ --/sample falling > $8 constant spi.mode2 \ sample falling/-- > $c constant spi.mode3 \ --/sample rising > : spi.setmode ( spi-mode -- ) spi.mode pin! ; I still don't like magic numbers and as amforth-shell can substitute them... SPCR_CPOL SPCR_CPHA or constant spi.mode3 But library code can't have that kind of depedency for amforth-shell I believe. > > Used as > > spi.mode0 spi.setmode > > Similiar the spi.setspeed word. > > Note that the bit patterns from the different > modeX definitions already match the bitmap: > definition. > > "high" and "low" change all bits which are set > to 1 in the bitmap: definition. They could be > seen as > > address bitmap bitmap: example > $ff example pin! \ high > $00 example pin! \ low This is maybe the finest feature of Amforth. Usually I just end writing brainlesly bla bla 0 <> my-portword pin! and it just works. In init code I gather every bit, or them together and then c! to register. But this is propably matter of taste. At least I know what I have set then and if I mess somehow the registers I can reset them with init word. Hannu ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amforth-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amforth-devel