matlab_23550/Inu/Src2/N12_Libs/oscil_can.h

104 lines
3.4 KiB
C
Raw Normal View History

/*
* oscil_can.h
*
* Created on: 24 <EFBFBD><EFBFBD><EFBFBD> 2020 <EFBFBD>.
* Author: yura
*/
#ifndef SRC_LIBS_NIO12_OSCIL_CAN_H_
#define SRC_LIBS_NIO12_OSCIL_CAN_H_
#define OSCIL_CODE_STATUS_LOG_STOP 1 // <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define OSCIL_CODE_STATUS_LOG_RUN 2 // <20><><EFBFBD> <20><><EFBFBD><EFBFBD>...
#define OSCIL_CODE_STATUS_LOG_RUN_TO_STOP 3 // <20><><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
#define OSCIL_CAN_NUMBER_CHANNEL 32 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>-<2D><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define OSCIL_CAN_NUMBER_POINTS 500 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>-<2D><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
#define OSCIL_TIME_WAIT 5000 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> CAN (<28><><EFBFBD><EFBFBD><EFBFBD>)
#define OSCIL_CAN_NUMBER_POINTS_ADD 100 // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. oscil_buffer->temp_oscil_buffer
#define OSCIL_CAN_NUMBER_POINTS_AFTER_STOP 100 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>
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; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0-<2D><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/1- <20><><EFBFBD><EFBFBD>
unsigned int status_pwm; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> 0-<2D><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/1-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned int stop_update_on_error; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned int stop_update_on_stop_pwm; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
int number_can_box_terminal_oscil;
int number_can_box_terminal_cmd;
unsigned int pause_can; // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 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_ */