Battery config updated and started with Doxygen added

This commit is contained in:
Martin Jaeger
2019-03-10 18:34:05 +01:00
parent e9c45702c8
commit e4a20fba85
26 changed files with 3234 additions and 1020 deletions
+26 -21
View File
@@ -1,5 +1,5 @@
/* LibreSolar MPPT charge controller firmware
* Copyright (c) 2016-2018 Martin Jäger (www.libre.solar)
/* LibreSolar charge controller firmware
* Copyright (c) 2016-2019 Martin Jäger (www.libre.solar)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,41 +14,46 @@
* limitations under the License.
*/
#ifndef __LOAD_H_
#define __LOAD_H_
#ifndef LOAD_H
#define LOAD_H
/** @file
*
* @brief
* Load output functions and data types
*/
#include <stdbool.h>
enum load_state_t {
LOAD_STATE_DISABLED = 0, // Load actively disabled
LOAD_STATE_ON, // Normal state: Load on
LOAD_STATE_OFF_LOW_SOC, // Load off to protect battery (overrules remote setting)
LOAD_STATE_OFF_OVERCURRENT // Load off to protect charge controller (overrules remote setting)
LOAD_STATE_DISABLED = 0, ///< Load actively disabled
LOAD_STATE_ON, ///< Normal state: Load on
LOAD_STATE_OFF_LOW_SOC, ///< Load off to protect battery (overrules remote setting)
LOAD_STATE_OFF_OVERCURRENT ///< Load off to protect charge controller (overrules remote setting)
};
enum usb_state_t {
USB_STATE_DISABLED = 0, // USB port actively disabled
USB_STATE_ON, // Normal state: USB on
USB_STATE_OFF_LOW_SOC, // USB off to protect battery (overrules target setting)
USB_STATE_OFF_OVERCURRENT // USB off to protect charge controller (overrules target setting)
USB_STATE_DISABLED = 0, ///< USB port actively disabled
USB_STATE_ON, ///< Normal state: USB on
USB_STATE_OFF_LOW_SOC, ///< USB off to protect battery (overrules target setting)
USB_STATE_OFF_OVERCURRENT ///< USB off to protect charge controller (overrules target setting)
};
/* Load Output type
/** Load Output type
*
* Stores status of load output incl. 5V USB output (if existing on PCB)
*/
typedef struct {
load_state_t state;
usb_state_t usb_state;
float current; // actual measurement
float current_max; // maximum allowed current
int overcurrent_timestamp; // time at which an overcurrent event occured
bool enabled; // actual status
bool enabled_target; // target setting defined via communication
// port (overruled if battery is empty)
bool usb_enabled_target; // same for USB output
float current; ///< actual measurement
float current_max; ///< maximum allowed current
int overcurrent_timestamp; ///< time at which an overcurrent event occured
bool enabled; ///< actual status
bool enabled_target; ///< target setting defined via communication port (overruled if battery is empty)
bool usb_enabled_target; ///< same for USB output
} load_output_t;
void load_init(load_output_t *load);
@@ -57,4 +62,4 @@ void load_state_machine(load_output_t *load, bool source_enabled);
void load_check_overcurrent(load_output_t *load);
#endif /* __LOAD_H_ */
#endif /* LOAD_H */