rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
adc_external.h
Go to the documentation of this file.
1/*
2 * @file adc_external.h
3 *
4 * external ADC is probably broken, at least there is a major mess
5 *
6 * @date Aug 18, 2013
7 * @author Andrey Belomutskiy, (c) 2012-2020
8 */
9
10#pragma once
11
12#include "mcp3208.h"
13
14/* 12 bits, 5V reference */
15#define adcRawValueToScaledVoltage(adc) (5.0f / 4095 * (adc))
16
17#define adcGetRawValue(channel) getMcp3208adc(channel)
18/* NOTE: no call to getAnalogInputDividerCoefficient() */
19#define adcGetScaledVoltage(msg, channel) (isAdcChannelValid(channel) ? adcRawValueToScaledVoltage(adcGetRawValue(msg, channel), channel) : 66.66)