#include <xc.h>
#include "measure.h"
#include "mcc_generated_files/mcc.h"
Go to the source code of this file.
◆ ADC_REFH
◆ ADC_RESOLUTION
      
        
          | #define ADC_RESOLUTION   (1024 - 1) | 
      
 
 
◆ AVERAGE_SAMPLES
      
        
          | #define AVERAGE_SAMPLES   8 | 
      
 
 
◆ CURRENT_CHANNEL
      
        
          | #define CURRENT_CHANNEL   0x6 | 
      
 
 
◆ GAIN
◆ RESISTOR
◆ VOLTAGE_CHANNEL
      
        
          | #define VOLTAGE_CHANNEL   0x5 | 
      
 
 
◆ adc_init()
Initialize ADC and pins for measuring current and voltage 
Definition at line 16 of file measure.c.
 
 
◆ measure_current()
      
        
          | uint16_t measure_current | ( | uint16_t | offset | ) |  | 
      
 
Measure the current on the solar panel. This function is expected to do some filtering
- Parameters
- 
  
    | offset | : the offset as measured by measure_current_offset |  
 
- Returns
- the current in microamperes 
Definition at line 49 of file measure.c.
 
 
◆ measure_voltage()
      
        
          | uint16_t measure_voltage | ( | void |  | ) |  | 
      
 
Measure the voltage on the channel for the current. This function is expected to do some filtering.
- Returns
- The offset 
Definition at line 37 of file measure.c.