Anno domini 2021 Tue, 9 Feb 20:27:56 +0700
Thomas J Powderly scripsit:
> I have been working on a new version of hal_pi_gpio.
> It uses an array of structures to hold the features for each pin.
> struct pinfo
> {
> hal_bit_t pval; // the last read value for inputs, the
> desired output value for outputs
> char pnum; // the rpi header pin number
> char gpionum; // the gpio number for said pin number
> hal_bit_t pdir; // input or output
> hal_bit_t pinv; // wether inverted pin is wanted ( inputs only )
> hal_bit_t pres; // wether reset feature is wanted (outputs only )
> };
> I have not implemented the invert or reset pins yet,
> but want opinion on a single big change..
> the change is about how you enter the config string.
> The format I propose is simple:
> the config string is a list of 'quad's as follows:
> loadrt hal_pi_gpio pi_pins={,,,}{,,,}{,,,}
> each 'quad' consists of braces enclosed data
> 1st pnum a 2 char string representing the rpi header pin number.
> 2nd is '>' or '<' representing input or output
> 3rd depends on input or output
> if input '+' or '-' declare an inverted pin is wanted or not
> if output 0 or 1 declare the initial state , and the state returned
> to if 'reset' feature is designed
> 4th also depends on input or output
> if input, this 4th fiel;d is not used, i suggest 'x' used to fill
> the need for a single ignored char
> if output, the 4th field is 'Y' or 'N' declaring the reset feature
> is wanted or not
> This way of describing the config string is more intuitive that the
> current method
> eg: dir=78855 exclude=32918520
>
> So, what is the opinion about the config string format?
Why not 3 strings of 24 chars, eg.:
io="iiiioooo................" \
inv="..11...1................" \
reset="00110001................"
All pins in "io=" with "i" or "o" are used - all others excluded, a "1" in
"inv=" is "invert this pin"
Nik
>
> example run-----------------------------------
> pi@raspberrypi:~/linuxcnc-dev/src $ halrun
> halcmd: loadrt hal_pi_gpio pi_pins={03,>.0.Y}{05,>,0,Y}\
> halcmd+: {07,>,0,Y}{11,<,+,x}{12,<,+,x}\
> halcmd+: {13,<.+,x}{15,>,1,N}{16,>,1,N}\
> halcmd+: {18,>,1,N}{19,>,1,N}{21,>,1,N}
> Note: Using POSIX realtime
> halcmd: show pin
> Component Pins:
> Owner Type Dir Value Name
> 4 bit IN FALSE hal_pi_gpio.pin-03-out
> 4 bit IN FALSE hal_pi_gpio.pin-05-out
> 4 bit IN FALSE hal_pi_gpio.pin-07-out
> 4 bit OUT FALSE hal_pi_gpio.pin-11-in
> 4 bit OUT FALSE hal_pi_gpio.pin-12-in
> 4 bit OUT FALSE hal_pi_gpio.pin-13-in
> 4 bit IN FALSE hal_pi_gpio.pin-15-out
> 4 bit IN FALSE hal_pi_gpio.pin-16-out
> 4 bit IN FALSE hal_pi_gpio.pin-18-out
> 4 bit IN FALSE hal_pi_gpio.pin-19-out
> 4 bit IN FALSE hal_pi_gpio.pin-21-out
> 4 s32 OUT 0 hal_pi_gpio.read.time
> 4 s32 OUT 0 hal_pi_gpio.write.time
>
> halcmd: setp hal_pi_gpio.pin-21-out 1
> halcmd: setp hal_pi_gpio.pin-15-out 1
> halcmd: show pin
> Component Pins:
> Owner Type Dir Value Name
> 4 bit IN FALSE hal_pi_gpio.pin-03-out
> 4 bit IN FALSE hal_pi_gpio.pin-05-out
> 4 bit IN FALSE hal_pi_gpio.pin-07-out
> 4 bit OUT FALSE hal_pi_gpio.pin-11-in
> 4 bit OUT FALSE hal_pi_gpio.pin-12-in
> 4 bit OUT FALSE hal_pi_gpio.pin-13-in
> 4 bit IN TRUE hal_pi_gpio.pin-15-out
> 4 bit IN FALSE hal_pi_gpio.pin-16-out
> 4 bit IN FALSE hal_pi_gpio.pin-18-out
> 4 bit IN FALSE hal_pi_gpio.pin-19-out
> 4 bit IN TRUE hal_pi_gpio.pin-21-out
> 4 s32 OUT 0 hal_pi_gpio.read.time
> 4 s32 OUT 0 hal_pi_gpio.write.time
>
> halcmd:
>
> thx
> tomp
>
>
>
> _______________________________________________
> Emc-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/emc-developers
>
--
Please do not email me anything that you are not comfortable also sharing with
the NSA, CIA ...
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers