global refactoring
This commit is contained in:
26
.mxproject
26
.mxproject
File diff suppressed because one or more lines are too long
BIN
Core/.DS_Store
vendored
BIN
Core/.DS_Store
vendored
Binary file not shown.
@@ -21,5 +21,7 @@ void Init_Peripheral();
|
||||
uint8_t GBT_LockGetState();
|
||||
void GBT_Lock(uint8_t state);
|
||||
uint8_t SW_GetAddr();
|
||||
void ADC_Select_Channel(uint32_t ch);
|
||||
|
||||
|
||||
#endif /* SRC_BOARD_H_ */
|
||||
|
||||
@@ -8,6 +8,21 @@
|
||||
#ifndef INC_CHARGER_GBT_H_
|
||||
#define INC_CHARGER_GBT_H_
|
||||
#include "main.h"
|
||||
#include "connector.h"
|
||||
|
||||
#define GBT_CST_NO_REASON 0x0000F0F0
|
||||
#define GBT_CST_CONDITION_REACHED 0x0100F0F0 // заряд завершен
|
||||
#define GBT_CST_SUSPENDS_ARTIFICIALLY 0x0400F0F0
|
||||
#define GBT_CST_FAULT_SUSPENSION 0x1000F0F0
|
||||
#define GBT_CST_BMS_ACTIVELY_SUSPENDS 0x4000F0F0 //завершение по инициативе BMS
|
||||
#define GBT_CST_CONNECTOR_OVER_TEMP 0x0001F0F0
|
||||
#define GBT_CST_INT_PART_OVER_TEMP 0x0010F0F0
|
||||
#define GBT_CST_CANNOT_SUPPLY_REQ_ELQ 0x0040F0F0
|
||||
#define GBT_CST_SUDDENSTOP 0x0000F1F0
|
||||
#define GBT_CST_OTHERFALUT 0x0000F4F0
|
||||
#define GBT_CST_CURRENT_MISMATCH 0x0000F0F1
|
||||
#define GBT_CST_ABNORMALVOLTAGEERROR 0x0000F0F4
|
||||
|
||||
|
||||
typedef enum{
|
||||
GBT_CC_UNKNOWN,
|
||||
@@ -19,20 +34,22 @@ typedef enum{
|
||||
}gbtCcState_t;
|
||||
|
||||
typedef enum{
|
||||
GBT_DISABLED,
|
||||
GBT_S0_UNCONNECTED, //СС1 12V/6V СС2 12V
|
||||
GBT_S1_CONNECTED, //СС1 4V СС2 4V (6V)
|
||||
GBT_S2_LOCKED, //
|
||||
GBT_S3_STARTED, // 12V AUX
|
||||
GBT_S4_ISOTEST, // testing isolation, send CHM receive BHM
|
||||
GBT_S5_BAT_INFO, // identifying BMS, send CRM receive BRM (long)
|
||||
GBT_S6_BAT_STAT, // send CRM(AA), receive BCP (long)
|
||||
GBT_S7_BMS_WAIT, // wait for BMS, send CTS+CML receive BRO(00), next BRO(AA)
|
||||
GBT_S8_INIT_CHARGER,// starting power modules, send CRO(00)
|
||||
GBT_S9_WAIT_BCL, // waiting for BCL (requested voltage), send CRO(00)
|
||||
GBT_S10_CHARGING, // charging, contactor ON, send CCS, receiving BCL+BCS+BSM
|
||||
GBT_STOP, // stop
|
||||
//TODO: after stop send BSD state
|
||||
GBT_DISABLED = 0x10,
|
||||
// GBT_S0_UNCONNECTED = 0x10, //СС1 12V/6V СС2 12V
|
||||
// GBT_S1_CONNECTED = 0x11, //СС1 4V СС2 4V (6V)
|
||||
// GBT_S2_LOCKED = 0x12, //
|
||||
GBT_S3_STARTED = 0x13, // 12V AUX
|
||||
GBT_S4_ISOTEST = 0x14, // testing isolation, send CHM receive BHM
|
||||
GBT_S5_BAT_INFO = 0x15, // identifying BMS, send CRM receive BRM (long)
|
||||
GBT_S6_BAT_STAT = 0x16, // send CRM(AA), receive BCP (long)
|
||||
GBT_S7_BMS_WAIT = 0x17, // wait for BMS, send CTS+CML receive BRO(00), next BRO(AA)
|
||||
GBT_S8_INIT_CHARGER = 0x18,// starting power modules, send CRO(00)
|
||||
GBT_S9_WAIT_BCL = 0x19, // waiting for BCL (requested voltage), send CRO(00)
|
||||
GBT_S10_CHARGING = 0x20, // charging, contactor ON, send CCS, receiving BCL+BCS+BSM
|
||||
GBT_STOP = 0x21, // normal stop
|
||||
GBT_STOP_CSD = 0x22, // normal stop
|
||||
GBT_ERROR = 0x23, // Error
|
||||
GBT_COMPLETE = 0x24,
|
||||
|
||||
}gbtState_t;
|
||||
|
||||
@@ -46,7 +63,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
uint8_t bmsIdentified;
|
||||
char chargerNumber[4];
|
||||
uint32_t chargerNumber;
|
||||
char chargerLocation[3];
|
||||
}GBT_CRM_t;
|
||||
|
||||
@@ -124,6 +141,12 @@ typedef struct {
|
||||
|
||||
}GBT_CCS_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t chargingTime;
|
||||
uint16_t outputEnergy;
|
||||
uint32_t chargerNumber;
|
||||
}GBT_CSD_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t enablePSU;
|
||||
@@ -135,6 +158,9 @@ typedef struct {
|
||||
uint16_t chargingElapsedTimeMin; //
|
||||
uint8_t chargingElapsedTimeSec; //
|
||||
|
||||
CONN_State_t connectorState;
|
||||
|
||||
|
||||
}GBT_EDCAN_Output_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -142,9 +168,11 @@ typedef struct {
|
||||
uint16_t measuredVoltage; // 0.1V/bit
|
||||
uint16_t measuredCurrent; // 0.1A/bit
|
||||
|
||||
CONN_Control_t chargeControl;
|
||||
|
||||
}GBT_EDCAN_Input_t;
|
||||
|
||||
|
||||
/* 500 - Power Supply
|
||||
TX
|
||||
* PSU_ENABLE
|
||||
@@ -170,6 +198,8 @@ RX
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
extern gbtState_t GBT_State;
|
||||
|
||||
extern ADC_HandleTypeDef hadc1;
|
||||
|
||||
extern GBT_BRM_t GBT_EVInfo;
|
||||
@@ -180,30 +210,38 @@ extern GBT_CML_t GBT_MaxLoad;
|
||||
extern GBT_CCS_t GBT_ChargerCurrentStatus;
|
||||
extern GBT_CRM_t GBT_ChargerInfo;
|
||||
extern GBT_BSM_t GBT_BatteryStatus;
|
||||
extern GBT_CSD_t GBT_ChargerStop;
|
||||
|
||||
extern uint8_t GBT_BRO;
|
||||
|
||||
extern uint8_t GBT_Charger_Enable;
|
||||
|
||||
void GBT_Init();
|
||||
void GBT_Start();
|
||||
void GBT_Stop();
|
||||
void GBT_Stop1();
|
||||
void GBT_Reset();
|
||||
void GBT_Stop(uint32_t causecode);
|
||||
void GBT_ForceStop();
|
||||
void GBT_ChargerTask();
|
||||
float GBT_CC_GetAdc();
|
||||
void ADC_Select_Channel(uint32_t ch);
|
||||
uint8_t GBT_CC_GetState();
|
||||
void GBT_Error(uint32_t errorcode);
|
||||
|
||||
//float GBT_CC_GetAdc();
|
||||
|
||||
//uint8_t GBT_CC_GetState();
|
||||
|
||||
void GBT_SwitchState(gbtState_t state);
|
||||
void GBT_Delay(uint32_t delay);
|
||||
uint32_t GBT_StateTick();
|
||||
void J_SendPacket(uint32_t PGN, uint8_t pri, uint8_t DLC, uint8_t *data);
|
||||
|
||||
void GBT_SendCCS();
|
||||
void GBT_SendCST();
|
||||
void GBT_SendCST(uint32_t Cause);
|
||||
void GBT_SendCRO(uint8_t state);
|
||||
void GBT_SendCML();
|
||||
void GBT_SendCTS();
|
||||
void GBT_SendCHM();
|
||||
void GBT_SendCRM(uint8_t state);
|
||||
|
||||
void GBT_SendCSD();
|
||||
void GBT_SendCEM(uint32_t ErrorCode);
|
||||
|
||||
|
||||
#endif /* INC_CHARGER_GBT_H_ */
|
||||
|
||||
49
Core/Inc/connector.h
Normal file
49
Core/Inc/connector.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* connector.h
|
||||
*
|
||||
* Created on: Jul 31, 2024
|
||||
* Author: colorbass
|
||||
*/
|
||||
|
||||
#ifndef INC_CONNECTOR_H_
|
||||
#define INC_CONNECTOR_H_
|
||||
|
||||
#include "main.h"
|
||||
|
||||
|
||||
|
||||
// Статус
|
||||
// статус подключения к автомобилю
|
||||
|
||||
typedef enum __attribute__((packed)) {
|
||||
CONN_Initializing = 1,
|
||||
CONN_Error = 2,
|
||||
CONN_Available = 3,
|
||||
CONN_Occupied_waiting = 4,// to charge
|
||||
CONN_Occupied_charging = 5,
|
||||
CONN_Occupied_complete = 6,//, waiting to disconnect
|
||||
|
||||
} CONN_State_t;
|
||||
|
||||
// Управление
|
||||
// Разрешение на зарядку
|
||||
|
||||
typedef enum __attribute__((packed)) {
|
||||
CHARGING_NOT_ALLOWED = 1,
|
||||
CHARGING_ALLOWED = 2,
|
||||
FORCE_UNLOCK = 3,
|
||||
|
||||
} CONN_Control_t;
|
||||
#include "charger_gbt.h"
|
||||
|
||||
|
||||
extern CONN_State_t connectorState;
|
||||
|
||||
void CONN_Init();
|
||||
void CONN_Task();
|
||||
void CONN_SetState(CONN_State_t state);
|
||||
uint8_t CONN_CC_GetStateRaw();
|
||||
uint8_t CONN_CC_GetState();
|
||||
float CONN_CC_GetAdc();
|
||||
|
||||
#endif /* INC_CONNECTOR_H_ */
|
||||
@@ -10,4 +10,8 @@
|
||||
//#define ED_CAN1
|
||||
#define ED_CAN2
|
||||
|
||||
extern CAN_HandleTypeDef hcan2;
|
||||
#define ED_CAN_INSTANCE hcan2
|
||||
|
||||
|
||||
#endif //EDCAN_CONFIG_H
|
||||
|
||||
@@ -35,5 +35,6 @@ void J_SendACK(j_receive_t rx);
|
||||
|
||||
|
||||
void GBT_CAN_ReInit();
|
||||
void GBT_CAN_FilterInit();
|
||||
|
||||
#endif /* INC_J1939_H_ */
|
||||
|
||||
28
Core/Inc/lock.h
Normal file
28
Core/Inc/lock.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* lock.h
|
||||
*
|
||||
* Created on: Jul 31, 2024
|
||||
* Author: colorbass
|
||||
*/
|
||||
|
||||
#ifndef INC_LOCK_H_
|
||||
#define INC_LOCK_H_
|
||||
|
||||
#include "main.h"
|
||||
#include "stdbool.h"
|
||||
|
||||
|
||||
void GBT_Lock(uint8_t state);
|
||||
void GBT_ManageLock();
|
||||
uint8_t GBT_LockGetState();
|
||||
void GBT_ForceLock(uint8_t state);
|
||||
|
||||
typedef struct {
|
||||
// uint8_t state;
|
||||
uint8_t demand;
|
||||
uint8_t error;
|
||||
} GBT_LockState_t;
|
||||
|
||||
extern GBT_LockState_t GBT_LockState;
|
||||
|
||||
#endif /* INC_LOCK_H_ */
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
#include <stdio.h>
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
52
Core/Inc/rtc.h
Normal file
52
Core/Inc/rtc.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file rtc.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the rtc.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 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 */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __RTC_H__
|
||||
#define __RTC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
extern RTC_HandleTypeDef hrtc;
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_RTC_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
|
||||
/* USER CODE END Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __RTC_H__ */
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
/*#define HAL_HCD_MODULE_ENABLED */
|
||||
/*#define HAL_PWR_MODULE_ENABLED */
|
||||
/*#define HAL_RCC_MODULE_ENABLED */
|
||||
/*#define HAL_RTC_MODULE_ENABLED */
|
||||
#define HAL_RTC_MODULE_ENABLED
|
||||
/*#define HAL_SD_MODULE_ENABLED */
|
||||
/*#define HAL_MMC_MODULE_ENABLED */
|
||||
/*#define HAL_SDRAM_MODULE_ENABLED */
|
||||
|
||||
BIN
Core/Src/.DS_Store
vendored
BIN
Core/Src/.DS_Store
vendored
Binary file not shown.
@@ -11,26 +11,7 @@ extern ADC_HandleTypeDef hadc1;
|
||||
|
||||
//TODO:
|
||||
//TEMP READ
|
||||
//LOCK_FB
|
||||
//GBT_TEMP_SENSORS
|
||||
//USB
|
||||
|
||||
void GBT_Lock(uint8_t state){
|
||||
if(state){//LOCK
|
||||
HAL_GPIO_WritePin(LOCK_A_GPIO_Port, LOCK_A_Pin, 1);
|
||||
HAL_Delay(50);
|
||||
HAL_GPIO_WritePin(LOCK_A_GPIO_Port, LOCK_A_Pin, 0);
|
||||
}else{ //UNLOCK
|
||||
HAL_GPIO_WritePin(LOCK_B_GPIO_Port, LOCK_B_Pin, 1);
|
||||
HAL_Delay(50);
|
||||
HAL_GPIO_WritePin(LOCK_B_GPIO_Port, LOCK_B_Pin, 0);
|
||||
}
|
||||
}
|
||||
uint8_t GBT_LockGetState(){
|
||||
return HAL_GPIO_ReadPin(LOCK_FB_GPIO_Port, LOCK_FB_Pin);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void RELAY_Write(relay_t num, uint8_t state){
|
||||
if(num==RELAY_AUX)HAL_GPIO_WritePin(RELAY_AUX_GPIO_Port, RELAY_AUX_Pin, state);
|
||||
|
||||
@@ -79,7 +79,7 @@ void MX_CAN2_Init(void)
|
||||
hcan2.Init.TimeTriggeredMode = DISABLE;
|
||||
hcan2.Init.AutoBusOff = ENABLE;
|
||||
hcan2.Init.AutoWakeUp = ENABLE;
|
||||
hcan2.Init.AutoRetransmission = DISABLE;
|
||||
hcan2.Init.AutoRetransmission = ENABLE;
|
||||
hcan2.Init.ReceiveFifoLocked = DISABLE;
|
||||
hcan2.Init.TransmitFifoPriority = ENABLE;
|
||||
if (HAL_CAN_Init(&hcan2) != HAL_OK)
|
||||
|
||||
@@ -13,18 +13,27 @@
|
||||
#include "j1939.h"
|
||||
#include "string.h"
|
||||
#include "edcan.h"
|
||||
#include "lock.h"
|
||||
#include "connector.h"
|
||||
|
||||
uint8_t GBT_CC_GetStateRaw();
|
||||
|
||||
gbtState_t GBT_State;
|
||||
uint32_t GBT_state_tick; //Tick after state switch
|
||||
uint32_t GBT_delay;
|
||||
uint8_t GBT_BAT_INFO_recv;
|
||||
uint8_t GBT_BAT_STAT_recv;
|
||||
uint8_t GBT_BRO_recv;
|
||||
uint8_t GBT_BHM_recv;
|
||||
uint8_t GBT_BSD_recv;
|
||||
uint8_t EV_ready;
|
||||
//uint8_t GBT_Charger_Enable; //FIX
|
||||
//uint8_t GBT_Charger_Permission;//FIX
|
||||
|
||||
GBT_BHM_t GBT_MaxVoltage;
|
||||
GBT_CML_t GBT_MaxLoad;
|
||||
GBT_CRM_t GBT_ChargerInfo;
|
||||
|
||||
GBT_BHM_t GBT_MaxVoltage;
|
||||
GBT_BRM_t GBT_EVInfo;
|
||||
GBT_BCP_t GBT_BATStat;
|
||||
GBT_BCL_t GBT_ReqPower;
|
||||
@@ -36,64 +45,35 @@ GBT_BSM_t GBT_BatteryStatus;
|
||||
|
||||
GBT_CCS_t GBT_ChargerCurrentStatus;
|
||||
|
||||
GBT_CSD_t GBT_ChargerStop;
|
||||
|
||||
uint8_t GBT_BRO;
|
||||
|
||||
uint32_t GBT_TimeChargingStarted;
|
||||
|
||||
uint32_t GBT_StopCauseCode;
|
||||
uint32_t GBT_ErrorCode;
|
||||
|
||||
extern GBT_EDCAN_Output_t GBT_EDCAN_Output;
|
||||
extern GBT_EDCAN_Input_t GBT_EDCAN_Input;
|
||||
|
||||
|
||||
void GBT_Init(){
|
||||
GBT_State = GBT_DISABLED;
|
||||
GBT_Lock(0);
|
||||
GBT_EDCAN_Input.chargeControl == CHARGING_NOT_ALLOWED;
|
||||
GBT_Reset();
|
||||
}
|
||||
|
||||
uint8_t GBT_CC_GetState(){
|
||||
//Vref=3.3v = 4095
|
||||
//k=1/11
|
||||
//Vin = 12v
|
||||
//Vin*k= 1.09v
|
||||
//12vin = 1353 ADC
|
||||
//TODO: Filter 100ms
|
||||
uint32_t adc;
|
||||
float volt;
|
||||
ADC_Select_Channel(ADC_CHANNEL_6);
|
||||
HAL_ADC_Start(&hadc1);
|
||||
HAL_ADC_PollForConversion(&hadc1, 100);
|
||||
adc = HAL_ADC_GetValue(&hadc1);
|
||||
HAL_ADC_Stop(&hadc1);
|
||||
|
||||
volt = (float)adc/113.4f;
|
||||
if((volt<12.6f) && (volt>11.4f)) return GBT_CC_12V;
|
||||
if((volt<6.8f) && (volt>5.2f)) return GBT_CC_6V;
|
||||
if((volt<4.8f) && (volt>3.2f)) return GBT_CC_4V;
|
||||
if((volt<2.8f) && (volt>1.2f)) return GBT_CC_2V;
|
||||
return GBT_CC_UNKNOWN;
|
||||
}
|
||||
|
||||
float GBT_CC_GetAdc(){
|
||||
//Vref=3.3v = 4095
|
||||
//k=1/11
|
||||
//Vin = 12v
|
||||
//Vin*k= 1.09v
|
||||
//12vin = 1353 ADC
|
||||
|
||||
uint32_t adc;
|
||||
float volt;
|
||||
ADC_Select_Channel(ADC_CHANNEL_6);
|
||||
HAL_ADC_Start(&hadc1);
|
||||
HAL_ADC_PollForConversion(&hadc1, 100);
|
||||
adc = HAL_ADC_GetValue(&hadc1);
|
||||
HAL_ADC_Stop(&hadc1);
|
||||
|
||||
volt = (float)adc/113.4f;
|
||||
|
||||
return volt;
|
||||
}
|
||||
|
||||
void GBT_ChargerTask(){
|
||||
|
||||
//GBT_LockTask();
|
||||
if(j_rx.state == 2){
|
||||
switch (j_rx.PGN){
|
||||
case 0x2700: //PGN BHM
|
||||
GBT_BHM_recv = 1;
|
||||
memcpy (&GBT_MaxVoltage, j_rx.data, sizeof(GBT_MaxVoltage));
|
||||
|
||||
break;
|
||||
@@ -110,6 +90,7 @@ void GBT_ChargerTask(){
|
||||
break;
|
||||
|
||||
case 0x0900: //PGN BRO
|
||||
GBT_BRO_recv = 1;
|
||||
if(j_rx.data[0] == 0xAA) EV_ready = 1;
|
||||
else EV_ready = 0;
|
||||
GBT_BRO = j_rx.data[0];
|
||||
@@ -118,9 +99,9 @@ void GBT_ChargerTask(){
|
||||
case 0x1000: //PGN BCL
|
||||
//TODO: power block
|
||||
memcpy (&GBT_ReqPower, j_rx.data, sizeof(GBT_ReqPower));
|
||||
uint16_t volt=GBT_ReqPower.requestedVoltage/10;
|
||||
uint16_t volt=GBT_ReqPower.requestedVoltage;
|
||||
GBT_EDCAN_Output.requestedVoltage = volt;
|
||||
uint16_t curr=(4000-GBT_ReqPower.requestedCurrent);
|
||||
uint16_t curr=4000-GBT_ReqPower.requestedCurrent;
|
||||
GBT_EDCAN_Output.requestedCurrent = curr;
|
||||
break;
|
||||
|
||||
@@ -148,6 +129,18 @@ void GBT_ChargerTask(){
|
||||
//TODO
|
||||
break;
|
||||
|
||||
//this handler in j1939.c
|
||||
// case 0x1900: //PGN BST
|
||||
// break;
|
||||
|
||||
case 0x1C00: //PGN BSD
|
||||
//TODO SOC Voltage Temp
|
||||
GBT_BSD_recv = 1;
|
||||
break;
|
||||
|
||||
//this handler in j1939.c
|
||||
// case 0x1E00: //PGN BEM
|
||||
// break;
|
||||
|
||||
//BSM BMV BMT BSP BST BSD BEM
|
||||
|
||||
@@ -159,32 +152,48 @@ void GBT_ChargerTask(){
|
||||
//waiting
|
||||
}else switch (GBT_State){
|
||||
case GBT_DISABLED:
|
||||
|
||||
break;
|
||||
case GBT_S0_UNCONNECTED:
|
||||
if(GBT_CC_GetState()==GBT_CC_4V){
|
||||
|
||||
GBT_SwitchState(GBT_S1_CONNECTED);
|
||||
GBT_Delay(500);
|
||||
}
|
||||
break;
|
||||
case GBT_S1_CONNECTED:
|
||||
if(GBT_CC_GetState()==GBT_CC_4V){
|
||||
|
||||
GBT_Lock(1);
|
||||
GBT_SwitchState(GBT_S2_LOCKED);
|
||||
GBT_Delay(500);
|
||||
}else{
|
||||
GBT_SwitchState(GBT_S0_UNCONNECTED);
|
||||
}
|
||||
break;
|
||||
case GBT_S2_LOCKED:
|
||||
if(1){ //TODO: charge permission
|
||||
RELAY_Write(RELAY_AUX, 1); // 13.8V AUX ON
|
||||
GBT_SwitchState(GBT_S3_STARTED);
|
||||
GBT_Delay(500);
|
||||
RELAY_Write(RELAY_AUX, 0);
|
||||
if(connectorState == CONN_Occupied_charging){
|
||||
GBT_Reset();
|
||||
GBT_Start();//TODO IF protections (maybe not needed)
|
||||
}
|
||||
break;
|
||||
// case GBT_S0_UNCONNECTED:
|
||||
// if(!GBT_Charger_Enable){
|
||||
// GBT_Stop();
|
||||
// break;
|
||||
// }
|
||||
// if(GBT_CC_GetState()==GBT_CC_4V){
|
||||
//
|
||||
// GBT_SwitchState(GBT_S1_CONNECTED);
|
||||
// GBT_Delay(500);
|
||||
// }
|
||||
// break;
|
||||
// case GBT_S1_CONNECTED:
|
||||
// if(!GBT_Charger_Enable){
|
||||
// GBT_Stop();
|
||||
// break;
|
||||
// }
|
||||
// if(GBT_CC_GetState()==GBT_CC_4V){
|
||||
//
|
||||
// GBT_Lock(1);
|
||||
// GBT_SwitchState(GBT_S2_LOCKED);
|
||||
// GBT_Delay(500);
|
||||
// }else{
|
||||
// GBT_SwitchState(GBT_S0_UNCONNECTED);
|
||||
// }
|
||||
// break;
|
||||
// case GBT_S2_LOCKED:
|
||||
// if(!GBT_Charger_Enable){
|
||||
// GBT_Stop();
|
||||
// break;
|
||||
// }
|
||||
// if(1){ //TODO: charge permission
|
||||
// RELAY_Write(RELAY_AUX, 1); // 13.8V AUX ON
|
||||
// GBT_SwitchState(GBT_S3_STARTED);
|
||||
// GBT_Delay(500);
|
||||
// }
|
||||
// break;
|
||||
|
||||
case GBT_S3_STARTED:
|
||||
GBT_SwitchState(GBT_S4_ISOTEST);
|
||||
@@ -195,20 +204,28 @@ void GBT_ChargerTask(){
|
||||
if(j_rx.state == 0) GBT_SendCHM();
|
||||
GBT_Delay(250);
|
||||
//TODO: Isolation test
|
||||
//TODO: Timeout
|
||||
if(GBT_StateTick()>1500){
|
||||
//if(isolation test fail) {send CST}
|
||||
if(GBT_BHM_recv) {
|
||||
//Isolation test finish
|
||||
GBT_SwitchState(GBT_S5_BAT_INFO);
|
||||
}
|
||||
//Timeout 10S
|
||||
if((GBT_BHM_recv == 0) && (GBT_StateTick()>10000)) { //BHM Timeout
|
||||
GBT_Error(0xFCF0C0FC);
|
||||
}
|
||||
break;
|
||||
|
||||
case GBT_S5_BAT_INFO:
|
||||
if(j_rx.state == 0) GBT_SendCRM(0x00);
|
||||
GBT_Delay(250);
|
||||
if(GBT_BAT_INFO_recv){
|
||||
if(GBT_BAT_INFO_recv){ //BRM
|
||||
//Got battery info
|
||||
GBT_SwitchState(GBT_S6_BAT_STAT);
|
||||
}
|
||||
//Timeout
|
||||
if((GBT_StateTick()>5000) && (GBT_BAT_INFO_recv == 0)){
|
||||
GBT_Error(0xFDF0C0FC); //BRM Timeout
|
||||
}
|
||||
break;
|
||||
|
||||
case GBT_S6_BAT_STAT:
|
||||
@@ -218,6 +235,9 @@ void GBT_ChargerTask(){
|
||||
//Got battery status
|
||||
GBT_SwitchState(GBT_S7_BMS_WAIT);
|
||||
}
|
||||
if((GBT_StateTick()>5000) && (GBT_BAT_STAT_recv == 0)){
|
||||
GBT_Error(0xFCF1C0FC); //BCP Timeout
|
||||
}
|
||||
break;
|
||||
|
||||
case GBT_S7_BMS_WAIT:
|
||||
@@ -225,9 +245,16 @@ void GBT_ChargerTask(){
|
||||
HAL_Delay(2);
|
||||
if(j_rx.state == 0) GBT_SendCML();
|
||||
GBT_Delay(250);
|
||||
if((GBT_StateTick()>5000) && (GBT_BRO_recv == 0)){
|
||||
GBT_Error(0xFCF4C0FC); //BRO Timeout
|
||||
}
|
||||
if(EV_ready){
|
||||
//EV ready (AA)
|
||||
GBT_SwitchState(GBT_S8_INIT_CHARGER);
|
||||
}else{
|
||||
if((GBT_StateTick()>60000) && (GBT_BRO_recv == 1)){
|
||||
GBT_Error(0xFCF4C0FC); //BRO Timeout
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -244,71 +271,82 @@ void GBT_ChargerTask(){
|
||||
case GBT_S9_WAIT_BCL:
|
||||
if(j_rx.state == 0) GBT_SendCRO(0xAA);
|
||||
GBT_Delay(250);
|
||||
if(GBT_ReqPower.chargingMode != 0){
|
||||
if(GBT_ReqPower.chargingMode != 0){ //REFACTORING
|
||||
//BCL power requirements received
|
||||
//write power modules
|
||||
|
||||
GBT_SwitchState(GBT_S10_CHARGING);
|
||||
uint16_t curr=(4000-GBT_ReqPower.requestedCurrent);
|
||||
uint16_t volt=GBT_ReqPower.requestedVoltage/10;
|
||||
//if ((curr10>0) && (curr10<500));
|
||||
//PSU_SetVoltage(volt);
|
||||
//PSU_SetCurrent(curr);
|
||||
CONN_SetState(CONN_Occupied_charging);
|
||||
uint16_t curr=4000-GBT_ReqPower.requestedCurrent;
|
||||
uint16_t volt=GBT_ReqPower.requestedVoltage;
|
||||
//TODO Limits
|
||||
|
||||
GBT_EDCAN_Output.requestedVoltage = volt;
|
||||
GBT_EDCAN_Output.requestedCurrent = curr;
|
||||
GBT_EDCAN_Output.enablePSU = 1;
|
||||
|
||||
GBT_TimeChargingStarted = get_Current_Time();
|
||||
|
||||
//TODO: EDCAN_SendPacketRead
|
||||
|
||||
//смещение -400а
|
||||
//RELAY_Write(RELAY_3, 1);
|
||||
//PSU_Mode(0x0200);
|
||||
}
|
||||
break;
|
||||
|
||||
case GBT_S10_CHARGING:
|
||||
//CHARGING
|
||||
//TODO BCL BCS BSM missing ERRORS
|
||||
if(GBT_EDCAN_Input.chargeControl == CHARGING_NOT_ALLOWED) GBT_Stop(GBT_CST_SUSPENDS_ARTIFICIALLY);
|
||||
if(GBT_EDCAN_Input.chargeControl == FORCE_UNLOCK) GBT_Stop(GBT_CST_SUSPENDS_ARTIFICIALLY);//GBT_ForceStop();
|
||||
if(GBT_LockState.error) GBT_Stop(GBT_CST_OTHERFALUT);
|
||||
//GBT_ChargerCurrentStatus.chargingPermissible = 0b1111111111111100;//NOT PERMITTED
|
||||
GBT_ChargerCurrentStatus.chargingPermissible = 0b1111111111111101;
|
||||
GBT_ChargerCurrentStatus.chargingTime = (get_Current_Time() - GBT_TimeChargingStarted)/60;
|
||||
GBT_ChargerCurrentStatus.outputCurrent = 4000 - GBT_EDCAN_Output.requestedCurrent;
|
||||
GBT_ChargerCurrentStatus.outputVoltage = GBT_EDCAN_Output.requestedVoltage;
|
||||
|
||||
if(j_rx.state == 0) GBT_SendCCS();
|
||||
// write power modules
|
||||
|
||||
|
||||
// if(mm_queue_size()==0){//TODO: hysteresis, charging mode
|
||||
// if(GBT_CurrPower.requestedCurrent != GBT_ReqPower.requestedCurrent){
|
||||
// GBT_CurrPower.requestedCurrent = GBT_ReqPower.requestedCurrent;
|
||||
// //PSU_SetVoltage(GBT_ReqPower.requestedVoltage/10);
|
||||
// uint16_t curr=(4000-GBT_ReqPower.requestedCurrent);
|
||||
// //PSU_SetCurrent(curr);
|
||||
// GBT_ChargingSummary.requestedCurrent = curr;
|
||||
// }
|
||||
// if(GBT_CurrPower.requestedVoltage != GBT_ReqPower.requestedVoltage){
|
||||
// GBT_CurrPower.requestedVoltage = GBT_ReqPower.requestedVoltage;
|
||||
// //PSU_SetCurrent(GBT_ReqPower.requestedCurrent);
|
||||
// uint16_t volt=GBT_ReqPower.requestedVoltage/10;
|
||||
// GBT_ChargingSummary.requestedVoltage = volt;
|
||||
// //PSU_SetVoltage(volt);
|
||||
// //смещение -400а
|
||||
// }
|
||||
//// }
|
||||
|
||||
GBT_Delay(50);
|
||||
|
||||
break;
|
||||
|
||||
case GBT_STOP:
|
||||
//TODO: turn off power modules
|
||||
GBT_Delay(10);
|
||||
GBT_EDCAN_Output.enablePSU = 0;
|
||||
GBT_SendCST();
|
||||
GBT_SendCST(GBT_StopCauseCode);
|
||||
//RELAY_Write(RELAY_OUTPUT, 0);
|
||||
//GBT_SwitchState(GBT_DISABLED);
|
||||
if(GBT_StateTick()>1000){
|
||||
GBT_SwitchState(GBT_DISABLED);
|
||||
GBT_Lock(0);
|
||||
RELAY_Write(RELAY_AUX, 0);
|
||||
if(GBT_StateTick()>10000){
|
||||
GBT_Error(0xFCF0C0FD); //BSD Timeout
|
||||
}
|
||||
|
||||
if(GBT_BSD_recv != 0){
|
||||
GBT_SwitchState(GBT_STOP_CSD);
|
||||
}
|
||||
|
||||
break;
|
||||
case GBT_STOP_CSD:
|
||||
GBT_Delay(250);
|
||||
GBT_SendCSD();
|
||||
if(GBT_StateTick()>2500){ //2.5S
|
||||
GBT_SwitchState(GBT_COMPLETE);
|
||||
// GBT_Reset();
|
||||
//CONN_SetState(CONN_Occupied_complete);
|
||||
//if(connectorState == CONN_Occupied_charging)
|
||||
//PSU_Mode(0x0100);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case GBT_ERROR:
|
||||
GBT_SendCEM(GBT_ErrorCode); //2.5S
|
||||
GBT_SwitchState(GBT_COMPLETE);
|
||||
// GBT_Reset();
|
||||
//
|
||||
break;
|
||||
|
||||
case GBT_COMPLETE:
|
||||
if(connectorState != CONN_Occupied_complete) GBT_SwitchState(GBT_DISABLED);
|
||||
break;
|
||||
|
||||
default:
|
||||
GBT_SwitchState(GBT_DISABLED);
|
||||
}
|
||||
@@ -321,9 +359,9 @@ void GBT_SwitchState(gbtState_t state){
|
||||
ED_status = state;
|
||||
GBT_state_tick = HAL_GetTick();
|
||||
if(GBT_State == GBT_DISABLED) printf ("GBT_DISABLED\n");
|
||||
if(GBT_State == GBT_S0_UNCONNECTED) printf ("GBT_S0_UNCONNECTED\n");
|
||||
if(GBT_State == GBT_S1_CONNECTED) printf ("GBT_S1_CONNECTED\n");
|
||||
if(GBT_State == GBT_S2_LOCKED) printf ("GBT_S2_LOCKED\n");
|
||||
// if(GBT_State == GBT_S0_UNCONNECTED) printf ("GBT_S0_UNCONNECTED\n");
|
||||
// if(GBT_State == GBT_S1_CONNECTED) printf ("GBT_S1_CONNECTED\n");
|
||||
// if(GBT_State == GBT_S2_LOCKED) printf ("GBT_S2_LOCKED\n");
|
||||
if(GBT_State == GBT_S3_STARTED) printf ("GBT_S3_STARTED\n");
|
||||
if(GBT_State == GBT_S4_ISOTEST) printf ("GBT_S4_ISOTEST\n");
|
||||
if(GBT_State == GBT_S5_BAT_INFO) printf ("GBT_S5_BAT_INFO\n");
|
||||
@@ -333,6 +371,9 @@ void GBT_SwitchState(gbtState_t state){
|
||||
if(GBT_State == GBT_S9_WAIT_BCL) printf ("GBT_S9_WAIT_BCL\n");
|
||||
if(GBT_State == GBT_S10_CHARGING) printf ("GBT_S10_CHARGING\n");
|
||||
if(GBT_State == GBT_STOP) printf ("GBT_STOP\n");
|
||||
if(GBT_State == GBT_STOP_CSD) printf ("GBT_STOP_CSD\n");
|
||||
if(GBT_State == GBT_ERROR) printf ("GBT_ERROR\n");
|
||||
if(GBT_State == GBT_COMPLETE) printf ("GBT_COMPLETE\n");
|
||||
|
||||
|
||||
}
|
||||
@@ -345,22 +386,45 @@ void GBT_Delay(uint32_t delay){
|
||||
GBT_delay = HAL_GetTick()+delay;
|
||||
}
|
||||
|
||||
void GBT_Stop(){
|
||||
void GBT_Stop(uint32_t causecode){
|
||||
GBT_StopCauseCode = causecode;
|
||||
if(GBT_State != GBT_STOP) GBT_SwitchState(GBT_STOP);
|
||||
}
|
||||
|
||||
void GBT_Stop1(){
|
||||
GBT_SwitchState(GBT_DISABLED);
|
||||
void GBT_Error(uint32_t errorcode){
|
||||
GBT_ErrorCode = errorcode;
|
||||
GBT_SwitchState(GBT_ERROR);
|
||||
}
|
||||
|
||||
void GBT_ForceStop(){
|
||||
GBT_EDCAN_Output.enablePSU = 0;
|
||||
GBT_SwitchState(GBT_COMPLETE);
|
||||
GBT_Lock(0);
|
||||
RELAY_Write(RELAY_AUX, 0);
|
||||
}
|
||||
|
||||
void GBT_Start(){
|
||||
void GBT_Reset(){
|
||||
GBT_BAT_INFO_recv = 0;
|
||||
GBT_BAT_STAT_recv = 0;
|
||||
GBT_BRO_recv = 0;
|
||||
GBT_BHM_recv = 0;
|
||||
GBT_BSD_recv = 0;
|
||||
EV_ready = 0;
|
||||
memset(&GBT_EVInfo, 0, sizeof (GBT_EVInfo));
|
||||
memset(&GBT_BATStat, 0, sizeof (GBT_BATStat));
|
||||
memset(&GBT_ReqPower, 0, sizeof (GBT_ReqPower));
|
||||
GBT_SwitchState(GBT_S0_UNCONNECTED);
|
||||
memset(&GBT_CurrPower, 0, sizeof (GBT_CurrPower));
|
||||
memset(&GBT_MaxVoltage, 0, sizeof (GBT_MaxVoltage));
|
||||
memset(&GBT_ChargingStatus, 0, sizeof (GBT_ChargingStatus));
|
||||
memset(&GBT_BatteryStatus, 0, sizeof (GBT_BatteryStatus));
|
||||
memset(&GBT_ChargerCurrentStatus, 0, sizeof (GBT_ChargerCurrentStatus));
|
||||
memset(&GBT_ChargerStop, 0, sizeof (GBT_ChargerStop));
|
||||
GBT_CurrPower.requestedCurrent = 4000; //0A
|
||||
GBT_CurrPower.requestedVoltage = 0; //0V
|
||||
GBT_TimeChargingStarted = 0;
|
||||
GBT_BRO = 0x00;
|
||||
}
|
||||
void GBT_Start(){
|
||||
RELAY_Write(RELAY_AUX, 1);
|
||||
GBT_SwitchState(GBT_S3_STARTED);
|
||||
}
|
||||
|
||||
207
Core/Src/connector.c
Normal file
207
Core/Src/connector.c
Normal file
@@ -0,0 +1,207 @@
|
||||
/*
|
||||
* connector.c
|
||||
*
|
||||
* All initialization before 12v_aux
|
||||
*/
|
||||
|
||||
#include "connector.h"
|
||||
#include "lock.h"
|
||||
#include "board.h"
|
||||
|
||||
|
||||
CONN_State_t connectorState;
|
||||
extern GBT_EDCAN_Output_t GBT_EDCAN_Output;
|
||||
extern GBT_EDCAN_Input_t GBT_EDCAN_Input;
|
||||
|
||||
uint8_t CC_STATE_FILTERED;
|
||||
|
||||
void CONN_Init(){
|
||||
CONN_SetState(CONN_Initializing);
|
||||
}
|
||||
|
||||
void CONN_Task(){
|
||||
|
||||
switch (connectorState){
|
||||
case CONN_Initializing: // unlocked
|
||||
GBT_Lock(0);
|
||||
CONN_SetState(CONN_Available);
|
||||
GBT_LockState.error = 0;
|
||||
break;
|
||||
case CONN_Error: //unlocked
|
||||
GBT_Lock(0);
|
||||
|
||||
break;
|
||||
case CONN_Available: //unlocked, waiting to connect
|
||||
GBT_Lock(0);
|
||||
if((CONN_CC_GetState()==GBT_CC_4V) && (GBT_EDCAN_Input.chargeControl != FORCE_UNLOCK)){
|
||||
CONN_SetState(CONN_Occupied_waiting);
|
||||
GBT_Lock(1);
|
||||
|
||||
}
|
||||
break;
|
||||
case CONN_Occupied_waiting: //locked, waiting to charge
|
||||
GBT_Lock(1);
|
||||
if(CONN_CC_GetState()==GBT_CC_4V){
|
||||
if(GBT_EDCAN_Input.chargeControl == CHARGING_ALLOWED){
|
||||
// RELAY_Write(RELAY_AUX, 1);
|
||||
// GBT_Start();
|
||||
CONN_SetState(CONN_Occupied_charging);
|
||||
}
|
||||
if(GBT_EDCAN_Input.chargeControl == FORCE_UNLOCK){
|
||||
CONN_SetState(CONN_Available);
|
||||
}
|
||||
//if (CHARGING_NOT_ALLOWED) stay here
|
||||
}else{
|
||||
CONN_SetState(CONN_Available);
|
||||
}
|
||||
break;
|
||||
case CONN_Occupied_charging://charging, locked
|
||||
GBT_Lock(1);
|
||||
|
||||
if(GBT_State == GBT_COMPLETE){
|
||||
CONN_SetState(CONN_Occupied_complete);
|
||||
}
|
||||
//
|
||||
|
||||
break;
|
||||
case CONN_Occupied_complete://charging completed, waiting to disconnect, unlocked
|
||||
GBT_Lock(0);
|
||||
// RELAY_Write(RELAY_AUX, 0);
|
||||
//TODO: Reconnection
|
||||
if(GBT_EDCAN_Input.chargeControl == CHARGING_NOT_ALLOWED){
|
||||
CONN_SetState(CONN_Initializing);
|
||||
}
|
||||
if(CONN_CC_GetState()==GBT_CC_6V){
|
||||
CONN_SetState(CONN_Initializing);
|
||||
}
|
||||
//Проблема, если нажать кнопку и не вынуть пистолет, то он снова блочится
|
||||
break;
|
||||
default:
|
||||
CONN_SetState(CONN_Initializing);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//external
|
||||
//CONN_SetState(CONN_Error);
|
||||
//CONN_SetState(CONN_Occupied_charging);
|
||||
//CONN_SetState(CONN_Occupied_Complete);
|
||||
|
||||
void CONN_SetState(CONN_State_t state){
|
||||
connectorState = state;
|
||||
if(connectorState == CONN_Initializing) printf ("CONN_Initializing\n");
|
||||
if(connectorState == CONN_Error) printf ("CONN_Error\n");
|
||||
if(connectorState == CONN_Available) printf ("CONN_Available\n");
|
||||
if(connectorState == CONN_Occupied_waiting) printf ("CONN_Occupied_waiting\n");
|
||||
if(connectorState == CONN_Occupied_charging) printf ("CONN_Occupied_charging\n");
|
||||
if(connectorState == CONN_Occupied_complete) printf ("CONN_Occupied_complete\n");
|
||||
GBT_EDCAN_Output.connectorState = state;
|
||||
}
|
||||
|
||||
void CONN_CC_ReadStateFiltered() {
|
||||
static uint32_t last_change_time;
|
||||
static uint32_t last_check_time;
|
||||
static uint8_t prev_state;
|
||||
|
||||
if((last_check_time+100)>HAL_GetTick()) return;
|
||||
|
||||
last_check_time = HAL_GetTick();
|
||||
|
||||
uint8_t new_state = CONN_CC_GetStateRaw();
|
||||
|
||||
if (new_state != prev_state) {
|
||||
last_change_time = HAL_GetTick();
|
||||
prev_state = new_state;
|
||||
} else if ((HAL_GetTick() - last_change_time) >= 300) {
|
||||
CC_STATE_FILTERED = prev_state;
|
||||
}
|
||||
|
||||
// switch(new_state){
|
||||
// case GBT_CC_UNKNOWN:
|
||||
// printf("GBT_CC_UNKNOWN\n");
|
||||
// break;
|
||||
// case GBT_CC_12V:
|
||||
// printf("GBT_CC_12V\n");
|
||||
// break;
|
||||
// case GBT_CC_6V:
|
||||
// printf("GBT_CC_6V\n");
|
||||
// break;
|
||||
// case GBT_CC_4V:
|
||||
// printf("GBT_CC_4V\n");
|
||||
// break;
|
||||
// case GBT_CC_2V:
|
||||
// printf("GBT_CC_2V\n");
|
||||
// break;
|
||||
//
|
||||
// }
|
||||
// switch(CONN_CC_GetState()){
|
||||
// case GBT_CC_UNKNOWN:
|
||||
// printf("FGBT_CC_UNKNOWN\n");
|
||||
// break;
|
||||
// case GBT_CC_12V:
|
||||
// printf("FGBT_CC_12V\n");
|
||||
// break;
|
||||
// case GBT_CC_6V:
|
||||
// printf("FGBT_CC_6V\n");
|
||||
// break;
|
||||
// case GBT_CC_4V:
|
||||
// printf("FGBT_CC_4V\n");
|
||||
// break;
|
||||
// case GBT_CC_2V:
|
||||
// printf("FGBT_CC_2V\n");
|
||||
// break;
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
uint8_t CONN_CC_GetState(){
|
||||
return CC_STATE_FILTERED;
|
||||
}
|
||||
uint8_t CONN_CC_GetStateRaw(){
|
||||
//Vref=3.3v = 4095
|
||||
//k=1/11
|
||||
//Vin = 12v
|
||||
//Vin*k= 1.09v
|
||||
//12vin = 1353 ADC
|
||||
//TODO: Filter 100ms
|
||||
uint32_t adc;
|
||||
float volt;
|
||||
ADC_Select_Channel(ADC_CHANNEL_6);
|
||||
HAL_ADC_Start(&hadc1);
|
||||
HAL_ADC_PollForConversion(&hadc1, 100);
|
||||
adc = HAL_ADC_GetValue(&hadc1);
|
||||
HAL_ADC_Stop(&hadc1);
|
||||
|
||||
volt = (float)adc/113.4f;
|
||||
// if((volt<12.6f) && (volt>11.4f)) return GBT_CC_12V;
|
||||
// if((volt<6.8f) && (volt>5.2f)) return GBT_CC_6V;
|
||||
// if((volt<4.8f) && (volt>3.2f)) return GBT_CC_4V;
|
||||
// if((volt<2.8f) && (volt>1.2f)) return GBT_CC_2V;
|
||||
if((volt<13.0f) && (volt>11.0f)) return GBT_CC_12V;
|
||||
if((volt<7.2f) && (volt>4.8f)) return GBT_CC_6V;
|
||||
if((volt<4.8f) && (volt>3.0f)) return GBT_CC_4V;
|
||||
if((volt<3.0f) && (volt>1.0f)) return GBT_CC_2V;
|
||||
return GBT_CC_UNKNOWN;
|
||||
}
|
||||
|
||||
float CONN_CC_GetAdc(){
|
||||
//TODO: Filters
|
||||
//Vref=3.3v = 4095
|
||||
//k=1/11
|
||||
//Vin = 12v
|
||||
//Vin*k= 1.09v
|
||||
//12vin = 1353 ADC
|
||||
|
||||
uint32_t adc;
|
||||
float volt;
|
||||
ADC_Select_Channel(ADC_CHANNEL_6);
|
||||
HAL_ADC_Start(&hadc1);
|
||||
HAL_ADC_PollForConversion(&hadc1, 100);
|
||||
adc = HAL_ADC_GetValue(&hadc1);
|
||||
HAL_ADC_Stop(&hadc1);
|
||||
|
||||
volt = (float)adc/113.4f;
|
||||
|
||||
return volt;
|
||||
}
|
||||
@@ -12,6 +12,9 @@
|
||||
#include "board.h"
|
||||
#include "charger_gbt.h"
|
||||
#include "usart.h"
|
||||
#include <time.h>
|
||||
#include <connector.h>
|
||||
|
||||
|
||||
uint8_t debug_rx_buffer[256];
|
||||
uint8_t debug_cmd_received;
|
||||
@@ -22,11 +25,23 @@ extern UART_HandleTypeDef huart2;
|
||||
#if defined(__GNUC__)
|
||||
int _write(int fd, char * ptr, int len)
|
||||
{
|
||||
HAL_GPIO_WritePin(USART2_DIR_GPIO_Port, USART2_DIR_Pin, 1);
|
||||
HAL_UART_Transmit(&huart2, (uint8_t *) ptr, len, HAL_MAX_DELAY);
|
||||
HAL_GPIO_WritePin(USART2_DIR_GPIO_Port, USART2_DIR_Pin, 0);
|
||||
return len;
|
||||
}
|
||||
#endif
|
||||
|
||||
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size){
|
||||
|
||||
// if(huart->Instance == USART1){
|
||||
// mm_rx_interrupt(huart, Size);
|
||||
// }
|
||||
if(huart->Instance == USART2){
|
||||
debug_rx_interrupt(huart, Size);
|
||||
}
|
||||
}
|
||||
|
||||
void debug_rx_interrupt(UART_HandleTypeDef *huart, uint16_t Size){
|
||||
debug_rx_buffer[Size] = '\0';
|
||||
debug_rx_buffer_size = Size;
|
||||
@@ -53,7 +68,7 @@ void parse_command(uint8_t* buffer, size_t length) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer[0] == 0) return;
|
||||
if (strncmp((const char*)buffer, "reset", length) == 0) {
|
||||
printf("Resetting...\n");
|
||||
NVIC_SystemReset();
|
||||
@@ -75,7 +90,7 @@ void parse_command(uint8_t* buffer, size_t length) {
|
||||
// mm_schedule_read(0x02, 0x0001);
|
||||
|
||||
} else if (strncmp((const char*)buffer, "adc", length) == 0) {
|
||||
printf("CC1=%.2f\n", GBT_CC_GetAdc());
|
||||
printf("CC1=%.2f\n", CONN_CC_GetAdc());
|
||||
|
||||
} else if (strncmp((const char*)buffer, "lock_state", length) == 0) {
|
||||
printf("Lock state=%d\n", GBT_LockGetState());
|
||||
@@ -88,26 +103,29 @@ void parse_command(uint8_t* buffer, size_t length) {
|
||||
printf("Unlocked\n");
|
||||
GBT_Lock(0);
|
||||
|
||||
} else if (strncmp((const char*)buffer, "complete", length) == 0) {
|
||||
CONN_SetState(CONN_Occupied_complete);
|
||||
|
||||
} else if (strncmp((const char*)buffer, "start", length) == 0) {
|
||||
printf("Started\n");
|
||||
GBT_Start();
|
||||
|
||||
} else if (strncmp((const char*)buffer, "stop", length) == 0) {
|
||||
printf("Stopped\n");
|
||||
GBT_Stop();
|
||||
GBT_Stop(GBT_CST_SUSPENDS_ARTIFICIALLY);
|
||||
|
||||
} else if (strncmp((const char*)buffer, "stop1", length) == 0) {
|
||||
printf("Stopped\n");
|
||||
GBT_Stop1();
|
||||
GBT_ForceStop();
|
||||
|
||||
} else if (strncmp((const char*)buffer, "force", length) == 0) {
|
||||
printf("Stopped\n");
|
||||
GBT_Lock(1);
|
||||
GBT_SwitchState(GBT_S2_LOCKED);
|
||||
GBT_Delay(500);
|
||||
// } else if (strncmp((const char*)buffer, "force", length) == 0) {
|
||||
// printf("Stopped\n");
|
||||
// GBT_Lock(1);
|
||||
// GBT_SwitchState(GBT_S2_LOCKED);
|
||||
// GBT_Delay(500);
|
||||
|
||||
} else if (strncmp((const char*)buffer, "cc_state", length) == 0) {
|
||||
switch(GBT_CC_GetState()){
|
||||
switch(CONN_CC_GetState()){
|
||||
case GBT_CC_UNKNOWN:
|
||||
printf("GBT_CC_UNKNOWN\n");
|
||||
break;
|
||||
@@ -149,6 +167,18 @@ void parse_command(uint8_t* buffer, size_t length) {
|
||||
printf("EVIN: %.17s\n", GBT_EVInfo.EVIN); //EVIN
|
||||
printf("EV_SW_VER: %.8s\n", GBT_EVInfo.EV_SW_VER);
|
||||
|
||||
} else if (strncmp((const char*)buffer, "info3", length) == 0) {
|
||||
printf("GBT_MaxLoad info:\n");
|
||||
printf("Output max current: %d\n",GBT_MaxLoad.maxOutputCurrent);
|
||||
printf("Output min current: %d\n",GBT_MaxLoad.minOutputCurrent);
|
||||
printf("Output max voltage: %d\n",GBT_MaxLoad.maxOutputVoltage);
|
||||
printf("Output min voltage: %d\n",GBT_MaxLoad.minOutputVoltage);
|
||||
printf("\nGBT_ChargerInfo info:\n");
|
||||
printf("BMS Recognized: %d\n",GBT_ChargerInfo.bmsIdentified);
|
||||
printf("Charger location: %.3s\n",GBT_ChargerInfo.chargerLocation);
|
||||
printf("Charger number: %lu\n",GBT_ChargerInfo.chargerNumber);
|
||||
|
||||
|
||||
} else if (strncmp((const char*)buffer, "help", length) == 0) {
|
||||
printf("Command list:\n");
|
||||
printf("reset\n");
|
||||
@@ -162,11 +192,32 @@ void parse_command(uint8_t* buffer, size_t length) {
|
||||
printf("start\n");
|
||||
printf("stop\n");
|
||||
printf("stop1\n");
|
||||
printf("force\n");
|
||||
// printf("force\n");
|
||||
printf("info1\n");
|
||||
printf("info2\n");
|
||||
printf("info3\n");
|
||||
printf("time\n");
|
||||
printf("cantest\n");
|
||||
|
||||
//TODO: info commands
|
||||
|
||||
} else if (strncmp((const char*)buffer, "time", length) == 0) {
|
||||
|
||||
time_t unix_time = (time_t)get_Current_Time();
|
||||
struct tm *parts = localtime(&unix_time);
|
||||
|
||||
printf("Year: %d\n", parts->tm_year + 1900);
|
||||
printf("Month: %d\n", parts->tm_mon + 1);
|
||||
printf("Day: %d\n", parts->tm_mday);
|
||||
printf("Hour: %d\n", parts->tm_hour);
|
||||
printf("Minute: %d\n", parts->tm_min);
|
||||
printf("Second: %d\n", parts->tm_sec);
|
||||
|
||||
} else if (strncmp((const char*)buffer, "cantest", length) == 0) {
|
||||
//GBT_SendCHM();
|
||||
GBT_Error(0xFDF0C0FC); //BRM Timeout
|
||||
printf("can test\n");
|
||||
|
||||
} else {
|
||||
printf("Unknown command\n");
|
||||
}
|
||||
|
||||
@@ -28,31 +28,17 @@
|
||||
|
||||
|
||||
/* Charger info registers */
|
||||
#define EDCAN_REG_CHARGER_NUMBER_0 0x200
|
||||
#define EDCAN_REG_CHARGER_NUMBER_1 0x201
|
||||
#define EDCAN_REG_CHARGER_NUMBER_2 0x202
|
||||
#define EDCAN_REG_CHARGER_NUMBER_3 0x203
|
||||
|
||||
#define EDCAN_REG_CHARGER_LOCATION_0 0x204
|
||||
#define EDCAN_REG_CHARGER_LOCATION_1 0x205
|
||||
#define EDCAN_REG_CHARGER_LOCATION_2 0x206
|
||||
|
||||
#define EDCAN_REG_CHARGER_INFO 0x200
|
||||
//UNIX TIME
|
||||
#define EDCAN_REG_TIME_0 0x210
|
||||
#define EDCAN_REG_TIME_1 0x211
|
||||
#define EDCAN_REG_TIME_2 0x212
|
||||
#define EDCAN_REG_TIME_3 0x213
|
||||
//#define EDCAN_REG_SECONDS 0x210
|
||||
//#define EDCAN_REG_MINUTES 0x211
|
||||
//#define EDCAN_REG_HOURS 0x212
|
||||
//#define EDCAN_REG_DAYS 0x213
|
||||
//#define EDCAN_REG_MONTH 0x214
|
||||
//#define EDCAN_REG_YEARS 0x215
|
||||
//#define EDCAN_REG_CENTURIES 0x216
|
||||
//#define EDCAN_REG_TIME_SYNC 0x217
|
||||
|
||||
#define EDCAN_REG_MAX_LOAD 0x220
|
||||
|
||||
|
||||
|
||||
#define EDCAN_REG_BRM 0x310
|
||||
|
||||
#define EDCAN_REG_BCP 0x350
|
||||
@@ -77,10 +63,6 @@ GBT_EDCAN_Input_t GBT_EDCAN_Input;
|
||||
|
||||
|
||||
|
||||
|
||||
//extern uint8_t relay_value[8];
|
||||
|
||||
|
||||
/**
|
||||
* @brief Handler for incoming Read packet
|
||||
* Another device reply value of its registers
|
||||
@@ -142,14 +124,10 @@ void EDCAN_WriteUserRegister(uint16_t addr, uint8_t value){
|
||||
// printf ("K0 = %d\n", value);
|
||||
// HAL_GPIO_WritePin (K0_GPIO_Port, K0_Pin, (value == 0));
|
||||
// break;
|
||||
case EDCAN_REG_CHARGER_ENABLE:
|
||||
if(value){
|
||||
GBT_Start();//TODO IF protections
|
||||
}else{
|
||||
GBT_Stop();
|
||||
}
|
||||
|
||||
break;
|
||||
// case EDCAN_REG_CHARGER_ENABLE:
|
||||
// if(value)GBT_Charger_Enable = 1;
|
||||
// else GBT_Charger_Enable = 0;
|
||||
// break;
|
||||
|
||||
case EDCAN_REG_TIME_0:
|
||||
writeTimeReg(0, value);
|
||||
@@ -171,6 +149,11 @@ void EDCAN_WriteUserRegister(uint16_t addr, uint8_t value){
|
||||
((uint8_t*)&GBT_MaxLoad)[addr - EDCAN_REG_MAX_LOAD] = value;
|
||||
break;
|
||||
|
||||
//0x200
|
||||
case EDCAN_REG_CHARGER_INFO ... (EDCAN_REG_CHARGER_INFO+sizeof(GBT_CRM_t)):
|
||||
((uint8_t*)&GBT_ChargerInfo)[addr - EDCAN_REG_CHARGER_INFO] = value;
|
||||
break;
|
||||
|
||||
//0x580
|
||||
case EDCAN_REG_INPUT ... (EDCAN_REG_INPUT+sizeof(GBT_EDCAN_Input_t)):
|
||||
((uint8_t*)&GBT_EDCAN_Input)[addr - EDCAN_REG_INPUT] = value;
|
||||
@@ -193,7 +176,7 @@ uint8_t EDCAN_GetUserRegisterValue(uint16_t addr){
|
||||
|
||||
// /* регистры 256..2047 используются пользовательских нужд */
|
||||
|
||||
|
||||
// 0x400
|
||||
case EDCAN_REG_TIME_0:
|
||||
return getTimeReg(0);
|
||||
break;
|
||||
|
||||
@@ -26,7 +26,6 @@ void GBT_SendCTS(){
|
||||
J_SendPacket(0x000700, 6, 7, data);
|
||||
}
|
||||
|
||||
//TODO
|
||||
//GB/T Max Load Packet
|
||||
void GBT_SendCML(){
|
||||
// uint8_t data[8];
|
||||
@@ -52,7 +51,6 @@ void GBT_SendCHM(){
|
||||
J_SendPacket(0x2600, 6, 3, data);
|
||||
}
|
||||
|
||||
//TODO
|
||||
//GB/T CRM Packet (state=BMS identified)
|
||||
void GBT_SendCRM(uint8_t state){
|
||||
// uint8_t data[8];
|
||||
@@ -75,8 +73,6 @@ void GBT_SendCRO(uint8_t state){
|
||||
J_SendPacket(0xA00, 4, 1, data);
|
||||
}
|
||||
|
||||
|
||||
//TODO: Send measured voltage current
|
||||
//GB/T CCS packet (Charger current status)
|
||||
void GBT_SendCCS(){
|
||||
// uint8_t data[8];
|
||||
@@ -94,16 +90,31 @@ void GBT_SendCCS(){
|
||||
J_SendPacket(0x1200, 6, 8, (uint8_t *)&GBT_ChargerCurrentStatus);
|
||||
}
|
||||
|
||||
//TODO: stop cause
|
||||
// GB/T Charging Stop packet
|
||||
void GBT_SendCST(){
|
||||
void GBT_SendCST(uint32_t Cause){
|
||||
uint8_t data[8];
|
||||
data[0] = 0x04; // Artificially stop charging
|
||||
data[1] = 0x00; //TODO: Cause stop
|
||||
data[2] = 0xF0; //
|
||||
data[3] = 0xF0; //
|
||||
data[0] = (Cause>>24) & 0xFF; // Error
|
||||
data[1] = (Cause>>16) & 0xFF; //
|
||||
data[2] = (Cause>>8) & 0xFF; //
|
||||
data[3] = Cause & 0xFF; //
|
||||
|
||||
J_SendPacket(0x1A00, 4, 4, data);
|
||||
}
|
||||
|
||||
//TODO CSD priority 6
|
||||
void GBT_SendCSD(){
|
||||
GBT_ChargerStop.chargerNumber = GBT_ChargerInfo.chargerNumber;
|
||||
GBT_ChargerStop.outputEnergy = 0; //TODO Energy meters
|
||||
GBT_ChargerStop.chargingTime = GBT_ChargerCurrentStatus.chargingTime;
|
||||
J_SendPacket(0x1D00, 6, 7, (uint8_t *)&GBT_ChargerStop);
|
||||
|
||||
}
|
||||
|
||||
void GBT_SendCEM(uint32_t ErrorCode){
|
||||
uint8_t data[8];
|
||||
data[0] = (ErrorCode>>24) & 0xFF; // Error
|
||||
data[1] = (ErrorCode>>16) & 0xFF; //
|
||||
data[2] = (ErrorCode>>8) & 0xFF; //
|
||||
data[3] = ErrorCode & 0xFF; //
|
||||
|
||||
J_SendPacket(0x1F00, 4, 4, data);
|
||||
}
|
||||
|
||||
@@ -77,11 +77,14 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
|
||||
break;
|
||||
|
||||
case 0x1E00: //PGN BEM (ERROR)
|
||||
GBT_Stop();
|
||||
//Error force stop
|
||||
GBT_ForceStop();
|
||||
break;
|
||||
|
||||
case 0x1900: //PGN BST (STOP)
|
||||
GBT_Stop();
|
||||
//Normal stop
|
||||
GBT_Stop(GBT_CST_BMS_ACTIVELY_SUSPENDS);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -106,6 +109,7 @@ void GBT_CAN_ReInit(){
|
||||
MX_CAN1_Init();
|
||||
HAL_CAN_Start(&hcan1);
|
||||
HAL_CAN_ActivateNotification(&hcan1, CAN_IT_RX_FIFO0_MSG_PENDING);
|
||||
GBT_CAN_FilterInit();
|
||||
}
|
||||
|
||||
void J_SendPacket(uint32_t PGN, uint8_t pri, uint8_t DLC, uint8_t *data){
|
||||
@@ -161,3 +165,22 @@ void J_SendACK(j_receive_t rx){//uint32_t PGN, uint8_t step, uint8_t packet){
|
||||
J_SendPacket(0x00EC00, 7, 8, data);
|
||||
}
|
||||
|
||||
void GBT_CAN_FilterInit(){
|
||||
CAN_FilterTypeDef sFilterConfig;
|
||||
|
||||
sFilterConfig.FilterBank = 0;
|
||||
sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;
|
||||
sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;
|
||||
sFilterConfig.FilterIdHigh = 0x0000;
|
||||
sFilterConfig.FilterIdLow = 0x0000;
|
||||
sFilterConfig.FilterMaskIdHigh = 0x0000;
|
||||
sFilterConfig.FilterMaskIdLow = 0x0000;
|
||||
sFilterConfig.FilterFIFOAssignment = CAN_RX_FIFO0;
|
||||
sFilterConfig.FilterActivation = ENABLE;
|
||||
//sFilterConfig.SlaveStartFilterBank = 14;
|
||||
if(HAL_CAN_ConfigFilter(&hcan1, &sFilterConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
88
Core/Src/lock.c
Normal file
88
Core/Src/lock.c
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* lock.c
|
||||
*
|
||||
* Created on: Jul 31, 2024
|
||||
* Author: colorbass
|
||||
*/
|
||||
#include "lock.h"
|
||||
|
||||
uint8_t LOCK_POLARITY = 1;
|
||||
uint8_t LOCK_MOTOR_POLARITY = 1;
|
||||
uint8_t LOCK_DELAY = 50;
|
||||
|
||||
GBT_LockState_t GBT_LockState;
|
||||
|
||||
|
||||
void GBT_ForceLock(uint8_t state){
|
||||
if(LOCK_MOTOR_POLARITY){
|
||||
if(state){//LOCK
|
||||
HAL_GPIO_WritePin(LOCK_B_GPIO_Port, LOCK_B_Pin, 1);
|
||||
HAL_Delay(LOCK_DELAY);
|
||||
HAL_GPIO_WritePin(LOCK_B_GPIO_Port, LOCK_B_Pin, 0);
|
||||
}else{ //UNLOCK
|
||||
HAL_GPIO_WritePin(LOCK_A_GPIO_Port, LOCK_A_Pin, 1);
|
||||
HAL_Delay(LOCK_DELAY);
|
||||
HAL_GPIO_WritePin(LOCK_A_GPIO_Port, LOCK_A_Pin, 0);
|
||||
}
|
||||
}else{
|
||||
if(state){//LOCK
|
||||
HAL_GPIO_WritePin(LOCK_A_GPIO_Port, LOCK_A_Pin, 1);
|
||||
HAL_Delay(LOCK_DELAY);
|
||||
HAL_GPIO_WritePin(LOCK_A_GPIO_Port, LOCK_A_Pin, 0);
|
||||
}else{ //UNLOCK
|
||||
HAL_GPIO_WritePin(LOCK_B_GPIO_Port, LOCK_B_Pin, 1);
|
||||
HAL_Delay(LOCK_DELAY);
|
||||
HAL_GPIO_WritePin(LOCK_B_GPIO_Port, LOCK_B_Pin, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t GBT_LockGetState(){
|
||||
//1 = locked
|
||||
//0 = unlocked
|
||||
if(LOCK_POLARITY){
|
||||
return HAL_GPIO_ReadPin(LOCK_FB_GPIO_Port, LOCK_FB_Pin);
|
||||
}else{
|
||||
return !HAL_GPIO_ReadPin(LOCK_FB_GPIO_Port, LOCK_FB_Pin);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void GBT_Lock(uint8_t state){
|
||||
GBT_LockState.demand = state;
|
||||
}
|
||||
|
||||
void GBT_ManageLock(){
|
||||
uint8_t MAX_RETRIES = 5;
|
||||
if (GBT_LockState.error) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool lock_is_open = GBT_LockGetState() == 0;
|
||||
bool lock_should_be_open = GBT_LockState.demand == 0;
|
||||
uint8_t retry_count = 0;
|
||||
|
||||
if (lock_is_open != lock_should_be_open) {
|
||||
while (retry_count < MAX_RETRIES) {
|
||||
if (lock_should_be_open) {
|
||||
GBT_ForceLock(0);
|
||||
} else {
|
||||
GBT_ForceLock(1);
|
||||
}
|
||||
|
||||
lock_is_open = GBT_LockGetState() == 0;
|
||||
|
||||
if (lock_is_open == lock_should_be_open) {
|
||||
break;
|
||||
}
|
||||
|
||||
retry_count++;
|
||||
}
|
||||
|
||||
if (retry_count >= MAX_RETRIES) {
|
||||
GBT_LockState.error = 1;
|
||||
GBT_ForceLock(0);
|
||||
printf ("Lock error\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "main.h"
|
||||
#include "adc.h"
|
||||
#include "can.h"
|
||||
#include "rtc.h"
|
||||
#include "usart.h"
|
||||
#include "gpio.h"
|
||||
|
||||
@@ -32,6 +33,9 @@
|
||||
#include "charger_gbt.h"
|
||||
#include "soft_rtc.h"
|
||||
#include "j1939.h"
|
||||
#include "lock.h"
|
||||
#include "connector.h"
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
@@ -100,6 +104,7 @@ int main(void)
|
||||
MX_CAN1_Init();
|
||||
MX_CAN2_Init();
|
||||
MX_USART2_UART_Init();
|
||||
MX_RTC_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
CAN_ReInit();
|
||||
Init_Peripheral();
|
||||
@@ -109,10 +114,12 @@ int main(void)
|
||||
set_Time(1721651966); //2024-07-22T12:39:26+00:00
|
||||
printf("Startup (type \'help\' for command list)\n");
|
||||
debug_init();
|
||||
//EDCAN_Init(SW_GetAddr()); //0x20..0x23
|
||||
EDCAN_Init(0x20); //Адрес EDCAN
|
||||
CAN_ReInit();
|
||||
EDCAN_Init(SW_GetAddr()); //0x20..0x23
|
||||
//EDCAN_Init(0x20); //Адрес EDCAN
|
||||
GBT_CAN_ReInit();
|
||||
CAN_ReInit();
|
||||
|
||||
CONN_Init();
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Infinite loop */
|
||||
@@ -126,6 +133,9 @@ int main(void)
|
||||
EDCAN_Loop();
|
||||
//can_task();
|
||||
debug_task();
|
||||
CONN_CC_ReadStateFiltered();
|
||||
GBT_ManageLock();
|
||||
CONN_Task();
|
||||
GBT_ChargerTask();
|
||||
|
||||
}
|
||||
@@ -145,9 +155,10 @@ void SystemClock_Config(void)
|
||||
/** Initializes the RCC Oscillators according to the specified parameters
|
||||
* in the RCC_OscInitTypeDef structure.
|
||||
*/
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV5;
|
||||
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
RCC_OscInitStruct.Prediv1Source = RCC_PREDIV1_SOURCE_PLL2;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
@@ -174,7 +185,8 @@ void SystemClock_Config(void)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC;
|
||||
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_RTC|RCC_PERIPHCLK_ADC;
|
||||
PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
|
||||
PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6;
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
|
||||
{
|
||||
|
||||
93
Core/Src/rtc.c
Normal file
93
Core/Src/rtc.c
Normal file
@@ -0,0 +1,93 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file rtc.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of the RTC instances.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 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 */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "rtc.h"
|
||||
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
RTC_HandleTypeDef hrtc;
|
||||
|
||||
/* RTC init function */
|
||||
void MX_RTC_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN RTC_Init 0 */
|
||||
|
||||
/* USER CODE END RTC_Init 0 */
|
||||
|
||||
/* USER CODE BEGIN RTC_Init 1 */
|
||||
|
||||
/* USER CODE END RTC_Init 1 */
|
||||
|
||||
/** Initialize RTC Only
|
||||
*/
|
||||
hrtc.Instance = RTC;
|
||||
hrtc.Init.AsynchPrediv = RTC_AUTO_1_SECOND;
|
||||
hrtc.Init.OutPut = RTC_OUTPUTSOURCE_ALARM;
|
||||
if (HAL_RTC_Init(&hrtc) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN RTC_Init 2 */
|
||||
|
||||
/* USER CODE END RTC_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
void HAL_RTC_MspInit(RTC_HandleTypeDef* rtcHandle)
|
||||
{
|
||||
|
||||
if(rtcHandle->Instance==RTC)
|
||||
{
|
||||
/* USER CODE BEGIN RTC_MspInit 0 */
|
||||
|
||||
/* USER CODE END RTC_MspInit 0 */
|
||||
HAL_PWR_EnableBkUpAccess();
|
||||
/* Enable BKP CLK enable for backup registers */
|
||||
__HAL_RCC_BKP_CLK_ENABLE();
|
||||
/* RTC clock enable */
|
||||
__HAL_RCC_RTC_ENABLE();
|
||||
/* USER CODE BEGIN RTC_MspInit 1 */
|
||||
|
||||
/* USER CODE END RTC_MspInit 1 */
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_RTC_MspDeInit(RTC_HandleTypeDef* rtcHandle)
|
||||
{
|
||||
|
||||
if(rtcHandle->Instance==RTC)
|
||||
{
|
||||
/* USER CODE BEGIN RTC_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END RTC_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_RTC_DISABLE();
|
||||
/* USER CODE BEGIN RTC_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END RTC_MspDeInit 1 */
|
||||
}
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
@@ -9,17 +9,22 @@
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
uint32_t GBT_time_offset; //current time = offset+HAL_GetTick()/1000;
|
||||
uint8_t tmp_time[4];
|
||||
uint8_t tmp_time32;
|
||||
uint32_t tmp_time32;
|
||||
|
||||
extern RTC_HandleTypeDef hrtc;
|
||||
static HAL_StatusTypeDef RTC1_WriteTimeCounter(RTC_HandleTypeDef *hrtc, uint32_t TimeCounter);
|
||||
static uint32_t RTC1_ReadTimeCounter(RTC_HandleTypeDef *hrtc);
|
||||
static HAL_StatusTypeDef RTC1_ExitInitMode(RTC_HandleTypeDef *hrtc);
|
||||
static HAL_StatusTypeDef RTC1_EnterInitMode(RTC_HandleTypeDef *hrtc);
|
||||
|
||||
|
||||
uint32_t get_Current_Time(){
|
||||
return GBT_time_offset + (HAL_GetTick()/1000);
|
||||
return RTC1_ReadTimeCounter(&hrtc);
|
||||
}
|
||||
|
||||
void set_Time(uint32_t unix_time){
|
||||
if(unix_time <= (HAL_GetTick()/1000)) return; //invalid time
|
||||
GBT_time_offset = unix_time - (HAL_GetTick()/1000);
|
||||
RTC1_WriteTimeCounter(&hrtc, unix_time);
|
||||
}
|
||||
|
||||
uint8_t to_bcd(int value) {
|
||||
@@ -72,3 +77,121 @@ uint8_t getTimeReg(uint8_t reg_number){
|
||||
//
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
/**
|
||||
* @brief Read the time counter available in RTC_CNT registers.
|
||||
* @param hrtc pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval Time counter
|
||||
*/
|
||||
static uint32_t RTC1_ReadTimeCounter(RTC_HandleTypeDef *hrtc)
|
||||
{
|
||||
uint16_t high1 = 0U, high2 = 0U, low = 0U;
|
||||
uint32_t timecounter = 0U;
|
||||
|
||||
high1 = READ_REG(hrtc->Instance->CNTH & RTC_CNTH_RTC_CNT);
|
||||
low = READ_REG(hrtc->Instance->CNTL & RTC_CNTL_RTC_CNT);
|
||||
high2 = READ_REG(hrtc->Instance->CNTH & RTC_CNTH_RTC_CNT);
|
||||
|
||||
if (high1 != high2)
|
||||
{
|
||||
/* In this case the counter roll over during reading of CNTL and CNTH registers,
|
||||
read again CNTL register then return the counter value */
|
||||
timecounter = (((uint32_t) high2 << 16U) | READ_REG(hrtc->Instance->CNTL & RTC_CNTL_RTC_CNT));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No counter roll over during reading of CNTL and CNTH registers, counter
|
||||
value is equal to first value of CNTL and CNTH */
|
||||
timecounter = (((uint32_t) high1 << 16U) | low);
|
||||
}
|
||||
|
||||
return timecounter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write the time counter in RTC_CNT registers.
|
||||
* @param hrtc pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param TimeCounter: Counter to write in RTC_CNT registers
|
||||
* @retval HAL status
|
||||
*/
|
||||
static HAL_StatusTypeDef RTC1_WriteTimeCounter(RTC_HandleTypeDef *hrtc, uint32_t TimeCounter)
|
||||
{
|
||||
HAL_StatusTypeDef status = HAL_OK;
|
||||
|
||||
/* Set Initialization mode */
|
||||
if (RTC1_EnterInitMode(hrtc) != HAL_OK)
|
||||
{
|
||||
status = HAL_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set RTC COUNTER MSB word */
|
||||
WRITE_REG(hrtc->Instance->CNTH, (TimeCounter >> 16U));
|
||||
/* Set RTC COUNTER LSB word */
|
||||
WRITE_REG(hrtc->Instance->CNTL, (TimeCounter & RTC_CNTL_RTC_CNT));
|
||||
|
||||
/* Wait for synchro */
|
||||
if (RTC1_ExitInitMode(hrtc) != HAL_OK)
|
||||
{
|
||||
status = HAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enters the RTC Initialization mode.
|
||||
* @param hrtc pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval HAL status
|
||||
*/
|
||||
static HAL_StatusTypeDef RTC1_EnterInitMode(RTC_HandleTypeDef *hrtc)
|
||||
{
|
||||
uint32_t tickstart = 0U;
|
||||
|
||||
tickstart = HAL_GetTick();
|
||||
/* Wait till RTC is in INIT state and if Time out is reached exit */
|
||||
while ((hrtc->Instance->CRL & RTC_CRL_RTOFF) == (uint32_t)RESET)
|
||||
{
|
||||
if ((HAL_GetTick() - tickstart) > RTC_TIMEOUT_VALUE)
|
||||
{
|
||||
return HAL_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
/* Disable the write protection for RTC registers */
|
||||
__HAL_RTC_WRITEPROTECTION_DISABLE(hrtc);
|
||||
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Exit the RTC Initialization mode.
|
||||
* @param hrtc pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval HAL status
|
||||
*/
|
||||
static HAL_StatusTypeDef RTC1_ExitInitMode(RTC_HandleTypeDef *hrtc)
|
||||
{
|
||||
uint32_t tickstart = 0U;
|
||||
|
||||
/* Disable the write protection for RTC registers */
|
||||
__HAL_RTC_WRITEPROTECTION_ENABLE(hrtc);
|
||||
|
||||
tickstart = HAL_GetTick();
|
||||
/* Wait till RTC is in INIT state and if Time out is reached exit */
|
||||
while ((hrtc->Instance->CRL & RTC_CRL_RTOFF) == (uint32_t)RESET)
|
||||
{
|
||||
if ((HAL_GetTick() - tickstart) > RTC_TIMEOUT_VALUE)
|
||||
{
|
||||
return HAL_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
board.c:18:6:GBT_Lock 2
|
||||
board.c:29:9:GBT_LockGetState 1
|
||||
board.c:35:6:RELAY_Write 3
|
||||
board.c:41:9:GetBoardTemp 1
|
||||
board.c:53:6:Init_Peripheral 1
|
||||
board.c:60:9:GBT_ReadTemp 1
|
||||
board.c:65:6:ADC_Select_Channel 2
|
||||
board.c:76:9:SW_GetAddr 4
|
||||
board.c:16:6:RELAY_Write 3
|
||||
board.c:22:9:GetBoardTemp 1
|
||||
board.c:34:6:Init_Peripheral 1
|
||||
board.c:41:9:GBT_ReadTemp 1
|
||||
board.c:46:6:ADC_Select_Channel 2
|
||||
board.c:57:9:SW_GetAddr 4
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
charger_gbt.c:44:6:GBT_Init 1
|
||||
charger_gbt.c:49:9:GBT_CC_GetState 9
|
||||
charger_gbt.c:72:7:GBT_CC_GetAdc 1
|
||||
charger_gbt.c:92:6:GBT_ChargerTask 52
|
||||
charger_gbt.c:319:6:GBT_SwitchState 14
|
||||
charger_gbt.c:340:10:GBT_StateTick 1
|
||||
charger_gbt.c:344:6:GBT_Delay 1
|
||||
charger_gbt.c:348:6:GBT_Stop 2
|
||||
charger_gbt.c:352:6:GBT_Stop1 1
|
||||
charger_gbt.c:358:6:GBT_Start 1
|
||||
charger_gbt.c:61:6:GBT_Init 1
|
||||
charger_gbt.c:70:6:GBT_ChargerTask 69
|
||||
charger_gbt.c:357:6:GBT_SwitchState 14
|
||||
charger_gbt.c:381:10:GBT_StateTick 1
|
||||
charger_gbt.c:385:6:GBT_Delay 1
|
||||
charger_gbt.c:389:6:GBT_Stop 2
|
||||
charger_gbt.c:394:6:GBT_Error 1
|
||||
charger_gbt.c:399:6:GBT_ForceStop 1
|
||||
charger_gbt.c:406:6:GBT_Reset 1
|
||||
charger_gbt.c:427:6:GBT_Start 1
|
||||
|
||||
7
Debug/Core/Src/connector.cyclo
Normal file
7
Debug/Core/Src/connector.cyclo
Normal file
@@ -0,0 +1,7 @@
|
||||
connector.c:18:6:CONN_Init 1
|
||||
connector.c:22:6:CONN_Task 15
|
||||
connector.c:91:6:CONN_SetState 7
|
||||
connector.c:102:6:CONN_CC_ReadStateFiltered 4
|
||||
connector.c:158:9:CONN_CC_GetState 1
|
||||
connector.c:161:9:CONN_CC_GetStateRaw 9
|
||||
connector.c:188:7:CONN_CC_GetAdc 1
|
||||
@@ -1,6 +1,7 @@
|
||||
core_cm3.h:1762:34:__NVIC_SystemReset 1
|
||||
debug.c:23:5:_write 1
|
||||
debug.c:30:6:debug_rx_interrupt 1
|
||||
debug.c:36:6:debug_init 1
|
||||
debug.c:46:6:parse_command 23
|
||||
debug.c:175:6:debug_task 2
|
||||
debug.c:26:5:_write 1
|
||||
debug.c:35:6:HAL_UARTEx_RxEventCallback 2
|
||||
debug.c:45:6:debug_rx_interrupt 1
|
||||
debug.c:51:6:debug_init 1
|
||||
debug.c:61:6:parse_command 27
|
||||
debug.c:226:6:debug_task 2
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
edcan_handler_user.c:94:6:EDCAN_ReadHandler 2
|
||||
edcan_handler_user.c:138:6:EDCAN_WriteUserRegister 13
|
||||
edcan_handler_user.c:191:9:EDCAN_GetUserRegisterValue 20
|
||||
edcan_handler_user.c:76:6:EDCAN_ReadHandler 2
|
||||
edcan_handler_user.c:120:6:EDCAN_WriteUserRegister 10
|
||||
edcan_handler_user.c:174:9:EDCAN_GetUserRegisterValue 20
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
gbt_packet.c:14:6:GBT_SendCTS 1
|
||||
gbt_packet.c:31:6:GBT_SendCML 1
|
||||
gbt_packet.c:47:6:GBT_SendCHM 1
|
||||
gbt_packet.c:57:6:GBT_SendCRM 1
|
||||
gbt_packet.c:72:6:GBT_SendCRO 1
|
||||
gbt_packet.c:81:6:GBT_SendCCS 1
|
||||
gbt_packet.c:99:6:GBT_SendCST 1
|
||||
gbt_packet.c:30:6:GBT_SendCML 1
|
||||
gbt_packet.c:46:6:GBT_SendCHM 1
|
||||
gbt_packet.c:55:6:GBT_SendCRM 1
|
||||
gbt_packet.c:70:6:GBT_SendCRO 1
|
||||
gbt_packet.c:77:6:GBT_SendCCS 1
|
||||
gbt_packet.c:94:6:GBT_SendCST 1
|
||||
gbt_packet.c:104:6:GBT_SendCSD 1
|
||||
gbt_packet.c:112:6:GBT_SendCEM 1
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
j1939.c:19:6:HAL_CAN_RxFifo0MsgPendingCallback 20
|
||||
j1939.c:104:6:GBT_CAN_ReInit 1
|
||||
j1939.c:111:6:J_SendPacket 1
|
||||
j1939.c:131:6:J_SendCTS 2
|
||||
j1939.c:149:6:J_SendACK 1
|
||||
j1939.c:107:6:GBT_CAN_ReInit 1
|
||||
j1939.c:115:6:J_SendPacket 1
|
||||
j1939.c:135:6:J_SendCTS 2
|
||||
j1939.c:153:6:J_SendACK 1
|
||||
j1939.c:168:6:GBT_CAN_FilterInit 2
|
||||
|
||||
4
Debug/Core/Src/lock.cyclo
Normal file
4
Debug/Core/Src/lock.cyclo
Normal file
@@ -0,0 +1,4 @@
|
||||
lock.c:16:6:GBT_ForceLock 4
|
||||
lock.c:40:9:GBT_LockGetState 2
|
||||
lock.c:51:6:GBT_Lock 1
|
||||
lock.c:55:6:GBT_ManageLock 7
|
||||
@@ -1,33 +1,37 @@
|
||||
edcan.c:61:6:HAL_CAN_RxFifo1MsgPendingCallback 5
|
||||
edcan.c:79:6:HAL_CAN_TxMailbox0CompleteCallback 2
|
||||
edcan.c:85:6:HAL_CAN_TxMailbox1CompleteCallback 2
|
||||
edcan.c:91:6:HAL_CAN_TxMailbox2CompleteCallback 2
|
||||
edcan.c:102:6:EDCAN_Init 1
|
||||
edcan.c:111:6:CAN_ReInit 1
|
||||
edcan.c:142:6:EDCAN_FilterInit 3
|
||||
edcan.c:211:6:EDCAN_SendPacketWrite 1
|
||||
edcan.c:320:6:EDCAN_SendPacketRead 1
|
||||
edcan.c:358:6:EDCAN_SendPacketReadRequest 1
|
||||
edcan.c:392:6:EDCAN_Loop 7
|
||||
edcan.c:424:6:EDCAN_EnterSilentMode 2
|
||||
edcan.c:437:6:EDCAN_SetSilentMode 2
|
||||
edcan_buffer.c:38:6:EDCAN_ExchangeTxBuffer 6
|
||||
edcan_buffer.c:78:6:EDCAN_TxBufferAdd 2
|
||||
edcan_buffer.c:90:6:EDCAN_TxBufferGet 2
|
||||
edcan_buffer.c:103:10:EDCAN_getTxBufferElementCount 1
|
||||
edcan_buffer.c:108:6:EDCAN_TxBufferPeekFirst 2
|
||||
edcan_buffer.c:119:6:EDCAN_TxBufferRemoveFirst 2
|
||||
edcan_buffer.c:132:6:EDCAN_RxBufferAdd 2
|
||||
edcan_buffer.c:144:6:EDCAN_RxBufferGet 2
|
||||
edcan_buffer.c:157:10:EDCAN_getRxBufferElementCount 1
|
||||
edcan_buffer.c:162:6:EDCAN_RxBufferPeekFirst 2
|
||||
edcan_buffer.c:173:6:EDCAN_RxBufferRemoveFirst 2
|
||||
edcan_buffer.c:185:6:EDCAN_ExchangeRxBuffer 6
|
||||
edcan_handler.c:41:6:EDCAN_WriteHandler 3
|
||||
edcan_handler.c:61:6:EDCAN_WriteSystemRegister 2
|
||||
edcan_handler.c:79:9:EDCAN_GetSystemRegisterValue 8
|
||||
edcan_handler.c:120:9:EDCAN_GetOwnRegisterValue 2
|
||||
edcan_handler.c:139:6:EDCAN_ReadRequestHandler 5
|
||||
main.c:75:5:main 1
|
||||
main.c:139:6:SystemClock_Config 4
|
||||
main.c:197:6:Error_Handler 1
|
||||
core_cm3.h:1762:34:__NVIC_SystemReset 1
|
||||
edcan.c:96:6:HAL_CAN_RxFifo1MsgPendingCallback 7
|
||||
edcan.c:117:6:HAL_CAN_TxMailbox0CompleteCallback 2
|
||||
edcan.c:124:6:HAL_CAN_TxMailbox1CompleteCallback 2
|
||||
edcan.c:131:6:HAL_CAN_TxMailbox2CompleteCallback 2
|
||||
edcan.c:143:6:EDCAN_Init 1
|
||||
edcan.c:152:6:EDCAN_SetSecondID 1
|
||||
edcan.c:162:6:CAN_ReInit 1
|
||||
edcan.c:202:6:EDCAN_FilterInit 5
|
||||
edcan.c:292:6:EDCAN_SendPacketWrite 1
|
||||
edcan.c:331:6:EDCAN_SendPacketWriteLong 2
|
||||
edcan.c:424:6:EDCAN_SendPacketRead 1
|
||||
edcan.c:462:6:EDCAN_SendPacketReadRequest 1
|
||||
edcan.c:496:6:EDCAN_Loop 8
|
||||
edcan.c:529:6:EDCAN_SendAlivePacket 1
|
||||
edcan.c:540:6:EDCAN_EnterSilentMode 2
|
||||
edcan.c:553:6:EDCAN_SetSilentMode 2
|
||||
edcan_buffer.c:40:6:EDCAN_ExchangeTxBuffer 7
|
||||
edcan_buffer.c:84:6:EDCAN_TxBufferAdd 2
|
||||
edcan_buffer.c:98:6:EDCAN_TxBufferGet 2
|
||||
edcan_buffer.c:111:10:EDCAN_getTxBufferElementCount 1
|
||||
edcan_buffer.c:116:6:EDCAN_TxBufferPeekFirst 2
|
||||
edcan_buffer.c:129:6:EDCAN_TxBufferRemoveFirst 2
|
||||
edcan_buffer.c:142:6:EDCAN_RxBufferAdd 2
|
||||
edcan_buffer.c:156:6:EDCAN_RxBufferGet 2
|
||||
edcan_buffer.c:169:10:EDCAN_getRxBufferElementCount 1
|
||||
edcan_buffer.c:174:6:EDCAN_RxBufferPeekFirst 2
|
||||
edcan_buffer.c:185:6:EDCAN_RxBufferRemoveFirst 2
|
||||
edcan_buffer.c:197:6:EDCAN_ExchangeRxBuffer 6
|
||||
edcan_handler.c:43:6:EDCAN_WriteHandler 3
|
||||
edcan_handler.c:63:6:EDCAN_WriteSystemRegister 5
|
||||
edcan_handler.c:90:9:EDCAN_GetSystemRegisterValue 8
|
||||
edcan_handler.c:132:9:EDCAN_GetOwnRegisterValue 2
|
||||
edcan_handler.c:151:6:EDCAN_ReadRequestHandler 5
|
||||
main.c:79:5:main 1
|
||||
main.c:149:6:SystemClock_Config 4
|
||||
main.c:209:6:Error_Handler 1
|
||||
|
||||
3
Debug/Core/Src/rtc.cyclo
Normal file
3
Debug/Core/Src/rtc.cyclo
Normal file
@@ -0,0 +1,3 @@
|
||||
rtc.c:30:6:MX_RTC_Init 2
|
||||
rtc.c:56:6:HAL_RTC_MspInit 2
|
||||
rtc.c:75:6:HAL_RTC_MspDeInit 2
|
||||
@@ -1,6 +1,10 @@
|
||||
soft_rtc.c:16:10:get_Current_Time 1
|
||||
soft_rtc.c:20:6:set_Time 2
|
||||
soft_rtc.c:25:9:to_bcd 1
|
||||
soft_rtc.c:29:6:unix_to_bcd 1
|
||||
soft_rtc.c:43:6:writeTimeReg 2
|
||||
soft_rtc.c:48:9:getTimeReg 5
|
||||
soft_rtc.c:22:10:get_Current_Time 1
|
||||
soft_rtc.c:26:6:set_Time 1
|
||||
soft_rtc.c:30:9:to_bcd 1
|
||||
soft_rtc.c:34:6:unix_to_bcd 1
|
||||
soft_rtc.c:48:6:writeTimeReg 2
|
||||
soft_rtc.c:53:9:getTimeReg 5
|
||||
soft_rtc.c:87:17:RTC1_ReadTimeCounter 2
|
||||
soft_rtc.c:119:26:RTC1_WriteTimeCounter 3
|
||||
soft_rtc.c:151:26:RTC1_EnterInitMode 3
|
||||
soft_rtc.c:178:26:RTC1_ExitInitMode 3
|
||||
|
||||
@@ -9,12 +9,15 @@ C_SRCS += \
|
||||
../Core/Src/board.c \
|
||||
../Core/Src/can.c \
|
||||
../Core/Src/charger_gbt.c \
|
||||
../Core/Src/connector.c \
|
||||
../Core/Src/debug.c \
|
||||
../Core/Src/edcan_handler_user.c \
|
||||
../Core/Src/gbt_packet.c \
|
||||
../Core/Src/gpio.c \
|
||||
../Core/Src/j1939.c \
|
||||
../Core/Src/lock.c \
|
||||
../Core/Src/main.c \
|
||||
../Core/Src/rtc.c \
|
||||
../Core/Src/soft_rtc.c \
|
||||
../Core/Src/stm32f1xx_hal_msp.c \
|
||||
../Core/Src/stm32f1xx_it.c \
|
||||
@@ -28,12 +31,15 @@ OBJS += \
|
||||
./Core/Src/board.o \
|
||||
./Core/Src/can.o \
|
||||
./Core/Src/charger_gbt.o \
|
||||
./Core/Src/connector.o \
|
||||
./Core/Src/debug.o \
|
||||
./Core/Src/edcan_handler_user.o \
|
||||
./Core/Src/gbt_packet.o \
|
||||
./Core/Src/gpio.o \
|
||||
./Core/Src/j1939.o \
|
||||
./Core/Src/lock.o \
|
||||
./Core/Src/main.o \
|
||||
./Core/Src/rtc.o \
|
||||
./Core/Src/soft_rtc.o \
|
||||
./Core/Src/stm32f1xx_hal_msp.o \
|
||||
./Core/Src/stm32f1xx_it.o \
|
||||
@@ -47,12 +53,15 @@ C_DEPS += \
|
||||
./Core/Src/board.d \
|
||||
./Core/Src/can.d \
|
||||
./Core/Src/charger_gbt.d \
|
||||
./Core/Src/connector.d \
|
||||
./Core/Src/debug.d \
|
||||
./Core/Src/edcan_handler_user.d \
|
||||
./Core/Src/gbt_packet.d \
|
||||
./Core/Src/gpio.d \
|
||||
./Core/Src/j1939.d \
|
||||
./Core/Src/lock.d \
|
||||
./Core/Src/main.d \
|
||||
./Core/Src/rtc.d \
|
||||
./Core/Src/soft_rtc.d \
|
||||
./Core/Src/stm32f1xx_hal_msp.d \
|
||||
./Core/Src/stm32f1xx_it.d \
|
||||
@@ -69,7 +78,7 @@ Core/Src/%.o Core/Src/%.su Core/Src/%.cyclo: ../Core/Src/%.c Core/Src/subdir.mk
|
||||
clean: clean-Core-2f-Src
|
||||
|
||||
clean-Core-2f-Src:
|
||||
-$(RM) ./Core/Src/adc.cyclo ./Core/Src/adc.d ./Core/Src/adc.o ./Core/Src/adc.su ./Core/Src/board.cyclo ./Core/Src/board.d ./Core/Src/board.o ./Core/Src/board.su ./Core/Src/can.cyclo ./Core/Src/can.d ./Core/Src/can.o ./Core/Src/can.su ./Core/Src/charger_gbt.cyclo ./Core/Src/charger_gbt.d ./Core/Src/charger_gbt.o ./Core/Src/charger_gbt.su ./Core/Src/debug.cyclo ./Core/Src/debug.d ./Core/Src/debug.o ./Core/Src/debug.su ./Core/Src/edcan_handler_user.cyclo ./Core/Src/edcan_handler_user.d ./Core/Src/edcan_handler_user.o ./Core/Src/edcan_handler_user.su ./Core/Src/gbt_packet.cyclo ./Core/Src/gbt_packet.d ./Core/Src/gbt_packet.o ./Core/Src/gbt_packet.su ./Core/Src/gpio.cyclo ./Core/Src/gpio.d ./Core/Src/gpio.o ./Core/Src/gpio.su ./Core/Src/j1939.cyclo ./Core/Src/j1939.d ./Core/Src/j1939.o ./Core/Src/j1939.su ./Core/Src/main.cyclo ./Core/Src/main.d ./Core/Src/main.o ./Core/Src/main.su ./Core/Src/soft_rtc.cyclo ./Core/Src/soft_rtc.d ./Core/Src/soft_rtc.o ./Core/Src/soft_rtc.su ./Core/Src/stm32f1xx_hal_msp.cyclo ./Core/Src/stm32f1xx_hal_msp.d ./Core/Src/stm32f1xx_hal_msp.o ./Core/Src/stm32f1xx_hal_msp.su ./Core/Src/stm32f1xx_it.cyclo ./Core/Src/stm32f1xx_it.d ./Core/Src/stm32f1xx_it.o ./Core/Src/stm32f1xx_it.su ./Core/Src/syscalls.cyclo ./Core/Src/syscalls.d ./Core/Src/syscalls.o ./Core/Src/syscalls.su ./Core/Src/sysmem.cyclo ./Core/Src/sysmem.d ./Core/Src/sysmem.o ./Core/Src/sysmem.su ./Core/Src/system_stm32f1xx.cyclo ./Core/Src/system_stm32f1xx.d ./Core/Src/system_stm32f1xx.o ./Core/Src/system_stm32f1xx.su ./Core/Src/usart.cyclo ./Core/Src/usart.d ./Core/Src/usart.o ./Core/Src/usart.su
|
||||
-$(RM) ./Core/Src/adc.cyclo ./Core/Src/adc.d ./Core/Src/adc.o ./Core/Src/adc.su ./Core/Src/board.cyclo ./Core/Src/board.d ./Core/Src/board.o ./Core/Src/board.su ./Core/Src/can.cyclo ./Core/Src/can.d ./Core/Src/can.o ./Core/Src/can.su ./Core/Src/charger_gbt.cyclo ./Core/Src/charger_gbt.d ./Core/Src/charger_gbt.o ./Core/Src/charger_gbt.su ./Core/Src/connector.cyclo ./Core/Src/connector.d ./Core/Src/connector.o ./Core/Src/connector.su ./Core/Src/debug.cyclo ./Core/Src/debug.d ./Core/Src/debug.o ./Core/Src/debug.su ./Core/Src/edcan_handler_user.cyclo ./Core/Src/edcan_handler_user.d ./Core/Src/edcan_handler_user.o ./Core/Src/edcan_handler_user.su ./Core/Src/gbt_packet.cyclo ./Core/Src/gbt_packet.d ./Core/Src/gbt_packet.o ./Core/Src/gbt_packet.su ./Core/Src/gpio.cyclo ./Core/Src/gpio.d ./Core/Src/gpio.o ./Core/Src/gpio.su ./Core/Src/j1939.cyclo ./Core/Src/j1939.d ./Core/Src/j1939.o ./Core/Src/j1939.su ./Core/Src/lock.cyclo ./Core/Src/lock.d ./Core/Src/lock.o ./Core/Src/lock.su ./Core/Src/main.cyclo ./Core/Src/main.d ./Core/Src/main.o ./Core/Src/main.su ./Core/Src/rtc.cyclo ./Core/Src/rtc.d ./Core/Src/rtc.o ./Core/Src/rtc.su ./Core/Src/soft_rtc.cyclo ./Core/Src/soft_rtc.d ./Core/Src/soft_rtc.o ./Core/Src/soft_rtc.su ./Core/Src/stm32f1xx_hal_msp.cyclo ./Core/Src/stm32f1xx_hal_msp.d ./Core/Src/stm32f1xx_hal_msp.o ./Core/Src/stm32f1xx_hal_msp.su ./Core/Src/stm32f1xx_it.cyclo ./Core/Src/stm32f1xx_it.d ./Core/Src/stm32f1xx_it.o ./Core/Src/stm32f1xx_it.su ./Core/Src/syscalls.cyclo ./Core/Src/syscalls.d ./Core/Src/syscalls.o ./Core/Src/syscalls.su ./Core/Src/sysmem.cyclo ./Core/Src/sysmem.d ./Core/Src/sysmem.o ./Core/Src/sysmem.su ./Core/Src/system_stm32f1xx.cyclo ./Core/Src/system_stm32f1xx.d ./Core/Src/system_stm32f1xx.o ./Core/Src/system_stm32f1xx.su ./Core/Src/usart.cyclo ./Core/Src/usart.d ./Core/Src/usart.o ./Core/Src/usart.su
|
||||
|
||||
.PHONY: clean-Core-2f-Src
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
stm32f1xx_hal_rtc.c:275:19:HAL_RTC_Init 9
|
||||
stm32f1xx_hal_rtc.c:411:19:HAL_RTC_DeInit 4
|
||||
stm32f1xx_hal_rtc.c:650:13:HAL_RTC_MspInit 1
|
||||
stm32f1xx_hal_rtc.c:665:13:HAL_RTC_MspDeInit 1
|
||||
stm32f1xx_hal_rtc.c:703:19:HAL_RTC_SetTime 9
|
||||
stm32f1xx_hal_rtc.c:802:19:HAL_RTC_GetTime 12
|
||||
stm32f1xx_hal_rtc.c:913:19:HAL_RTC_SetDate 10
|
||||
stm32f1xx_hal_rtc.c:1027:19:HAL_RTC_GetDate 5
|
||||
stm32f1xx_hal_rtc.c:1092:19:HAL_RTC_SetAlarm 8
|
||||
stm32f1xx_hal_rtc.c:1184:19:HAL_RTC_SetAlarm_IT 8
|
||||
stm32f1xx_hal_rtc.c:1289:19:HAL_RTC_GetAlarm 4
|
||||
stm32f1xx_hal_rtc.c:1334:19:HAL_RTC_DeactivateAlarm 5
|
||||
stm32f1xx_hal_rtc.c:1404:6:HAL_RTC_AlarmIRQHandler 3
|
||||
stm32f1xx_hal_rtc.c:1436:13:HAL_RTC_AlarmAEventCallback 1
|
||||
stm32f1xx_hal_rtc.c:1452:19:HAL_RTC_PollForAlarmAEvent 6
|
||||
stm32f1xx_hal_rtc.c:1507:21:HAL_RTC_GetState 1
|
||||
stm32f1xx_hal_rtc.c:1540:19:HAL_RTC_WaitForSynchro 4
|
||||
stm32f1xx_hal_rtc.c:1587:17:RTC_ReadTimeCounter 2
|
||||
stm32f1xx_hal_rtc.c:1619:26:RTC_WriteTimeCounter 3
|
||||
stm32f1xx_hal_rtc.c:1651:17:RTC_ReadAlarmCounter 1
|
||||
stm32f1xx_hal_rtc.c:1668:26:RTC_WriteAlarmCounter 3
|
||||
stm32f1xx_hal_rtc.c:1700:26:RTC_EnterInitMode 3
|
||||
stm32f1xx_hal_rtc.c:1727:26:RTC_ExitInitMode 3
|
||||
stm32f1xx_hal_rtc.c:1752:16:RTC_ByteToBcd2 2
|
||||
stm32f1xx_hal_rtc.c:1770:16:RTC_Bcd2ToByte 1
|
||||
stm32f1xx_hal_rtc.c:1784:13:RTC_DateUpdate 21
|
||||
stm32f1xx_hal_rtc.c:1879:16:RTC_IsLeapYear 4
|
||||
stm32f1xx_hal_rtc.c:1916:16:RTC_WeekDayNum 2
|
||||
@@ -0,0 +1,14 @@
|
||||
stm32f1xx_hal_rtc_ex.c:81:19:HAL_RTCEx_SetTamper 5
|
||||
stm32f1xx_hal_rtc_ex.c:127:19:HAL_RTCEx_SetTamper_IT 5
|
||||
stm32f1xx_hal_rtc_ex.c:175:19:HAL_RTCEx_DeactivateTamper 3
|
||||
stm32f1xx_hal_rtc_ex.c:217:6:HAL_RTCEx_TamperIRQHandler 3
|
||||
stm32f1xx_hal_rtc_ex.c:247:13:HAL_RTCEx_Tamper1EventCallback 1
|
||||
stm32f1xx_hal_rtc_ex.c:263:19:HAL_RTCEx_PollForTamper1Event 6
|
||||
stm32f1xx_hal_rtc_ex.c:319:19:HAL_RTCEx_SetSecond_IT 3
|
||||
stm32f1xx_hal_rtc_ex.c:349:19:HAL_RTCEx_DeactivateSecond 3
|
||||
stm32f1xx_hal_rtc_ex.c:379:6:HAL_RTCEx_RTCIRQHandler 4
|
||||
stm32f1xx_hal_rtc_ex.c:419:13:HAL_RTCEx_RTCEventCallback 1
|
||||
stm32f1xx_hal_rtc_ex.c:434:13:HAL_RTCEx_RTCEventErrorCallback 1
|
||||
stm32f1xx_hal_rtc_ex.c:474:6:HAL_RTCEx_BKUPWrite 1
|
||||
stm32f1xx_hal_rtc_ex.c:499:10:HAL_RTCEx_BKUPRead 1
|
||||
stm32f1xx_hal_rtc_ex.c:529:19:HAL_RTCEx_SetSmoothCalib 3
|
||||
@@ -19,6 +19,8 @@ C_SRCS += \
|
||||
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \
|
||||
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \
|
||||
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \
|
||||
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.c \
|
||||
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.c \
|
||||
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
|
||||
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
|
||||
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c
|
||||
@@ -38,6 +40,8 @@ OBJS += \
|
||||
./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o \
|
||||
./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o \
|
||||
./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o \
|
||||
./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.o \
|
||||
./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.o \
|
||||
./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o \
|
||||
./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o \
|
||||
./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.o
|
||||
@@ -57,6 +61,8 @@ C_DEPS += \
|
||||
./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.d \
|
||||
./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.d \
|
||||
./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.d \
|
||||
./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.d \
|
||||
./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.d \
|
||||
./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.d \
|
||||
./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.d \
|
||||
./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.d
|
||||
@@ -69,7 +75,7 @@ Drivers/STM32F1xx_HAL_Driver/Src/%.o Drivers/STM32F1xx_HAL_Driver/Src/%.su Drive
|
||||
clean: clean-Drivers-2f-STM32F1xx_HAL_Driver-2f-Src
|
||||
|
||||
clean-Drivers-2f-STM32F1xx_HAL_Driver-2f-Src:
|
||||
-$(RM) ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.su
|
||||
-$(RM) ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.su ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.cyclo ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.d ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.o ./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.su
|
||||
|
||||
.PHONY: clean-Drivers-2f-STM32F1xx_HAL_Driver-2f-Src
|
||||
|
||||
|
||||
37410
Debug/GbTModuleSW.list
37410
Debug/GbTModuleSW.list
File diff suppressed because it is too large
Load Diff
@@ -2,12 +2,15 @@
|
||||
"./Core/Src/board.o"
|
||||
"./Core/Src/can.o"
|
||||
"./Core/Src/charger_gbt.o"
|
||||
"./Core/Src/connector.o"
|
||||
"./Core/Src/debug.o"
|
||||
"./Core/Src/edcan_handler_user.o"
|
||||
"./Core/Src/gbt_packet.o"
|
||||
"./Core/Src/gpio.o"
|
||||
"./Core/Src/j1939.o"
|
||||
"./Core/Src/lock.o"
|
||||
"./Core/Src/main.o"
|
||||
"./Core/Src/rtc.o"
|
||||
"./Core/Src/soft_rtc.o"
|
||||
"./Core/Src/stm32f1xx_hal_msp.o"
|
||||
"./Core/Src/stm32f1xx_it.o"
|
||||
@@ -30,6 +33,8 @@
|
||||
"./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.o"
|
||||
"./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.o"
|
||||
"./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.o"
|
||||
"./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.o"
|
||||
"./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.o"
|
||||
"./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.o"
|
||||
"./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.o"
|
||||
"./Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.o"
|
||||
|
||||
@@ -10,6 +10,7 @@ C_SRCS :=
|
||||
S_UPPER_SRCS :=
|
||||
O_SRCS :=
|
||||
CYCLO_FILES :=
|
||||
OBJCOPY_HEX :=
|
||||
SIZE_OUTPUT :=
|
||||
OBJDUMP_LIST :=
|
||||
SU_FILES :=
|
||||
|
||||
607
Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rtc.h
Normal file
607
Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rtc.h
Normal file
@@ -0,0 +1,607 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f1xx_hal_rtc.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header file of RTC HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2016 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F1xx_HAL_RTC_H
|
||||
#define __STM32F1xx_HAL_RTC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f1xx_hal_def.h"
|
||||
|
||||
/** @addtogroup STM32F1xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup RTC
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup RTC_Private_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define IS_RTC_ASYNCH_PREDIV(PREDIV) (((PREDIV) <= 0xFFFFFU) || ((PREDIV) == RTC_AUTO_1_SECOND))
|
||||
#define IS_RTC_HOUR24(HOUR) ((HOUR) <= 23U)
|
||||
#define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= 59U)
|
||||
#define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= 59U)
|
||||
#define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_FORMAT_BIN) || ((FORMAT) == RTC_FORMAT_BCD))
|
||||
#define IS_RTC_YEAR(YEAR) ((YEAR) <= 99U)
|
||||
#define IS_RTC_MONTH(MONTH) (((MONTH) >= 1U) && ((MONTH) <= 12U))
|
||||
#define IS_RTC_DATE(DATE) (((DATE) >= 1U) && ((DATE) <= 31U))
|
||||
#define IS_RTC_ALARM(ALARM) ((ALARM) == RTC_ALARM_A)
|
||||
#define IS_RTC_CALIB_OUTPUT(__OUTPUT__) (((__OUTPUT__) == RTC_OUTPUTSOURCE_NONE) || \
|
||||
((__OUTPUT__) == RTC_OUTPUTSOURCE_CALIBCLOCK) || \
|
||||
((__OUTPUT__) == RTC_OUTPUTSOURCE_ALARM) || \
|
||||
((__OUTPUT__) == RTC_OUTPUTSOURCE_SECOND))
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup RTC_Private_Constants
|
||||
* @{
|
||||
*/
|
||||
/** @defgroup RTC_Timeout_Value Default Timeout Value
|
||||
* @{
|
||||
*/
|
||||
#define RTC_TIMEOUT_VALUE 1000U
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup RTC_EXTI_Line_Event RTC EXTI Line event
|
||||
* @{
|
||||
*/
|
||||
#define RTC_EXTI_LINE_ALARM_EVENT ((uint32_t)EXTI_IMR_MR17) /*!< External interrupt line 17 Connected to the RTC Alarm event */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/** @defgroup RTC_Exported_Types RTC Exported Types
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief RTC Time structure definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t Hours; /*!< Specifies the RTC Time Hour.
|
||||
This parameter must be a number between Min_Data = 0 and Max_Data = 23 */
|
||||
|
||||
uint8_t Minutes; /*!< Specifies the RTC Time Minutes.
|
||||
This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
|
||||
|
||||
uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
|
||||
This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
|
||||
|
||||
} RTC_TimeTypeDef;
|
||||
|
||||
/**
|
||||
* @brief RTC Alarm structure definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */
|
||||
|
||||
uint32_t Alarm; /*!< Specifies the alarm ID (only 1 alarm ID for STM32F1).
|
||||
This parameter can be a value of @ref RTC_Alarms_Definitions */
|
||||
} RTC_AlarmTypeDef;
|
||||
|
||||
/**
|
||||
* @brief HAL State structures definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_RTC_STATE_RESET = 0x00U, /*!< RTC not yet initialized or disabled */
|
||||
HAL_RTC_STATE_READY = 0x01U, /*!< RTC initialized and ready for use */
|
||||
HAL_RTC_STATE_BUSY = 0x02U, /*!< RTC process is ongoing */
|
||||
HAL_RTC_STATE_TIMEOUT = 0x03U, /*!< RTC timeout state */
|
||||
HAL_RTC_STATE_ERROR = 0x04U /*!< RTC error state */
|
||||
|
||||
} HAL_RTCStateTypeDef;
|
||||
|
||||
/**
|
||||
* @brief RTC Configuration Structure definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value.
|
||||
This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFFFF or RTC_AUTO_1_SECOND
|
||||
If RTC_AUTO_1_SECOND is selected, AsynchPrediv will be set automatically to get 1sec timebase */
|
||||
|
||||
uint32_t OutPut; /*!< Specifies which signal will be routed to the RTC Tamper pin.
|
||||
This parameter can be a value of @ref RTC_output_source_to_output_on_the_Tamper_pin */
|
||||
|
||||
} RTC_InitTypeDef;
|
||||
|
||||
/**
|
||||
* @brief RTC Date structure definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay (not necessary for HAL_RTC_SetDate).
|
||||
This parameter can be a value of @ref RTC_WeekDay_Definitions */
|
||||
|
||||
uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format).
|
||||
This parameter can be a value of @ref RTC_Month_Date_Definitions */
|
||||
|
||||
uint8_t Date; /*!< Specifies the RTC Date.
|
||||
This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
|
||||
|
||||
uint8_t Year; /*!< Specifies the RTC Date Year.
|
||||
This parameter must be a number between Min_Data = 0 and Max_Data = 99 */
|
||||
|
||||
} RTC_DateTypeDef;
|
||||
|
||||
/**
|
||||
* @brief Time Handle Structure definition
|
||||
*/
|
||||
#if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
|
||||
typedef struct __RTC_HandleTypeDef
|
||||
#else
|
||||
typedef struct
|
||||
#endif /* (USE_HAL_RTC_REGISTER_CALLBACKS) */
|
||||
{
|
||||
RTC_TypeDef *Instance; /*!< Register base address */
|
||||
|
||||
RTC_InitTypeDef Init; /*!< RTC required parameters */
|
||||
|
||||
RTC_DateTypeDef DateToUpdate; /*!< Current date set by user and updated automatically */
|
||||
|
||||
HAL_LockTypeDef Lock; /*!< RTC locking object */
|
||||
|
||||
__IO HAL_RTCStateTypeDef State; /*!< Time communication state */
|
||||
|
||||
#if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
|
||||
void (* AlarmAEventCallback)(struct __RTC_HandleTypeDef *hrtc); /*!< RTC Alarm A Event callback */
|
||||
|
||||
void (* Tamper1EventCallback)(struct __RTC_HandleTypeDef *hrtc); /*!< RTC Tamper 1 Event callback */
|
||||
|
||||
void (* MspInitCallback)(struct __RTC_HandleTypeDef *hrtc); /*!< RTC Msp Init callback */
|
||||
|
||||
void (* MspDeInitCallback)(struct __RTC_HandleTypeDef *hrtc); /*!< RTC Msp DeInit callback */
|
||||
|
||||
#endif /* (USE_HAL_RTC_REGISTER_CALLBACKS) */
|
||||
|
||||
} RTC_HandleTypeDef;
|
||||
|
||||
#if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
|
||||
/**
|
||||
* @brief HAL RTC Callback ID enumeration definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_RTC_ALARM_A_EVENT_CB_ID = 0x00u, /*!< RTC Alarm A Event Callback ID */
|
||||
HAL_RTC_TAMPER1_EVENT_CB_ID = 0x04u, /*!< RTC Tamper 1 Callback ID */
|
||||
HAL_RTC_MSPINIT_CB_ID = 0x0Eu, /*!< RTC Msp Init callback ID */
|
||||
HAL_RTC_MSPDEINIT_CB_ID = 0x0Fu /*!< RTC Msp DeInit callback ID */
|
||||
} HAL_RTC_CallbackIDTypeDef;
|
||||
|
||||
/**
|
||||
* @brief HAL RTC Callback pointer definition
|
||||
*/
|
||||
typedef void (*pRTC_CallbackTypeDef)(RTC_HandleTypeDef *hrtc); /*!< pointer to an RTC callback function */
|
||||
#endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/** @defgroup RTC_Exported_Constants RTC Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup RTC_Automatic_Prediv_1_Second Automatic calculation of prediv for 1sec timebase
|
||||
* @{
|
||||
*/
|
||||
#define RTC_AUTO_1_SECOND 0xFFFFFFFFU
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup RTC_Input_parameter_format_definitions Input Parameter Format
|
||||
* @{
|
||||
*/
|
||||
#define RTC_FORMAT_BIN 0x000000000U
|
||||
#define RTC_FORMAT_BCD 0x000000001U
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup RTC_Month_Date_Definitions Month Definitions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Coded in BCD format */
|
||||
#define RTC_MONTH_JANUARY ((uint8_t)0x01)
|
||||
#define RTC_MONTH_FEBRUARY ((uint8_t)0x02)
|
||||
#define RTC_MONTH_MARCH ((uint8_t)0x03)
|
||||
#define RTC_MONTH_APRIL ((uint8_t)0x04)
|
||||
#define RTC_MONTH_MAY ((uint8_t)0x05)
|
||||
#define RTC_MONTH_JUNE ((uint8_t)0x06)
|
||||
#define RTC_MONTH_JULY ((uint8_t)0x07)
|
||||
#define RTC_MONTH_AUGUST ((uint8_t)0x08)
|
||||
#define RTC_MONTH_SEPTEMBER ((uint8_t)0x09)
|
||||
#define RTC_MONTH_OCTOBER ((uint8_t)0x10)
|
||||
#define RTC_MONTH_NOVEMBER ((uint8_t)0x11)
|
||||
#define RTC_MONTH_DECEMBER ((uint8_t)0x12)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup RTC_WeekDay_Definitions WeekDay Definitions
|
||||
* @{
|
||||
*/
|
||||
#define RTC_WEEKDAY_MONDAY ((uint8_t)0x01)
|
||||
#define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02)
|
||||
#define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03)
|
||||
#define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04)
|
||||
#define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05)
|
||||
#define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06)
|
||||
#define RTC_WEEKDAY_SUNDAY ((uint8_t)0x00)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup RTC_Alarms_Definitions Alarms Definitions
|
||||
* @{
|
||||
*/
|
||||
#define RTC_ALARM_A 0U /*!< Specify alarm ID (mainly for legacy purposes) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup RTC_output_source_to_output_on_the_Tamper_pin Output source to output on the Tamper pin
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define RTC_OUTPUTSOURCE_NONE 0x00000000U /*!< No output on the TAMPER pin */
|
||||
#define RTC_OUTPUTSOURCE_CALIBCLOCK BKP_RTCCR_CCO /*!< RTC clock with a frequency divided by 64 on the TAMPER pin */
|
||||
#define RTC_OUTPUTSOURCE_ALARM BKP_RTCCR_ASOE /*!< Alarm pulse signal on the TAMPER pin */
|
||||
#define RTC_OUTPUTSOURCE_SECOND (BKP_RTCCR_ASOS | BKP_RTCCR_ASOE) /*!< Second pulse signal on the TAMPER pin */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup RTC_Interrupts_Definitions Interrupts Definitions
|
||||
* @{
|
||||
*/
|
||||
#define RTC_IT_OW RTC_CRH_OWIE /*!< Overflow interrupt */
|
||||
#define RTC_IT_ALRA RTC_CRH_ALRIE /*!< Alarm interrupt */
|
||||
#define RTC_IT_SEC RTC_CRH_SECIE /*!< Second interrupt */
|
||||
#define RTC_IT_TAMP1 BKP_CSR_TPIE /*!< TAMPER Pin interrupt enable */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup RTC_Flags_Definitions Flags Definitions
|
||||
* @{
|
||||
*/
|
||||
#define RTC_FLAG_RTOFF RTC_CRL_RTOFF /*!< RTC Operation OFF flag */
|
||||
#define RTC_FLAG_RSF RTC_CRL_RSF /*!< Registers Synchronized flag */
|
||||
#define RTC_FLAG_OW RTC_CRL_OWF /*!< Overflow flag */
|
||||
#define RTC_FLAG_ALRAF RTC_CRL_ALRF /*!< Alarm flag */
|
||||
#define RTC_FLAG_SEC RTC_CRL_SECF /*!< Second flag */
|
||||
#define RTC_FLAG_TAMP1F BKP_CSR_TEF /*!< Tamper Interrupt Flag */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/** @defgroup RTC_Exported_macros RTC Exported Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Reset RTC handle state
|
||||
* @param __HANDLE__: RTC handle.
|
||||
* @retval None
|
||||
*/
|
||||
#if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
|
||||
#define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) do{\
|
||||
(__HANDLE__)->State = HAL_RTC_STATE_RESET;\
|
||||
(__HANDLE__)->MspInitCallback = NULL;\
|
||||
(__HANDLE__)->MspDeInitCallback = NULL;\
|
||||
}while(0u)
|
||||
#else
|
||||
#define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET)
|
||||
#endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
|
||||
|
||||
/**
|
||||
* @brief Disable the write protection for RTC registers.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CRL, RTC_CRL_CNF)
|
||||
|
||||
/**
|
||||
* @brief Enable the write protection for RTC registers.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CRL, RTC_CRL_CNF)
|
||||
|
||||
/**
|
||||
* @brief Enable the RTC Alarm interrupt.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg RTC_IT_ALRA: Alarm A interrupt
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
|
||||
|
||||
/**
|
||||
* @brief Disable the RTC Alarm interrupt.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg RTC_IT_ALRA: Alarm A interrupt
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
|
||||
|
||||
/**
|
||||
* @brief Check whether the specified RTC Alarm interrupt has been enabled or not.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be checked
|
||||
* This parameter can be:
|
||||
* @arg RTC_IT_ALRA: Alarm A interrupt
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((__HANDLE__)->Instance->CRH)& ((__INTERRUPT__)))) != RESET)? SET : RESET)
|
||||
|
||||
/**
|
||||
* @brief Get the selected RTC Alarm's flag status.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
|
||||
* This parameter can be:
|
||||
* @arg RTC_FLAG_ALRAF
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->CRL) & (__FLAG__)) != RESET)? SET : RESET)
|
||||
|
||||
/**
|
||||
* @brief Check whether the specified RTC Alarm interrupt has occurred or not.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to check.
|
||||
* This parameter can be:
|
||||
* @arg RTC_IT_ALRA: Alarm A interrupt
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CRL) & (__INTERRUPT__)) != RESET)? SET : RESET)
|
||||
|
||||
/**
|
||||
* @brief Clear the RTC Alarm's pending flags.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled.
|
||||
* This parameter can be:
|
||||
* @arg RTC_FLAG_ALRAF
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CRL) &= ~(__FLAG__)
|
||||
|
||||
/**
|
||||
* @brief Enable interrupt on ALARM Exti Line 17.
|
||||
* @retval None.
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR, RTC_EXTI_LINE_ALARM_EVENT)
|
||||
|
||||
/**
|
||||
* @brief Disable interrupt on ALARM Exti Line 17.
|
||||
* @retval None.
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR, RTC_EXTI_LINE_ALARM_EVENT)
|
||||
|
||||
/**
|
||||
* @brief Enable event on ALARM Exti Line 17.
|
||||
* @retval None.
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR, RTC_EXTI_LINE_ALARM_EVENT)
|
||||
|
||||
/**
|
||||
* @brief Disable event on ALARM Exti Line 17.
|
||||
* @retval None.
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR, RTC_EXTI_LINE_ALARM_EVENT)
|
||||
|
||||
|
||||
/**
|
||||
* @brief ALARM EXTI line configuration: set falling edge trigger.
|
||||
* @retval None.
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR, RTC_EXTI_LINE_ALARM_EVENT)
|
||||
|
||||
|
||||
/**
|
||||
* @brief Disable the ALARM Extended Interrupt Falling Trigger.
|
||||
* @retval None.
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR, RTC_EXTI_LINE_ALARM_EVENT)
|
||||
|
||||
|
||||
/**
|
||||
* @brief ALARM EXTI line configuration: set rising edge trigger.
|
||||
* @retval None.
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR, RTC_EXTI_LINE_ALARM_EVENT)
|
||||
|
||||
/**
|
||||
* @brief Disable the ALARM Extended Interrupt Rising Trigger.
|
||||
* This parameter can be:
|
||||
* @retval None.
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR, RTC_EXTI_LINE_ALARM_EVENT)
|
||||
|
||||
/**
|
||||
* @brief ALARM EXTI line configuration: set rising & falling edge trigger.
|
||||
* @retval None.
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE() \
|
||||
do{ \
|
||||
__HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE(); \
|
||||
__HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE(); \
|
||||
} while(0U)
|
||||
|
||||
/**
|
||||
* @brief Disable the ALARM Extended Interrupt Rising & Falling Trigger.
|
||||
* This parameter can be:
|
||||
* @retval None.
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE() \
|
||||
do{ \
|
||||
__HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE(); \
|
||||
__HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE(); \
|
||||
} while(0U)
|
||||
|
||||
/**
|
||||
* @brief Check whether the specified ALARM EXTI interrupt flag is set or not.
|
||||
* @retval EXTI ALARM Line Status.
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_EXTI_GET_FLAG() (EXTI->PR & (RTC_EXTI_LINE_ALARM_EVENT))
|
||||
|
||||
/**
|
||||
* @brief Clear the ALARM EXTI flag.
|
||||
* @retval None.
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() (EXTI->PR = (RTC_EXTI_LINE_ALARM_EVENT))
|
||||
|
||||
/**
|
||||
* @brief Generate a Software interrupt on selected EXTI line.
|
||||
* @retval None.
|
||||
*/
|
||||
#define __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER, RTC_EXTI_LINE_ALARM_EVENT)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Include RTC HAL Extension module */
|
||||
#include "stm32f1xx_hal_rtc_ex.h"
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
/** @addtogroup RTC_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/* Initialization and de-initialization functions ****************************/
|
||||
/** @addtogroup RTC_Exported_Functions_Group1
|
||||
* @{
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc);
|
||||
HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc);
|
||||
void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc);
|
||||
void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc);
|
||||
|
||||
/* Callbacks Register/UnRegister functions ***********************************/
|
||||
#if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
|
||||
HAL_StatusTypeDef HAL_RTC_RegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID, pRTC_CallbackTypeDef pCallback);
|
||||
HAL_StatusTypeDef HAL_RTC_UnRegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID);
|
||||
#endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* RTC Time and Date functions ************************************************/
|
||||
/** @addtogroup RTC_Exported_Functions_Group2
|
||||
* @{
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
|
||||
HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
|
||||
HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
|
||||
HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* RTC Alarm functions ********************************************************/
|
||||
/** @addtogroup RTC_Exported_Functions_Group3
|
||||
* @{
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
|
||||
HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
|
||||
HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm);
|
||||
HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format);
|
||||
void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc);
|
||||
HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
|
||||
void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Peripheral State functions *************************************************/
|
||||
/** @addtogroup RTC_Exported_Functions_Group4
|
||||
* @{
|
||||
*/
|
||||
HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Peripheral Control functions ***********************************************/
|
||||
/** @addtogroup RTC_Exported_Functions_Group5
|
||||
* @{
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef *hrtc);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32F1xx_HAL_RTC_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
412
Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rtc_ex.h
Normal file
412
Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rtc_ex.h
Normal file
@@ -0,0 +1,412 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f1xx_hal_rtc_ex.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header file of RTC HAL Extension module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2016 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F1xx_HAL_RTC_EX_H
|
||||
#define __STM32F1xx_HAL_RTC_EX_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f1xx_hal_def.h"
|
||||
|
||||
/** @addtogroup STM32F1xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup RTCEx
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup RTCEx_Private_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup RTCEx_Alias_For_Legacy Alias define maintained for legacy
|
||||
* @{
|
||||
*/
|
||||
#define HAL_RTCEx_TamperTimeStampIRQHandler HAL_RTCEx_TamperIRQHandler
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup RTCEx_IS_RTC_Definitions Private macros to check input parameters
|
||||
* @{
|
||||
*/
|
||||
#define IS_RTC_TAMPER(__TAMPER__) ((__TAMPER__) == RTC_TAMPER_1)
|
||||
|
||||
#define IS_RTC_TAMPER_TRIGGER(__TRIGGER__) (((__TRIGGER__) == RTC_TAMPERTRIGGER_LOWLEVEL) || \
|
||||
((__TRIGGER__) == RTC_TAMPERTRIGGER_HIGHLEVEL))
|
||||
|
||||
#if RTC_BKP_NUMBER > 10U
|
||||
#define IS_RTC_BKP(BKP) (((BKP) <= (uint32_t)RTC_BKP_DR10) || (((BKP) >= (uint32_t)RTC_BKP_DR11) && ((BKP) <= (uint32_t)RTC_BKP_DR42)))
|
||||
#else
|
||||
#define IS_RTC_BKP(BKP) ((BKP) <= (uint32_t)RTC_BKP_NUMBER)
|
||||
#endif
|
||||
#define IS_RTC_SMOOTH_CALIB_MINUS(__VALUE__) ((__VALUE__) <= 0x0000007FU)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/** @defgroup RTCEx_Exported_Types RTCEx Exported Types
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief RTC Tamper structure definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t Tamper; /*!< Specifies the Tamper Pin.
|
||||
This parameter can be a value of @ref RTCEx_Tamper_Pins_Definitions */
|
||||
|
||||
uint32_t Trigger; /*!< Specifies the Tamper Trigger.
|
||||
This parameter can be a value of @ref RTCEx_Tamper_Trigger_Definitions */
|
||||
|
||||
} RTC_TamperTypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/** @defgroup RTCEx_Exported_Constants RTCEx Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup RTCEx_Tamper_Pins_Definitions Tamper Pins Definitions
|
||||
* @{
|
||||
*/
|
||||
#define RTC_TAMPER_1 BKP_CR_TPE /*!< Select tamper to be enabled (mainly for legacy purposes) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup RTCEx_Tamper_Trigger_Definitions Tamper Trigger Definitions
|
||||
* @{
|
||||
*/
|
||||
#define RTC_TAMPERTRIGGER_LOWLEVEL BKP_CR_TPAL /*!< A high level on the TAMPER pin resets all data backup registers (if TPE bit is set) */
|
||||
#define RTC_TAMPERTRIGGER_HIGHLEVEL 0x00000000U /*!< A low level on the TAMPER pin resets all data backup registers (if TPE bit is set) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup RTCEx_Backup_Registers_Definitions Backup Registers Definitions
|
||||
* @{
|
||||
*/
|
||||
#if RTC_BKP_NUMBER > 0U
|
||||
#define RTC_BKP_DR1 0x00000001U
|
||||
#define RTC_BKP_DR2 0x00000002U
|
||||
#define RTC_BKP_DR3 0x00000003U
|
||||
#define RTC_BKP_DR4 0x00000004U
|
||||
#define RTC_BKP_DR5 0x00000005U
|
||||
#define RTC_BKP_DR6 0x00000006U
|
||||
#define RTC_BKP_DR7 0x00000007U
|
||||
#define RTC_BKP_DR8 0x00000008U
|
||||
#define RTC_BKP_DR9 0x00000009U
|
||||
#define RTC_BKP_DR10 0x0000000AU
|
||||
#endif /* RTC_BKP_NUMBER > 0 */
|
||||
|
||||
#if RTC_BKP_NUMBER > 10U
|
||||
#define RTC_BKP_DR11 0x00000010U
|
||||
#define RTC_BKP_DR12 0x00000011U
|
||||
#define RTC_BKP_DR13 0x00000012U
|
||||
#define RTC_BKP_DR14 0x00000013U
|
||||
#define RTC_BKP_DR15 0x00000014U
|
||||
#define RTC_BKP_DR16 0x00000015U
|
||||
#define RTC_BKP_DR17 0x00000016U
|
||||
#define RTC_BKP_DR18 0x00000017U
|
||||
#define RTC_BKP_DR19 0x00000018U
|
||||
#define RTC_BKP_DR20 0x00000019U
|
||||
#define RTC_BKP_DR21 0x0000001AU
|
||||
#define RTC_BKP_DR22 0x0000001BU
|
||||
#define RTC_BKP_DR23 0x0000001CU
|
||||
#define RTC_BKP_DR24 0x0000001DU
|
||||
#define RTC_BKP_DR25 0x0000001EU
|
||||
#define RTC_BKP_DR26 0x0000001FU
|
||||
#define RTC_BKP_DR27 0x00000020U
|
||||
#define RTC_BKP_DR28 0x00000021U
|
||||
#define RTC_BKP_DR29 0x00000022U
|
||||
#define RTC_BKP_DR30 0x00000023U
|
||||
#define RTC_BKP_DR31 0x00000024U
|
||||
#define RTC_BKP_DR32 0x00000025U
|
||||
#define RTC_BKP_DR33 0x00000026U
|
||||
#define RTC_BKP_DR34 0x00000027U
|
||||
#define RTC_BKP_DR35 0x00000028U
|
||||
#define RTC_BKP_DR36 0x00000029U
|
||||
#define RTC_BKP_DR37 0x0000002AU
|
||||
#define RTC_BKP_DR38 0x0000002BU
|
||||
#define RTC_BKP_DR39 0x0000002CU
|
||||
#define RTC_BKP_DR40 0x0000002DU
|
||||
#define RTC_BKP_DR41 0x0000002EU
|
||||
#define RTC_BKP_DR42 0x0000002FU
|
||||
#endif /* RTC_BKP_NUMBER > 10 */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/** @defgroup RTCEx_Exported_Macros RTCEx Exported Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Enable the RTC Tamper interrupt.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __INTERRUPT__: specifies the RTC Tamper interrupt sources to be enabled
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg RTC_IT_TAMP1: Tamper A interrupt
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_TAMPER_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT(BKP->CSR, (__INTERRUPT__))
|
||||
|
||||
/**
|
||||
* @brief Disable the RTC Tamper interrupt.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __INTERRUPT__: specifies the RTC Tamper interrupt sources to be disabled.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg RTC_IT_TAMP1: Tamper A interrupt
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_TAMPER_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT(BKP->CSR, (__INTERRUPT__))
|
||||
|
||||
/**
|
||||
* @brief Check whether the specified RTC Tamper interrupt has been enabled or not.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __INTERRUPT__: specifies the RTC Tamper interrupt sources to be checked.
|
||||
* This parameter can be:
|
||||
* @arg RTC_IT_TAMP1
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((BKP->CSR) & ((__INTERRUPT__))) != RESET)? SET : RESET)
|
||||
|
||||
/**
|
||||
* @brief Get the selected RTC Tamper's flag status.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
|
||||
* This parameter can be:
|
||||
* @arg RTC_FLAG_TAMP1F
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) ((((BKP->CSR) & (__FLAG__)) != RESET)? SET : RESET)
|
||||
|
||||
/**
|
||||
* @brief Get the selected RTC Tamper's flag status.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __INTERRUPT__: specifies the RTC Tamper interrupt sources to be checked.
|
||||
* This parameter can be:
|
||||
* @arg RTC_IT_TAMP1
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) ((((BKP->CSR) & (BKP_CSR_TEF)) != RESET)? SET : RESET)
|
||||
|
||||
/**
|
||||
* @brief Clear the RTC Tamper's pending flags.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __FLAG__: specifies the RTC Tamper Flag sources to be enabled or disabled.
|
||||
* This parameter can be:
|
||||
* @arg RTC_FLAG_TAMP1F
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) SET_BIT(BKP->CSR, BKP_CSR_CTE | BKP_CSR_CTI)
|
||||
|
||||
/**
|
||||
* @brief Enable the RTC Second interrupt.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __INTERRUPT__: specifies the RTC Second interrupt sources to be enabled
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg RTC_IT_SEC: Second A interrupt
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_SECOND_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
|
||||
|
||||
/**
|
||||
* @brief Disable the RTC Second interrupt.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __INTERRUPT__: specifies the RTC Second interrupt sources to be disabled.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg RTC_IT_SEC: Second A interrupt
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_SECOND_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
|
||||
|
||||
/**
|
||||
* @brief Check whether the specified RTC Second interrupt has occurred or not.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __INTERRUPT__: specifies the RTC Second interrupt sources to be enabled or disabled.
|
||||
* This parameter can be:
|
||||
* @arg RTC_IT_SEC: Second A interrupt
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_SECOND_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((__HANDLE__)->Instance->CRH)& ((__INTERRUPT__)))) != RESET)? SET : RESET)
|
||||
|
||||
/**
|
||||
* @brief Get the selected RTC Second's flag status.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __FLAG__: specifies the RTC Second Flag sources to be enabled or disabled.
|
||||
* This parameter can be:
|
||||
* @arg RTC_FLAG_SEC
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_SECOND_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->CRL) & (__FLAG__)) != RESET)? SET : RESET)
|
||||
|
||||
/**
|
||||
* @brief Clear the RTC Second's pending flags.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __FLAG__: specifies the RTC Second Flag sources to be enabled or disabled.
|
||||
* This parameter can be:
|
||||
* @arg RTC_FLAG_SEC
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_SECOND_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CRL) &= ~(__FLAG__)
|
||||
|
||||
/**
|
||||
* @brief Enable the RTC Overflow interrupt.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __INTERRUPT__: specifies the RTC Overflow interrupt sources to be enabled
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg RTC_IT_OW: Overflow A interrupt
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_OVERFLOW_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
|
||||
|
||||
/**
|
||||
* @brief Disable the RTC Overflow interrupt.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __INTERRUPT__: specifies the RTC Overflow interrupt sources to be disabled.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg RTC_IT_OW: Overflow A interrupt
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_OVERFLOW_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
|
||||
|
||||
/**
|
||||
* @brief Check whether the specified RTC Overflow interrupt has occurred or not.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __INTERRUPT__: specifies the RTC Overflow interrupt sources to be enabled or disabled.
|
||||
* This parameter can be:
|
||||
* @arg RTC_IT_OW: Overflow A interrupt
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_OVERFLOW_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((__HANDLE__)->Instance->CRH)& ((__INTERRUPT__))) ) != RESET)? SET : RESET)
|
||||
|
||||
/**
|
||||
* @brief Get the selected RTC Overflow's flag status.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __FLAG__: specifies the RTC Overflow Flag sources to be enabled or disabled.
|
||||
* This parameter can be:
|
||||
* @arg RTC_FLAG_OW
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_OVERFLOW_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->CRL) & (__FLAG__)) != RESET)? SET : RESET)
|
||||
|
||||
/**
|
||||
* @brief Clear the RTC Overflow's pending flags.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @param __FLAG__: specifies the RTC Overflow Flag sources to be enabled or disabled.
|
||||
* This parameter can be:
|
||||
* @arg RTC_FLAG_OW
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_OVERFLOW_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CRL) = ~(__FLAG__)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
/** @addtogroup RTCEx_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* RTC Tamper functions *****************************************/
|
||||
/** @addtogroup RTCEx_Exported_Functions_Group1
|
||||
* @{
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef *sTamper);
|
||||
HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef *sTamper);
|
||||
HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper);
|
||||
void HAL_RTCEx_TamperIRQHandler(RTC_HandleTypeDef *hrtc);
|
||||
void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc);
|
||||
HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* RTC Second functions *****************************************/
|
||||
/** @addtogroup RTCEx_Exported_Functions_Group2
|
||||
* @{
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTCEx_SetSecond_IT(RTC_HandleTypeDef *hrtc);
|
||||
HAL_StatusTypeDef HAL_RTCEx_DeactivateSecond(RTC_HandleTypeDef *hrtc);
|
||||
void HAL_RTCEx_RTCIRQHandler(RTC_HandleTypeDef *hrtc);
|
||||
void HAL_RTCEx_RTCEventCallback(RTC_HandleTypeDef *hrtc);
|
||||
void HAL_RTCEx_RTCEventErrorCallback(RTC_HandleTypeDef *hrtc);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Extension Control functions ************************************************/
|
||||
/** @addtogroup RTCEx_Exported_Functions_Group3
|
||||
* @{
|
||||
*/
|
||||
void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data);
|
||||
uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister);
|
||||
|
||||
HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmouthCalibMinusPulsesValue);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32F1xx_HAL_RTC_EX_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
1003
Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rtc.h
Normal file
1003
Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rtc.h
Normal file
File diff suppressed because it is too large
Load Diff
1949
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.c
Normal file
1949
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.c
Normal file
File diff suppressed because it is too large
Load Diff
579
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.c
Normal file
579
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.c
Normal file
@@ -0,0 +1,579 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f1xx_hal_rtc_ex.c
|
||||
* @author MCD Application Team
|
||||
* @brief Extended RTC HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the Real Time Clock (RTC) Extension peripheral:
|
||||
* + RTC Tamper functions
|
||||
* + Extension Control functions
|
||||
* + Extension RTC features functions
|
||||
*
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2016 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f1xx_hal.h"
|
||||
|
||||
/** @addtogroup STM32F1xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef HAL_RTC_MODULE_ENABLED
|
||||
|
||||
/** @defgroup RTCEx RTCEx
|
||||
* @brief RTC Extended HAL module driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/** @defgroup RTCEx_Private_Macros RTCEx Private Macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
/** @defgroup RTCEx_Exported_Functions RTCEx Exported Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup RTCEx_Exported_Functions_Group1 RTC Tamper functions
|
||||
* @brief RTC Tamper functions
|
||||
*
|
||||
@verbatim
|
||||
===============================================================================
|
||||
##### RTC Tamper functions #####
|
||||
===============================================================================
|
||||
|
||||
[..] This section provides functions allowing to configure Tamper feature
|
||||
|
||||
@endverbatim
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Sets Tamper
|
||||
* @note By calling this API we disable the tamper interrupt for all tampers.
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param sTamper: Pointer to Tamper Structure.
|
||||
* @note Tamper can be enabled only if ASOE and CCO bit are reset
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef *sTamper)
|
||||
{
|
||||
/* Check input parameters */
|
||||
if ((hrtc == NULL) || (sTamper == NULL))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_RTC_TAMPER(sTamper->Tamper));
|
||||
assert_param(IS_RTC_TAMPER_TRIGGER(sTamper->Trigger));
|
||||
|
||||
/* Process Locked */
|
||||
__HAL_LOCK(hrtc);
|
||||
|
||||
hrtc->State = HAL_RTC_STATE_BUSY;
|
||||
|
||||
if (HAL_IS_BIT_SET(BKP->RTCCR, (BKP_RTCCR_CCO | BKP_RTCCR_ASOE)))
|
||||
{
|
||||
hrtc->State = HAL_RTC_STATE_ERROR;
|
||||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(hrtc);
|
||||
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
||||
MODIFY_REG(BKP->CR, (BKP_CR_TPE | BKP_CR_TPAL), (sTamper->Tamper | (sTamper->Trigger)));
|
||||
|
||||
hrtc->State = HAL_RTC_STATE_READY;
|
||||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(hrtc);
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets Tamper with interrupt.
|
||||
* @note By calling this API we force the tamper interrupt for all tampers.
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param sTamper: Pointer to RTC Tamper.
|
||||
* @note Tamper can be enabled only if ASOE and CCO bit are reset
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef *sTamper)
|
||||
{
|
||||
/* Check input parameters */
|
||||
if ((hrtc == NULL) || (sTamper == NULL))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_RTC_TAMPER(sTamper->Tamper));
|
||||
assert_param(IS_RTC_TAMPER_TRIGGER(sTamper->Trigger));
|
||||
|
||||
/* Process Locked */
|
||||
__HAL_LOCK(hrtc);
|
||||
|
||||
hrtc->State = HAL_RTC_STATE_BUSY;
|
||||
|
||||
if (HAL_IS_BIT_SET(BKP->RTCCR, (BKP_RTCCR_CCO | BKP_RTCCR_ASOE)))
|
||||
{
|
||||
hrtc->State = HAL_RTC_STATE_ERROR;
|
||||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(hrtc);
|
||||
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
||||
MODIFY_REG(BKP->CR, (BKP_CR_TPE | BKP_CR_TPAL), (sTamper->Tamper | (sTamper->Trigger)));
|
||||
|
||||
/* Configure the Tamper Interrupt in the BKP->CSR */
|
||||
__HAL_RTC_TAMPER_ENABLE_IT(hrtc, RTC_IT_TAMP1);
|
||||
|
||||
hrtc->State = HAL_RTC_STATE_READY;
|
||||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(hrtc);
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Deactivates Tamper.
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param Tamper: Selected tamper pin.
|
||||
* This parameter can be a value of @ref RTCEx_Tamper_Pins_Definitions
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper)
|
||||
{
|
||||
/* Check input parameters */
|
||||
if (hrtc == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
UNUSED(Tamper);
|
||||
|
||||
assert_param(IS_RTC_TAMPER(Tamper));
|
||||
|
||||
/* Process Locked */
|
||||
__HAL_LOCK(hrtc);
|
||||
|
||||
hrtc->State = HAL_RTC_STATE_BUSY;
|
||||
|
||||
/* Disable the selected Tamper pin */
|
||||
CLEAR_BIT(BKP->CR, BKP_CR_TPE);
|
||||
|
||||
/* Disable the Tamper Interrupt in the BKP->CSR */
|
||||
/* Configure the Tamper Interrupt in the BKP->CSR */
|
||||
__HAL_RTC_TAMPER_DISABLE_IT(hrtc, RTC_IT_TAMP1);
|
||||
|
||||
/* Clear the Tamper interrupt pending bit */
|
||||
__HAL_RTC_TAMPER_CLEAR_FLAG(hrtc, RTC_FLAG_TAMP1F);
|
||||
SET_BIT(BKP->CSR, BKP_CSR_CTE);
|
||||
|
||||
hrtc->State = HAL_RTC_STATE_READY;
|
||||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(hrtc);
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Tamper interrupt request.
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_RTCEx_TamperIRQHandler(RTC_HandleTypeDef *hrtc)
|
||||
{
|
||||
/* Get the status of the Interrupt */
|
||||
if (__HAL_RTC_TAMPER_GET_IT_SOURCE(hrtc, RTC_IT_TAMP1))
|
||||
{
|
||||
/* Get the TAMPER Interrupt enable bit and pending bit */
|
||||
if (__HAL_RTC_TAMPER_GET_FLAG(hrtc, RTC_FLAG_TAMP1F) != (uint32_t)RESET)
|
||||
{
|
||||
/* Tamper callback */
|
||||
#if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
|
||||
hrtc->Tamper1EventCallback(hrtc);
|
||||
#else
|
||||
HAL_RTCEx_Tamper1EventCallback(hrtc);
|
||||
#endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
|
||||
|
||||
/* Clear the Tamper interrupt pending bit */
|
||||
__HAL_RTC_TAMPER_CLEAR_FLAG(hrtc, RTC_FLAG_TAMP1F);
|
||||
}
|
||||
}
|
||||
|
||||
/* Change RTC state */
|
||||
hrtc->State = HAL_RTC_STATE_READY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Tamper 1 callback.
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval None
|
||||
*/
|
||||
__weak void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc)
|
||||
{
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
UNUSED(hrtc);
|
||||
/* NOTE : This function Should not be modified, when the callback is needed,
|
||||
the HAL_RTCEx_Tamper1EventCallback could be implemented in the user file
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Tamper1 Polling.
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param Timeout: Timeout duration
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout)
|
||||
{
|
||||
uint32_t tickstart = HAL_GetTick();
|
||||
|
||||
/* Check input parameters */
|
||||
if (hrtc == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
||||
/* Get the status of the Interrupt */
|
||||
while (__HAL_RTC_TAMPER_GET_FLAG(hrtc, RTC_FLAG_TAMP1F) == RESET)
|
||||
{
|
||||
if (Timeout != HAL_MAX_DELAY)
|
||||
{
|
||||
if ((Timeout == 0U) || ((HAL_GetTick() - tickstart) > Timeout))
|
||||
{
|
||||
hrtc->State = HAL_RTC_STATE_TIMEOUT;
|
||||
return HAL_TIMEOUT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear the Tamper Flag */
|
||||
__HAL_RTC_TAMPER_CLEAR_FLAG(hrtc, RTC_FLAG_TAMP1F);
|
||||
|
||||
/* Change RTC state */
|
||||
hrtc->State = HAL_RTC_STATE_READY;
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup RTCEx_Exported_Functions_Group2 RTC Second functions
|
||||
* @brief RTC Second functions
|
||||
*
|
||||
@verbatim
|
||||
===============================================================================
|
||||
##### RTC Second functions #####
|
||||
===============================================================================
|
||||
|
||||
[..] This section provides functions implementing second interupt handlers
|
||||
|
||||
@endverbatim
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Sets Interrupt for second
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTCEx_SetSecond_IT(RTC_HandleTypeDef *hrtc)
|
||||
{
|
||||
/* Check input parameters */
|
||||
if (hrtc == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
||||
/* Process Locked */
|
||||
__HAL_LOCK(hrtc);
|
||||
|
||||
hrtc->State = HAL_RTC_STATE_BUSY;
|
||||
|
||||
/* Enable Second interuption */
|
||||
__HAL_RTC_SECOND_ENABLE_IT(hrtc, RTC_IT_SEC);
|
||||
|
||||
hrtc->State = HAL_RTC_STATE_READY;
|
||||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(hrtc);
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Deactivates Second.
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTCEx_DeactivateSecond(RTC_HandleTypeDef *hrtc)
|
||||
{
|
||||
/* Check input parameters */
|
||||
if (hrtc == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
||||
/* Process Locked */
|
||||
__HAL_LOCK(hrtc);
|
||||
|
||||
hrtc->State = HAL_RTC_STATE_BUSY;
|
||||
|
||||
/* Deactivate Second interuption*/
|
||||
__HAL_RTC_SECOND_DISABLE_IT(hrtc, RTC_IT_SEC);
|
||||
|
||||
hrtc->State = HAL_RTC_STATE_READY;
|
||||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(hrtc);
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles second interrupt request.
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_RTCEx_RTCIRQHandler(RTC_HandleTypeDef *hrtc)
|
||||
{
|
||||
if (__HAL_RTC_SECOND_GET_IT_SOURCE(hrtc, RTC_IT_SEC))
|
||||
{
|
||||
/* Get the status of the Interrupt */
|
||||
if (__HAL_RTC_SECOND_GET_FLAG(hrtc, RTC_FLAG_SEC))
|
||||
{
|
||||
/* Check if Overrun occurred */
|
||||
if (__HAL_RTC_SECOND_GET_FLAG(hrtc, RTC_FLAG_OW))
|
||||
{
|
||||
/* Second error callback */
|
||||
HAL_RTCEx_RTCEventErrorCallback(hrtc);
|
||||
|
||||
/* Clear flag Second */
|
||||
__HAL_RTC_OVERFLOW_CLEAR_FLAG(hrtc, RTC_FLAG_OW);
|
||||
|
||||
/* Change RTC state */
|
||||
hrtc->State = HAL_RTC_STATE_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Second callback */
|
||||
HAL_RTCEx_RTCEventCallback(hrtc);
|
||||
|
||||
/* Change RTC state */
|
||||
hrtc->State = HAL_RTC_STATE_READY;
|
||||
}
|
||||
|
||||
/* Clear flag Second */
|
||||
__HAL_RTC_SECOND_CLEAR_FLAG(hrtc, RTC_FLAG_SEC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Second event callback.
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval None
|
||||
*/
|
||||
__weak void HAL_RTCEx_RTCEventCallback(RTC_HandleTypeDef *hrtc)
|
||||
{
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
UNUSED(hrtc);
|
||||
/* NOTE : This function Should not be modified, when the callback is needed,
|
||||
the HAL_RTCEx_RTCEventCallback could be implemented in the user file
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Second event error callback.
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval None
|
||||
*/
|
||||
__weak void HAL_RTCEx_RTCEventErrorCallback(RTC_HandleTypeDef *hrtc)
|
||||
{
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
UNUSED(hrtc);
|
||||
/* NOTE : This function Should not be modified, when the callback is needed,
|
||||
the HAL_RTCEx_RTCEventErrorCallback could be implemented in the user file
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup RTCEx_Exported_Functions_Group3 Extended Peripheral Control functions
|
||||
* @brief Extended Peripheral Control functions
|
||||
*
|
||||
@verbatim
|
||||
===============================================================================
|
||||
##### Extension Peripheral Control functions #####
|
||||
===============================================================================
|
||||
[..]
|
||||
This subsection provides functions allowing to
|
||||
(+) Writes a data in a specified RTC Backup data register
|
||||
(+) Read a data in a specified RTC Backup data register
|
||||
(+) Sets the Smooth calibration parameters.
|
||||
|
||||
@endverbatim
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Writes a data in a specified RTC Backup data register.
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param BackupRegister: RTC Backup data Register number.
|
||||
* This parameter can be: RTC_BKP_DRx where x can be from 1 to 10 (or 42) to
|
||||
* specify the register (depending devices).
|
||||
* @param Data: Data to be written in the specified RTC Backup data register.
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data)
|
||||
{
|
||||
uint32_t tmp = 0U;
|
||||
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
UNUSED(hrtc);
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_RTC_BKP(BackupRegister));
|
||||
|
||||
tmp = (uint32_t)BKP_BASE;
|
||||
tmp += (BackupRegister * 4U);
|
||||
|
||||
*(__IO uint32_t *) tmp = (Data & BKP_DR1_D);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads data from the specified RTC Backup data Register.
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param BackupRegister: RTC Backup data Register number.
|
||||
* This parameter can be: RTC_BKP_DRx where x can be from 1 to 10 (or 42) to
|
||||
* specify the register (depending devices).
|
||||
* @retval Read value
|
||||
*/
|
||||
uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister)
|
||||
{
|
||||
uint32_t backupregister = 0U;
|
||||
uint32_t pvalue = 0U;
|
||||
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
UNUSED(hrtc);
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_RTC_BKP(BackupRegister));
|
||||
|
||||
backupregister = (uint32_t)BKP_BASE;
|
||||
backupregister += (BackupRegister * 4U);
|
||||
|
||||
pvalue = (*(__IO uint32_t *)(backupregister)) & BKP_DR1_D;
|
||||
|
||||
/* Read the specified register */
|
||||
return pvalue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Sets the Smooth calibration parameters.
|
||||
* @param hrtc: RTC handle
|
||||
* @param SmoothCalibPeriod: Not used (only present for compatibility with another families)
|
||||
* @param SmoothCalibPlusPulses: Not used (only present for compatibility with another families)
|
||||
* @param SmouthCalibMinusPulsesValue: specifies the RTC Clock Calibration value.
|
||||
* This parameter must be a number between 0 and 0x7F.
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmouthCalibMinusPulsesValue)
|
||||
{
|
||||
/* Check input parameters */
|
||||
if (hrtc == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
/* Prevent unused argument(s) compilation warning */
|
||||
UNUSED(SmoothCalibPeriod);
|
||||
UNUSED(SmoothCalibPlusPulses);
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_RTC_SMOOTH_CALIB_MINUS(SmouthCalibMinusPulsesValue));
|
||||
|
||||
/* Process Locked */
|
||||
__HAL_LOCK(hrtc);
|
||||
|
||||
hrtc->State = HAL_RTC_STATE_BUSY;
|
||||
|
||||
/* Sets RTC Clock Calibration value.*/
|
||||
MODIFY_REG(BKP->RTCCR, BKP_RTCCR_CAL, SmouthCalibMinusPulsesValue);
|
||||
|
||||
/* Change RTC state */
|
||||
hrtc->State = HAL_RTC_STATE_READY;
|
||||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(hrtc);
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* HAL_RTC_MODULE_ENABLED */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
||||
@@ -25,7 +25,8 @@ CAN2.BS2=CAN_BS2_2TQ
|
||||
CAN2.CalculateBaudRate=125000
|
||||
CAN2.CalculateTimeBit=8000
|
||||
CAN2.CalculateTimeQuantum=444.44444444444446
|
||||
CAN2.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,Prescaler,BS1,BS2,ABOM,AWUM,TXFP
|
||||
CAN2.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,Prescaler,BS1,BS2,ABOM,AWUM,TXFP,NART
|
||||
CAN2.NART=ENABLE
|
||||
CAN2.Prescaler=16
|
||||
CAN2.TXFP=ENABLE
|
||||
File.Version=6
|
||||
@@ -38,9 +39,10 @@ Mcu.IP1=CAN1
|
||||
Mcu.IP2=CAN2
|
||||
Mcu.IP3=NVIC
|
||||
Mcu.IP4=RCC
|
||||
Mcu.IP5=SYS
|
||||
Mcu.IP6=USART2
|
||||
Mcu.IPNb=7
|
||||
Mcu.IP5=RTC
|
||||
Mcu.IP6=SYS
|
||||
Mcu.IP7=USART2
|
||||
Mcu.IPNb=8
|
||||
Mcu.Name=STM32F107V(B-C)Tx
|
||||
Mcu.Package=LQFP100
|
||||
Mcu.Pin0=PC14-OSC32_IN
|
||||
@@ -59,6 +61,7 @@ Mcu.Pin2=OSC_IN
|
||||
Mcu.Pin20=PB4
|
||||
Mcu.Pin21=PB5
|
||||
Mcu.Pin22=PB6
|
||||
Mcu.Pin23=VP_RTC_VS_RTC_Activate
|
||||
Mcu.Pin3=OSC_OUT
|
||||
Mcu.Pin4=PA6
|
||||
Mcu.Pin5=PC4
|
||||
@@ -66,7 +69,7 @@ Mcu.Pin6=PC5
|
||||
Mcu.Pin7=PB0
|
||||
Mcu.Pin8=PB1
|
||||
Mcu.Pin9=PE9
|
||||
Mcu.PinsNb=23
|
||||
Mcu.PinsNb=24
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32F107VCTx
|
||||
@@ -192,7 +195,7 @@ ProjectManager.StackSize=0x400
|
||||
ProjectManager.TargetToolchain=STM32CubeIDE
|
||||
ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UnderRoot=true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_ADC1_Init-ADC1-false-HAL-true,4-MX_CAN1_Init-CAN1-false-HAL-true,5-MX_CAN2_Init-CAN2-false-HAL-true,6-MX_USART2_UART_Init-USART2-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_ADC1_Init-ADC1-false-HAL-true,4-MX_CAN1_Init-CAN1-false-HAL-true,5-MX_CAN2_Init-CAN2-false-HAL-true,6-MX_USART2_UART_Init-USART2-false-HAL-true,7-MX_USART1_UART_Init-USART1-false-HAL-true,8-MX_RTC_Init-RTC-false-HAL-true
|
||||
RCC.ADCFreqValue=12000000
|
||||
RCC.ADCPresc=RCC_ADCPCLK2_DIV6
|
||||
RCC.AHBFreq_Value=72000000
|
||||
@@ -208,7 +211,7 @@ RCC.HSEDivPLL=RCC_HSE_PREDIV_DIV5
|
||||
RCC.HSE_VALUE=25000000
|
||||
RCC.I2S2Freq_Value=72000000
|
||||
RCC.I2S3Freq_Value=72000000
|
||||
RCC.IPParameters=ADCFreqValue,ADCPresc,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSEDivPLL,HSE_VALUE,I2S2Freq_Value,I2S3Freq_Value,MCOFreq_Value,PLL2CLKoutputFreqValue,PLL2VCOoutputFreqValue,PLL3CLKoutputFreqValue,PLL3VCOoutputFreqValue,PLLCLKFreq_Value,PLLMUL,PLLSourceVirtual,Prediv1Source,Prediv2,Prediv2FreqValue,SYSCLKFreq_VALUE,SYSCLKSource,TimSysFreq_Value,USBFreq_Value,VCOOutput2Freq_Value
|
||||
RCC.IPParameters=ADCFreqValue,ADCPresc,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSEDivPLL,HSE_VALUE,I2S2Freq_Value,I2S3Freq_Value,MCOFreq_Value,PLL2CLKoutputFreqValue,PLL2VCOoutputFreqValue,PLL3CLKoutputFreqValue,PLL3VCOoutputFreqValue,PLLCLKFreq_Value,PLLMUL,PLLSourceVirtual,Prediv1Source,Prediv2,Prediv2FreqValue,RTCClockSelection,RTCFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,TimSysFreq_Value,USBFreq_Value,VCOOutput2Freq_Value
|
||||
RCC.MCOFreq_Value=72000000
|
||||
RCC.PLL2CLKoutputFreqValue=40000000
|
||||
RCC.PLL2VCOoutputFreqValue=80000000
|
||||
@@ -220,6 +223,8 @@ RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE
|
||||
RCC.Prediv1Source=RCC_PREDIV1_SOURCE_PLL2
|
||||
RCC.Prediv2=RCC_HSE_PREDIV2_DIV5
|
||||
RCC.Prediv2FreqValue=5000000
|
||||
RCC.RTCClockSelection=RCC_RTCCLKSOURCE_LSE
|
||||
RCC.RTCFreq_Value=32768
|
||||
RCC.SYSCLKFreq_VALUE=72000000
|
||||
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
|
||||
RCC.TimSysFreq_Value=72000000
|
||||
@@ -233,5 +238,7 @@ SH.ADCx_IN9.0=ADC1_IN9,IN9
|
||||
SH.ADCx_IN9.ConfNb=1
|
||||
USART2.IPParameters=VirtualMode
|
||||
USART2.VirtualMode=VM_ASYNC
|
||||
VP_RTC_VS_RTC_Activate.Mode=RTC_Enabled
|
||||
VP_RTC_VS_RTC_Activate.Signal=RTC_VS_RTC_Activate
|
||||
board=custom
|
||||
isbadioc=false
|
||||
|
||||
Reference in New Issue
Block a user