Skip to main content

to_nanovolts

Function to_nanovolts 

Source
pub fn to_nanovolts(pga: Pga, raw: i16) -> i64
Expand description

Converts a raw conversion result to nanovolts at the selected full-scale range.

The result is a 16-bit two’s-complement code spanning plus or minus the full scale, so the voltage is code * full_scale / 32768. Working in nanovolts keeps the conversion exact in integer arithmetic across every gain setting.

§Arguments

  • pga - the gain the conversion was taken at.
  • raw - the signed conversion register value.

§Returns

The measured voltage in nanovolts.