Wixel SDK
millivolts.c
1 #include <cc2511_types.h>
2 #include "adc.h"
3 
4 static uint16 millivoltCalibration = 3300;
5 
7 {
8  //return adcRead(15|ADC_REFERENCE_INTERNAL);
9  return ((uint32)adcRead(15|ADC_REFERENCE_INTERNAL)*3750 + 1023) / 2047;
10 }
11 
13 {
14  millivoltCalibration = vddMillivolts;
15 }
16 
18 {
19  return ((int32)adcResult * millivoltCalibration + 1023) / 2047;
20 }
signed short int16
Definition: cc2511_types.h:18
#define ADC_REFERENCE_INTERNAL
Definition: adc.h:65
int16 adcConvertToMillivolts(int16 adcResult)
Definition: millivolts.c:17
unsigned long uint32
Definition: cc2511_types.h:21
unsigned short uint16
Definition: cc2511_types.h:15
void adcSetMillivoltCalibration(uint16 vddMillivolts)
Definition: millivolts.c:12
signed long int32
Definition: cc2511_types.h:24
uint16 adcRead(uint8 channel)
Definition: adc.c:5
uint16 adcReadVddMillivolts()
Definition: millivolts.c:6