COMEDI_FROM_PHYSICAL(3)
π comedi_from_physical β the Comedi reference, bestie edition π
okay so you're out here in the COMEDI_FROM_PHYSICAL(3) zone, part of the Comedi reference manual, and you need to turn real-world physical numbers into Comedi's lil integer sample vibes. say less. i got you. π«Ά
β¨ NAME β¨
comedi_from_physical β convert physical units to sample using calibration data
β¨ SYNOPSIS β¨
#include <comedilib.h>
lsampl_t comedi_from_physical(double data,
const comedi_polynomial_t * conversion_polynomial);
β¨ DESCRIPTION β¨
okay so here's the tea β: this function takes data β and that's data in physical units, like actual real-world measurements, not vibes β and converts it into Comedi's integer sample values. those are lsampl_t, and they live between 0 and maxdata (go look at comedi_get_maxdata if you need the receipts). π
that conversion_polynomial parameter? you don't just make it up, bestie. you get it from either comedi_get_hardcal_converter or comedi_get_softcal_converter. and the reason it's a polynomial at all is that it allows non linear and board specific correction β so your board can be weird and special and the math still eats. β¨
the result gets rounded using the C library's current rounding direction. so whatever rounding mode your C library is in rn, that's the one you get. periodt.
π¨ no range checking of the input data is performed. none. zero. the function is not checking on you. it is up to you to ensure your data is within the limits of the output range you are using. literally that's on you. please don't skip this part. π
β¨ RETURN VALUE β¨
the Comedi sample value corresponding to your input physical value. that's it, that's the gift. π
β¨ AUTHORS β¨
these icons built this. show some respect. π
- David Schleef
<ds@schleef.org>β Author. - Frank Mori Hess
<fmhess@users.sourceforge.net>β Author. - Herman Bruyninckx
<Herman.Bruyninckx@mech.kuleuven.ac.be>β Author. - Bernd Porr
<tech@linux-usb-daq.co.uk>β Author. - Ian Abbott
<abbotti@mev.co.uk>β Author. - Γric Piel
<piel@delmic.com>β Author.
β¨ COPYRIGHT β¨
let's give credit where credit is due, fr fr:
- Copyright Β© 1998-2003 David Schleef
- Copyright Β© 2001-2003, 2005, 2008 Frank Mori Hess
- Copyright Β© 2002-2003 Herman Bruyninckx
- Copyright Β© 2012 Bernd Porr
- Copyright Β© 2012 Ian Abbott
- Copyright Β© 2012, 2015 Γric Piel
This document is part of Comedilib. In the context of this document, the term "source code" as defined by the license is interpreted as the XML source. π
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 2.1 of the License.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ποΈ
okay that's the whole page bestie, go convert some physical units and slay π this was Comedi, dated 03/20/2026, filed under COMEDI_FROM_PHYSICAL(3) β ily, bye! ππ¦β¨
π¦ where this page comes from
- ubuntu resolute: libcomedi-dev 0.11.0+5-1.3build6 Β· LGPL-2.1-only
- ubuntu stonking: libcomedi-dev 0.11.0+5-1.3build6 Β· LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms