discard previous trial, tried display with internal frame buffer
This commit is contained in:
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* b_cccv_algo.h
|
||||
*
|
||||
* Created on: 16.06.2023
|
||||
* Author: max
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include "stm32h7xx_hal.h"
|
||||
|
||||
#ifndef INC_B_CCCV_ALGO_H_
|
||||
#define INC_B_CCCV_ALGO_H_
|
||||
|
||||
#define I_GAIN 4
|
||||
#define P_GAIN 10
|
||||
#define CHARGE_CURRENT_LIMIT 10.0
|
||||
#define SIMULINKTEST
|
||||
#undef SIMULINKTEST
|
||||
|
||||
|
||||
typedef enum{
|
||||
NO_CHARGING,
|
||||
CHARGING_IN_PROGRESS,
|
||||
CHARGING_COMPLETED
|
||||
} CCCV_CONTROL_STATE;
|
||||
|
||||
#ifdef SIMULINKTEST
|
||||
CCCV_CONTROL_STATE cccvloop(float maxcellvoltage, float voltagesetpoint, float maxcurrent, float*ccurrent);
|
||||
#else
|
||||
|
||||
CCCV_CONTROL_STATE cccvloop(float maxcellvoltage, float voltagesetpoint, float maxcurrent);
|
||||
void setchargecurrent(float chargecurrent);
|
||||
void setchargevoltage(uint8_t numberofcells,float maximumcellvoltage);
|
||||
float getMaximumCellVoltage();
|
||||
void chargingloop(float maximumcellvoltage);
|
||||
void startcharging(float endvoltage);
|
||||
void initChargerAlgo(uint8_t numberofcells, float maximumcellvoltage);
|
||||
void setchargevoltage(uint8_t numberofcells,float maximumcellvoltage);
|
||||
void stopcharging();
|
||||
#endif
|
||||
|
||||
float matlabvalidationwrapper(float maxcellvoltage, float voltagesetpoint, float maxcurrent);
|
||||
|
||||
#endif /* INC_B_CCCV_ALGO_H_ */
|
||||
@ -1,62 +0,0 @@
|
||||
#ifndef CAN_HALAL_H
|
||||
#define CAN_HALAL_H
|
||||
|
||||
// Define family macros if none are defined and we recognize a chip macro
|
||||
#if !defined(STM32F3) && !defined(STM32H7)
|
||||
#if defined(STM32F302x6) || defined(STM32F302x8) || defined(STM32F302xB) || \
|
||||
defined(STM32F302xC)
|
||||
#define STM32F3
|
||||
#endif
|
||||
#if defined(STM32H7A3xx)
|
||||
#define STM32H7
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(STM32F3)
|
||||
#include "stm32f3xx_hal.h"
|
||||
#define FTCAN_IS_BXCAN
|
||||
#define FTCAN_NUM_FILTERS 13
|
||||
#elif defined(STM32H7)
|
||||
#include "stm32h7xx_hal.h"
|
||||
#define FTCAN_IS_FDCAN
|
||||
#define FTCAN_NUM_FILTERS 13
|
||||
#else
|
||||
#error "Couldn't detect STM family"
|
||||
#endif
|
||||
|
||||
#if defined(FTCAN_IS_BXCAN)
|
||||
HAL_StatusTypeDef ftcan_init(CAN_HandleTypeDef *handle);
|
||||
#elif defined(FTCAN_IS_FDCAN)
|
||||
HAL_StatusTypeDef ftcan_init(FDCAN_HandleTypeDef *handle);
|
||||
#else
|
||||
#error "Unknown CAN peripheral"
|
||||
#endif
|
||||
|
||||
HAL_StatusTypeDef ftcan_transmit(uint16_t id, const uint8_t *data,
|
||||
size_t datalen);
|
||||
|
||||
HAL_StatusTypeDef ftcan_add_filter(uint16_t id, uint16_t mask);
|
||||
|
||||
/**
|
||||
* Define this function to be notified of incoming CAN messages
|
||||
*/
|
||||
void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t *data);
|
||||
|
||||
/**
|
||||
* Read num_bytes bytes from a message (unmarshalled network byte order). The
|
||||
* msg pointer is advanced by the corresponding number of bytes.
|
||||
*
|
||||
* Both methods return a 64-bit integer, but you can safely cast it to a smaller
|
||||
* integer type.
|
||||
*/
|
||||
uint64_t ftcan_unmarshal_unsigned(const uint8_t **data, size_t num_bytes);
|
||||
int64_t ftcan_unmarshal_signed(const uint8_t **data, size_t num_bytes);
|
||||
|
||||
/**
|
||||
* Write num_bytes to a message (marshalled in network byte order). The pointer
|
||||
* is advanced by the corresponding number of bytes and returned.
|
||||
*/
|
||||
uint8_t *ftcan_marshal_unsigned(uint8_t *data, uint64_t val, size_t num_bytes);
|
||||
uint8_t *ftcan_marshal_signed(uint8_t *data, int64_t val, size_t num_bytes);
|
||||
|
||||
#endif // CAN_HALAL_H
|
||||
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* can.h
|
||||
*
|
||||
* Created on: 21.06.2023
|
||||
* Author: max
|
||||
*/
|
||||
|
||||
#ifndef INC_CAN_H_
|
||||
#define INC_CAN_H_
|
||||
|
||||
#include "stm32h7xx_hal.h"
|
||||
|
||||
#define CAN_ID_AMS_STATUS 0x00A
|
||||
#define CAN_ID_AMS_IN 0x00B
|
||||
#define CAN_ID_SLAVE_STATUS_BASE 0x080
|
||||
#define CAN_ID_CHARGER_ACTIVE 0x200
|
||||
|
||||
|
||||
|
||||
void initCan(FDCAN_HandleTypeDef *hcan);
|
||||
|
||||
#endif /* INC_CAN_H_ */
|
||||
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* charge_ctrl_test_shell.h
|
||||
*
|
||||
* Created on: May 21, 2023
|
||||
* Author: max
|
||||
*/
|
||||
|
||||
#ifndef INC_CHARGE_CTRL_TEST_SHELL_H_
|
||||
#define INC_CHARGE_CTRL_TEST_SHELL_H_
|
||||
|
||||
#include "stm32h7xx_hal.h"
|
||||
|
||||
void charge_shell_init(UART_HandleTypeDef *huart);
|
||||
void charge_shell_loop();
|
||||
|
||||
|
||||
#endif /* INC_CHARGE_CTRL_TEST_SHELL_H_ */
|
||||
@ -1,39 +0,0 @@
|
||||
/*
|
||||
* charger_control.h
|
||||
*
|
||||
* Created on: May 21, 2023
|
||||
* Author: MaxMax
|
||||
*/
|
||||
|
||||
#ifndef INC_CHARGER_CONTROL_H_
|
||||
#define INC_CHARGER_CONTROL_H_
|
||||
|
||||
#include "stm32h7xx_hal.h"
|
||||
|
||||
#define CURRENT_DAC_ADR 0x58
|
||||
#define VOLTAGE_DAC_ADR 0x5E
|
||||
#define CHARGER_ADC_ADR 0x90
|
||||
|
||||
typedef struct{
|
||||
uint8_t acfail;
|
||||
uint8_t dcfail;
|
||||
uint8_t cc_status;
|
||||
uint8_t ot_status;
|
||||
uint8_t lim_status;
|
||||
uint16_t voltage;
|
||||
uint16_t current;
|
||||
}ChargerStatusHandleTypeDef;
|
||||
|
||||
void charger_control_init(I2C_HandleTypeDef* hi2c);
|
||||
|
||||
ChargerStatusHandleTypeDef charger_control_get_state();
|
||||
void charger_control_set_current(uint32_t current);
|
||||
void charger_control_set_voltage(uint32_t voltage);
|
||||
void charger_control_enable_charger_relay();
|
||||
void charger_control_disable_charger_relay();
|
||||
void charger_control_enable_remote();
|
||||
void charger_control_disable_remote();
|
||||
void charger_control_setup_DACs();
|
||||
|
||||
|
||||
#endif /* INC_CHARGER_CONTROL_H_ */
|
||||
@ -7,13 +7,12 @@
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2022 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
* Copyright (c) 2025 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* File Name :
|
||||
* Description :
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2025 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* slave_handler.h
|
||||
*
|
||||
* Created on: Jun 21, 2023
|
||||
* Author: max
|
||||
*/
|
||||
|
||||
#ifndef INC_SLAVE_HANDLER_H_
|
||||
#define INC_SLAVE_HANDLER_H_
|
||||
|
||||
#include "stm32h7xx_hal.h"
|
||||
|
||||
#define N_SLAVES 6
|
||||
|
||||
typedef enum {
|
||||
SLAVE_ERR_NONE,
|
||||
SLAVE_ERR_TIMEOUT,
|
||||
SLAVE_ERR_OT,
|
||||
SLAVE_ERR_UT,
|
||||
SLAVE_ERR_OV,
|
||||
SLAVE_ERR_UV,
|
||||
SLAVE_ERR_UNKNOWN,
|
||||
} SlaveErrorKind;
|
||||
|
||||
typedef struct {
|
||||
SlaveErrorKind kind;
|
||||
uint32_t data; // Cell/temperature ID etc
|
||||
} SlaveError;
|
||||
|
||||
typedef struct {
|
||||
uint8_t id;
|
||||
SlaveError error;
|
||||
uint8_t soc;
|
||||
uint16_t min_voltage;
|
||||
uint16_t max_voltage;
|
||||
int16_t max_temp;
|
||||
uint32_t last_message;
|
||||
} SlaveHandle;
|
||||
|
||||
extern SlaveHandle slaves[N_SLAVES];
|
||||
|
||||
float slaves_get_maximum_voltage();
|
||||
void slaves_handle_status(const uint8_t *data);
|
||||
void slave_handler_init();
|
||||
|
||||
#endif /* INC_SLAVE_HANDLER_H_ */
|
||||
@ -6,15 +6,14 @@
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2022 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
* Copyright (c) 2025 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
@ -61,7 +60,6 @@ void FDCAN1_IT1_IRQHandler(void);
|
||||
void FMC_IRQHandler(void);
|
||||
void FDCAN_CAL_IRQHandler(void);
|
||||
void LTDC_IRQHandler(void);
|
||||
void LTDC_ER_IRQHandler(void);
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
||||
Reference in New Issue
Block a user