Contiki 3.x
Functions
voltage.c File Reference

    Helper functions for reading Mulle platform board voltages.
More...

#include "voltage.h"
#include "adc.h"
#include "K60.h"
#include "config-board.h"

Go to the source code of this file.

Functions

uint16_t voltage_from_raw_adc (uint16_t adc_raw)
 Scale a raw ADC reading from 0..65535 to millivolts depending on the board's VREFH, VREFL reference voltages. More...
 
uint16_t voltage_read_vbat ()
 

Detailed Description

    Helper functions for reading Mulle platform board voltages.
Author
Joakim Gebart joaki.nosp@m.m.ge.nosp@m.bart@.nosp@m.eist.nosp@m.ec.se

Definition in file voltage.c.

Function Documentation

uint16_t voltage_from_raw_adc ( uint16_t  adc_raw)

Scale a raw ADC reading from 0..65535 to millivolts depending on the board's VREFH, VREFL reference voltages.

Todo:
Nitpick: Should we divide by 65535 or 65536 in the ADC conversion?

Definition at line 67 of file voltage.c.

References MULLE_ADC_VREFHL_SCALE_MILLIVOLTS, and MULLE_ADC_VREFL_MILLIVOLTS.

Referenced by voltage_read_vbat().

uint16_t voltage_read_vbat ( )
Todo:
Use interrupts to handle AD conversions of Vbat/Vchr

Definition at line 80 of file voltage.c.

References MULLE_ADC_VBAT_ADC_NUM, and voltage_from_raw_adc().