Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
MPPT.c File Reference

Solar cells MPTT monitoring. More...

#include <stdbool.h>
#include "MPPT.h"
#include "firmwares/fixedwing/main_fbw.h"
#include "mcu_periph/i2c.h"
#include "mcu_periph/uart.h"
#include "messages.h"
#include "subsystems/datalink/downlink.h"
+ Include dependency graph for MPPT.c:

Go to the source code of this file.

Macros

#define MPPT_SLAVE_ADDR   0x40
 
#define NB_I2C_DATA   8
 
#define MPPT_MODE_ADDR   0xf
 
#define DOWNLINK_DEVICE   DOWNLINK_AP_DEVICE
 0: VBat (mV) 1: IBat (mA) 2: PBat (mW) 3: VSol (mV) 4: ISol (mA) 5: PSol (mW) 6: IConv (mA) 7: PConv (mW) More...
 
#define MPPT_STATUS_IDLE   0
 
#define MPPT_STATUS_WRITING   1
 
#define MPPT_STATUS_ASKING   2
 
#define MPPT_STATUS_READING   3
 

Functions

void MPPT_init (void)
 
static void MPPT_ask (void)
 
void MPPT_periodic (void)
 

Variables

struct i2c_transaction mppt_trans
 
uint8_t MPPT_mode
 
static uint8_t MPPT_status
 A value different from 0 is a request from this mode. More...
 
static uint8_t data_index = 0xff
 
static int16_t MPPT_data [NB_DATA]
 

Detailed Description

Solar cells MPTT monitoring.

Definition in file MPPT.c.

Macro Definition Documentation

#define DOWNLINK_DEVICE   DOWNLINK_AP_DEVICE

0: VBat (mV) 1: IBat (mA) 2: PBat (mW) 3: VSol (mV) 4: ISol (mA) 5: PSol (mW) 6: IConv (mA) 7: PConv (mW)

9: IBat + IConv

Definition at line 57 of file MPPT.c.

#define MPPT_MODE_ADDR   0xf

Definition at line 37 of file MPPT.c.

Referenced by MPPT_periodic().

#define MPPT_SLAVE_ADDR   0x40

Definition at line 35 of file MPPT.c.

Referenced by MPPT_ask(), and MPPT_periodic().

#define MPPT_STATUS_ASKING   2

Definition at line 69 of file MPPT.c.

Referenced by MPPT_ask(), and MPPT_periodic().

#define MPPT_STATUS_IDLE   0

Definition at line 67 of file MPPT.c.

Referenced by MPPT_init(), and MPPT_periodic().

#define MPPT_STATUS_READING   3

Definition at line 70 of file MPPT.c.

Referenced by MPPT_periodic().

#define MPPT_STATUS_WRITING   1

Definition at line 68 of file MPPT.c.

Referenced by MPPT_periodic().

#define NB_I2C_DATA   8

Definition at line 36 of file MPPT.c.

Referenced by MPPT_ask(), and MPPT_periodic().

Function Documentation

static void MPPT_ask ( void  )
static

Definition at line 82 of file MPPT.c.

References i2c_transaction::buf, data_index, DefaultChannel, DefaultDevice, i2c_transmit(), MPPT_data, MPPT_IBAT_INDEX, MPPT_ICONV_INDEX, MPPT_ITOTAL_INDEX, MPPT_SLAVE_ADDR, MPPT_status, MPPT_STATUS_ASKING, mppt_trans, NB_DATA, and NB_I2C_DATA.

Referenced by MPPT_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MPPT_init ( void  )

Definition at line 76 of file MPPT.c.

void MPPT_periodic ( void  )

Definition at line 98 of file MPPT.c.

Variable Documentation

uint8_t data_index = 0xff
static

Definition at line 73 of file MPPT.c.

Referenced by MPPT_ask(), and MPPT_periodic().

int16_t MPPT_data[NB_DATA]
static

Definition at line 74 of file MPPT.c.

Referenced by MPPT_ask(), and MPPT_periodic().

uint8_t MPPT_mode

Definition at line 63 of file MPPT.c.

Referenced by MPPT_init(), and MPPT_periodic().

uint8_t MPPT_status
static

A value different from 0 is a request from this mode.

Definition at line 66 of file MPPT.c.

Referenced by MPPT_ask(), MPPT_init(), and MPPT_periodic().

struct i2c_transaction mppt_trans

Definition at line 39 of file MPPT.c.

Referenced by MPPT_ask(), and MPPT_periodic().