Razvalyaev
7e0063eee0
Все основные файлы подтянуты без изменений Изменены (только папка main_matlab): - заглушки для ненужных функций (main_matlab.c) - iq библиотека (IQmathLib_matlab.c) - библиотеки DSP281x
104 lines
3.4 KiB
C
104 lines
3.4 KiB
C
/*
|
|
* oscil_can.h
|
|
*
|
|
* Created on: 24 ìàÿ 2020 ã.
|
|
* Author: yura
|
|
*/
|
|
|
|
#ifndef SRC_LIBS_NIO12_OSCIL_CAN_H_
|
|
#define SRC_LIBS_NIO12_OSCIL_CAN_H_
|
|
|
|
|
|
#define OSCIL_CODE_STATUS_LOG_STOP 1 // Ëîã îñòàíîâëåí
|
|
#define OSCIL_CODE_STATUS_LOG_RUN 2 // Ëîã èäåò...
|
|
#define OSCIL_CODE_STATUS_LOG_RUN_TO_STOP 3 // Ëîã èäåò, íî èäåò äîçàïèñü, ñêîðî îñòàíîâèòñÿ.
|
|
|
|
|
|
|
|
#define OSCIL_CAN_NUMBER_CHANNEL 32 // ìàêñèìàëüíîå âîçìîæíîå êîë-âî êàíàëîâ äëÿ áóôåðà
|
|
#define OSCIL_CAN_NUMBER_POINTS 500 // ìàêñèìàëüíîå âîçìîæíîå êîë-âî òî÷åê äëÿ áóôåðà (äëÿ îäíîãî êàíàëà)
|
|
#define OSCIL_TIME_WAIT 5000 // ïåðèîä ïîñûëêè âñåãî ìàññèâà â CAN (ìëñåê)
|
|
#define OSCIL_CAN_NUMBER_POINTS_ADD 100 // çàïàñ òî÷åê ïðè âûïîëíåíèè ôóíêöèè êîïèðîâàíèÿ ðàáî÷åãî áóôåðà âî âðåìåííûé. oscil_buffer->temp_oscil_buffer
|
|
|
|
#define OSCIL_CAN_NUMBER_POINTS_AFTER_STOP 100 // ñêîëüêî òî÷åê çàïèñûâàòü ïîñëå îñòàíîâêè çàïèñè áóôåðà ïî àâàðèè èëè øèìó
|
|
|
|
|
|
|
|
typedef struct {
|
|
int oscil_buffer[OSCIL_CAN_NUMBER_CHANNEL][OSCIL_CAN_NUMBER_POINTS+OSCIL_CAN_NUMBER_POINTS_ADD];
|
|
int temp_oscil_buffer[OSCIL_CAN_NUMBER_CHANNEL][OSCIL_CAN_NUMBER_POINTS];
|
|
unsigned int global_enable;
|
|
unsigned int number_ch;
|
|
unsigned int number_points;
|
|
unsigned int step;
|
|
unsigned int send_after_cmd;
|
|
unsigned int cmd_send;
|
|
unsigned int current_step;
|
|
unsigned int enable_rewrite;
|
|
unsigned int current_position;
|
|
unsigned int timer_send;
|
|
unsigned int code_status_log;
|
|
|
|
unsigned int status_error; // ñòàòóñ àâàðèè 0-íåò àâàðèè/1- åñòü
|
|
unsigned int status_pwm; // ñòàòóñ ØÈÌà 0-Øèì íå çàïóùåí/1-çàïóùåí
|
|
|
|
unsigned int stop_update_on_error; // îñòàíîâèì îáíîâëåíèå áóôåðà ïî àâàðèè
|
|
unsigned int stop_update_on_stop_pwm; // îñòàíîâèì îáíîâëåíèå áóôåðà ïî ñòîïó ØÈÌà
|
|
|
|
|
|
int number_can_box_terminal_oscil;
|
|
int number_can_box_terminal_cmd;
|
|
unsigned int pause_can; // ïàóçà ìåæäó ïîñûëêàìè CAN
|
|
|
|
|
|
void (*clear)(); // Clear buffers
|
|
void (*send)(); // Send buffers
|
|
void (*set_next_position)(); // Set next position in buffers
|
|
void (*prepare_data_can)(); // Set next position in buffers
|
|
|
|
} OSCIL_CAN;
|
|
|
|
typedef OSCIL_CAN *OSCIL_CAN_handle;
|
|
|
|
|
|
|
|
#define OSCIL_CAN_DEFAULTS { {0},{0}, \
|
|
0, \
|
|
OSCIL_CAN_NUMBER_CHANNEL, \
|
|
OSCIL_CAN_NUMBER_POINTS, \
|
|
1, \
|
|
0, \
|
|
0, \
|
|
0, \
|
|
1, \
|
|
0, \
|
|
0, \
|
|
0, \
|
|
0, \
|
|
0, \
|
|
1, \
|
|
1, \
|
|
0,0, \
|
|
OSCIL_TIME_WAIT, \
|
|
oscil_clear_buffer, \
|
|
oscil_send_buffer, \
|
|
oscil_next_position, \
|
|
oscil_prepare_data_can \
|
|
}
|
|
|
|
|
|
|
|
|
|
void oscil_clear_buffer(OSCIL_CAN_handle);
|
|
void oscil_send_buffer(OSCIL_CAN_handle);
|
|
void oscil_next_position(OSCIL_CAN_handle);
|
|
void oscil_prepare_data_can(OSCIL_CAN_handle);
|
|
|
|
|
|
|
|
extern OSCIL_CAN oscil_can;
|
|
|
|
#endif /* SRC_LIBS_NIO12_OSCIL_CAN_H_ */
|
|
|
|
|