On Tue, 4 Feb 2020 at 04:04, Jon Elson <[email protected]> wrote:

> I think it is better to use uint32_t and uint64_t and-or
> int32_t and int64_t so that you get the exact same integer
> length no matter the kernel and libraries.

I don't think that there is any point sign-extending uint32, so the
type you want to replace that long is int32 (or possibly hal_s32_t)

The Mesa absolute encoder (and related smart-serial encoder) counters
have to handle arbitrary bit-lengths, and it is extended in to a
64-bit accumulator.
It is handled here:
https://github.com/LinuxCNC/linuxcnc/blob/master/src/hal/drivers/mesa-hostmot2/sserial.c#L2044
But reading it is made a little harder by the fact that the index and
counts come in on general-purpose hal pins (pin->s32_pin,
pin->float_pin etc)
It also has the complication of handling high/low split encoder data
and gray code.


-- 
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
— George Fitch, Atlanta Constitution Newspaper, 1912


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

Reply via email to