On Tuesday 09 February 2021 08:27:56 Thomas J Powderly wrote:

> 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 field 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

Not at all intuitive 

> So, what is the opinion about the config string format?
>
> 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
>
Looks good to me, TomP
>
>
> _______________________________________________
> Emc-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/emc-developers


Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>

_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to