Re: [PATCH] HC-SR04 ultrasonic ranger IIO driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Thanks for the patch.

On 06/06/2016 08:40 PM, johannes@xxxxxxxxxxxxxxxxx wrote:
[...]
> + * To configure a device do a
> + *
> + *    mkdir /sys/kernel/config/iio/triggers/hc-sr04/sensor0
> + *
> + * (you need to mount configfs to /sys/kernel/config first unless it isn't
> + * mounted already)
> + *
> + * Then configure the ECHO and TRIG pins (this also accepts symbolic names
> + * configured in the device tree)
> + *
> + *    echo 23 > /config/iio/triggers/hc-sr04/sensor0/trig_pin
> + *    echo 24 > /config/iio/triggers/hc-sr04/sensor0/echo_pin
> + *
> + * Then you can measure distance with:
> + *
> + *    cat /sys/devices/trigger0/measure
> + *
> + * (trigger0 is the device name as reported by
> + *  /config/iio/triggers/hc-sr04/sensor0/dev_name

Any new ABI needs to be documented in Documentation/ABI/...

But to take one thing ahead passing the GPIO number (or a label) from
userspace is not really a good ABI in my opinion. The GPIO numbers should
come from the hardware description (DTS, ACPI, board file, ...)

> +	do_gettimeofday(&now);

gettimeofday is not a good function if you want to measure elapsed time
since the returned value jumps around when the system time is changed. Try
to use one of the monotonic time sources, those are guaranteed not to jump
around.
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux