Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
MPPT.c File Reference

Solar cells MPTT monitoring. More...

#include <stdbool.h>
#include "modules/energy/MPPT.h"
#include "firmwares/fixedwing/main_fbw.h"
#include "mcu_periph/i2c.h"
#include "mcu_periph/uart.h"
#include "pprzlink/messages.h"
#include "modules/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 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
 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...
 
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

◆ MPPT_MODE_ADDR

#define MPPT_MODE_ADDR   0xf

Definition at line 37 of file MPPT.c.

◆ MPPT_SLAVE_ADDR

#define MPPT_SLAVE_ADDR   0x40

Definition at line 35 of file MPPT.c.

◆ MPPT_STATUS_ASKING

#define MPPT_STATUS_ASKING   2

Definition at line 66 of file MPPT.c.

◆ MPPT_STATUS_IDLE

#define MPPT_STATUS_IDLE   0

Definition at line 64 of file MPPT.c.

◆ MPPT_STATUS_READING

#define MPPT_STATUS_READING   3

Definition at line 67 of file MPPT.c.

◆ MPPT_STATUS_WRITING

#define MPPT_STATUS_WRITING   1

Definition at line 65 of file MPPT.c.

◆ NB_I2C_DATA

#define NB_I2C_DATA   8

Definition at line 36 of file MPPT.c.

Function Documentation

◆ MPPT_ask()

static void MPPT_ask ( void  )
static

Definition at line 80 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:

◆ MPPT_init()

void MPPT_init ( void  )

Definition at line 73 of file MPPT.c.

References MPPT_mode, MPPT_status, and MPPT_STATUS_IDLE.

◆ MPPT_periodic()

Variable Documentation

◆ data_index

uint8_t data_index = 0xff
static

Definition at line 70 of file MPPT.c.

Referenced by MPPT_ask(), and MPPT_periodic().

◆ MPPT_data

int16_t MPPT_data[NB_DATA]
static

Definition at line 71 of file MPPT.c.

Referenced by MPPT_ask(), and MPPT_periodic().

◆ MPPT_mode

uint8_t MPPT_mode

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 60 of file MPPT.c.

Referenced by MPPT_init(), and MPPT_periodic().

◆ MPPT_status

uint8_t MPPT_status
static

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

Definition at line 63 of file MPPT.c.

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

◆ mppt_trans

struct i2c_transaction mppt_trans

Definition at line 1 of file MPPT.c.

Referenced by MPPT_ask(), and MPPT_periodic().