18c2ecf20Sopenharmony_ciWhat: /sys/bus/iio/devices/iio:deviceX/in_altvoltageY_invert 28c2ecf20Sopenharmony_ciDate: October 2016 38c2ecf20Sopenharmony_ciKernelVersion: 4.9 48c2ecf20Sopenharmony_ciContact: Peter Rosin <peda@axentia.se> 58c2ecf20Sopenharmony_ciDescription: 68c2ecf20Sopenharmony_ci The DAC is used to find the peak level of an alternating 78c2ecf20Sopenharmony_ci voltage input signal by a binary search using the output 88c2ecf20Sopenharmony_ci of a comparator wired to an interrupt pin. Like so:: 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci _ 118c2ecf20Sopenharmony_ci | \ 128c2ecf20Sopenharmony_ci input +------>-------|+ \ 138c2ecf20Sopenharmony_ci | \ 148c2ecf20Sopenharmony_ci .-------. | }---. 158c2ecf20Sopenharmony_ci | | | / | 168c2ecf20Sopenharmony_ci | dac|-->--|- / | 178c2ecf20Sopenharmony_ci | | |_/ | 188c2ecf20Sopenharmony_ci | | | 198c2ecf20Sopenharmony_ci | | | 208c2ecf20Sopenharmony_ci | irq|------<-------' 218c2ecf20Sopenharmony_ci | | 228c2ecf20Sopenharmony_ci '-------' 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci The boolean invert attribute (0/1) should be set when the 258c2ecf20Sopenharmony_ci input signal is centered around the maximum value of the 268c2ecf20Sopenharmony_ci dac instead of zero. The envelope detector will search 278c2ecf20Sopenharmony_ci from below in this case and will also invert the result. 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci The edge/level of the interrupt is also switched to its 308c2ecf20Sopenharmony_ci opposite value. 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ciWhat: /sys/bus/iio/devices/iio:deviceX/in_altvoltageY_compare_interval 338c2ecf20Sopenharmony_ciDate: October 2016 348c2ecf20Sopenharmony_ciKernelVersion: 4.9 358c2ecf20Sopenharmony_ciContact: Peter Rosin <peda@axentia.se> 368c2ecf20Sopenharmony_ciDescription: 378c2ecf20Sopenharmony_ci Number of milliseconds to wait for the comparator in each 388c2ecf20Sopenharmony_ci step of the binary search for the input peak level. Needs 398c2ecf20Sopenharmony_ci to relate to the frequency of the input signal. 40