naming convention for public/private words?



I'm implementing a system with multiple layers, e.g. two low-level words,
which are called from higher levels:

\ set the state of a digital output pin
\ state: 1 for high, 0 for low
\ n: digital output 1 or 2
: set-digital-output ( state n -- )

\ get the state of a digital input pin
\ n: digital input 1 or 2
\ return: 1, if high; 0, if low
: digital-input? ( n -- state )

These IO words are in one file, but need some more words to set the
registers of the microcontroller, which doesn't make sense to call from the
higher level, e.g. something like this (the code works, but looks a bit
ugly)

\ implementation for changing a GPIO

0 value gpio-control-regs
here to gpio-control-regs
0x30 , 0x34 , 0x120 ,

: gpio-write ( value reg -- )
ns9xxx-base-reg-pa-gpio memory-write
;

: get-control-reg ( pin -- reg )
32 / cells gpio-control-regs + @
;

: control-gpio ( state pin -- )
0 0 locals| reg shift pin state |
pin get-control-reg to reg
pin 32 mod to shift
reg gpio-read
1 shift lshift invert and
state shift lshift or
reg gpio-write
;

Is there a usual naming convention for such private words?

--
Frank Buss, fb@xxxxxxxxxxxxx
http://www.frank-buss.de, http://www.it4-systems.de
.



Relevant Pages

  • Re: digital out cdrom to receiver
    ... It is a weird 2-4 pin connector though. ... If your receiver ... you need more than the around 2mA a standard digital output can supply. ...
    (comp.sys.ibm.pc.hardware.misc)
  • Re: Counting Bike Wheel Revs
    ... > The $1 sensors in the DigiKey catalog include a signal ... Three pins: Power, Ground, digital output. ... >> need is an input port pin and a pullup resistor. ... > sensor might be worth the extra $0.60. ...
    (comp.arch.embedded)
  • Re: ADC current requirement
    ... digital output with a 0 written to the pin, and it's driving the load low ... An ADC input should be like any ... I WAS TOTALLY LOST. ... When I put, on my opinion, pin to be digital out 0 it started to work ...
    (sci.electronics.basics)
  • Re: ADC current requirement
    ... a digital output with a 0 written to the pin, ... An ADC input ... I WAS TOTALLY LOST. ... When I put, on my opinion, pin to be digital out 0 it started to work ...
    (sci.electronics.basics)
  • Re: Xilinx Tristate Registration
    ... reg pin_out; ... one pin has the same tristate function). ... registered function in a lower level module, ...
    (comp.arch.fpga)