Refactor split main.c
This commit is contained in:
34
Inc/app_state.h
Normal file
34
Inc/app_state.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef __APP_STATE_H
|
||||
#define __APP_STATE_H
|
||||
|
||||
#include "main.h"
|
||||
#include "fatfs.h" /*для типа FRESULT*/
|
||||
|
||||
/* HAL-хендлы (определены в main.c) */
|
||||
extern ADC_HandleTypeDef hadc1;
|
||||
extern ADC_HandleTypeDef hadc3;
|
||||
extern SD_HandleTypeDef hsd1;
|
||||
extern TIM_HandleTypeDef htim4;
|
||||
extern TIM_HandleTypeDef htim8;
|
||||
extern TIM_HandleTypeDef htim10;
|
||||
extern TIM_HandleTypeDef htim11;
|
||||
extern UART_HandleTypeDef huart8;
|
||||
|
||||
/* Разделяемое состояние приложения (определено в main.c, секция USER CODE PV) */
|
||||
extern uint32_t TO6, TO6_before, TO6_stop, TO6_uart, SD_SEEK, SD_SLIDE, temp32,
|
||||
TO7, TO7_before, TO7_PID, TO10, TO10_counter, TIM10_period;
|
||||
extern uint8_t uart_buf, CPU_state, CPU_state_old, UART_transmission_request,
|
||||
State_Data[2], UART_DATA[DL_8], flg_tmt, u_tx_flg, u_rx_flg, TIM10_coflag;
|
||||
extern uint16_t UART_rec_incr, UART_header, CS_result, temp16,
|
||||
Long_Data[DL_16], COMMAND[CL_16];
|
||||
extern FRESULT fresult;
|
||||
extern int test;
|
||||
extern unsigned long fgoto, sizeoffile;
|
||||
|
||||
extern LDx_SetupTypeDef LD1_curr_setup, LD2_curr_setup, LD1_def_setup, LD2_def_setup;
|
||||
extern Work_SetupTypeDef Curr_setup, Def_setup;
|
||||
extern LDx_ParamTypeDef LD1_param, LD2_param;
|
||||
extern LD_Blinker_StateTypeDef LD_blinker;
|
||||
extern task_t task;
|
||||
|
||||
#endif /* __APP_STATE_H */
|
||||
13
Inc/laser_hw.h
Normal file
13
Inc/laser_hw.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef __LASER_HW_H
|
||||
#define __LASER_HW_H
|
||||
|
||||
#include "main.h"
|
||||
|
||||
/* Set_LTEC() объявлена в main.h (USER CODE EFP) — оставляем там,
|
||||
чтобы её видели и main.c, и it.c, и protocol.c без правок. */
|
||||
|
||||
uint16_t MPhD_T(uint8_t num);
|
||||
uint16_t Get_ADC(uint8_t num);
|
||||
void OUT_trigger(uint8_t out_n);
|
||||
|
||||
#endif /* __LASER_HW_H */
|
||||
10
Inc/modulation.h
Normal file
10
Inc/modulation.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef __MODULATION_H
|
||||
#define __MODULATION_H
|
||||
|
||||
#include "main.h"
|
||||
|
||||
void Stop_TIM10(void);
|
||||
void Sweep_RunCurrent1(void); /* тело case TT_CHANGE_CURR_1 */
|
||||
void Blink_RunCurrent2(void); /* тело case TT_CHANGE_CURR_2 */
|
||||
|
||||
#endif /* __MODULATION_H */
|
||||
13
Inc/protocol.h
Normal file
13
Inc/protocol.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef __PROTOCOL_H
|
||||
#define __PROTOCOL_H
|
||||
|
||||
#include "main.h"
|
||||
|
||||
void Decode_uart(uint16_t *Command, LDx_SetupTypeDef *LD1_curr_setup, LDx_SetupTypeDef *LD2_curr_setup, Work_SetupTypeDef *Curr_setup);
|
||||
void Decode_task(uint16_t *Command, LDx_SetupTypeDef *LD1_curr_setup, LDx_SetupTypeDef *LD2_curr_setup, Work_SetupTypeDef *Curr_setup);
|
||||
uint8_t CheckChecksum(uint16_t *pbuff);
|
||||
uint16_t CalculateChecksum(uint16_t *pbuff, uint16_t len);
|
||||
void USART_TX(uint8_t* dt, uint16_t sz);
|
||||
void USART_TX_DMA(uint16_t sz);
|
||||
|
||||
#endif /* __PROTOCOL_H */
|
||||
10
Inc/storage.h
Normal file
10
Inc/storage.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef __STORAGE_H
|
||||
#define __STORAGE_H
|
||||
|
||||
#include "main.h"
|
||||
|
||||
int SD_SAVE(uint16_t *pbuff);
|
||||
int SD_READ(uint16_t *pbuff);
|
||||
int SD_REMOVE(void);
|
||||
|
||||
#endif /* __STORAGE_H */
|
||||
9
Inc/temp_control.h
Normal file
9
Inc/temp_control.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef __TEMP_CONTROL_H
|
||||
#define __TEMP_CONTROL_H
|
||||
|
||||
#include "main.h"
|
||||
|
||||
uint16_t PID_Controller_Temp(LDx_SetupTypeDef * LDx_curr_setup, LDx_ParamTypeDef * LDx_results, uint8_t num);
|
||||
uint16_t Advanced_Controller_Temp(LDx_SetupTypeDef * LDx_curr_setup, LDx_ParamTypeDef * LDx_results, uint8_t num);
|
||||
|
||||
#endif /* __TEMP_CONTROL_H */
|
||||
Reference in New Issue
Block a user