#include "DSP281x_Device.h"

#include "edrk_main.h"
#include "vector.h"
#include "vector_control.h"

#include "xp_project.h"
#include "xp_write_xpwm_time.h"
#include "edrk_main.h"
#include "vector.h"
#include "vector_control.h"

T_project project = {0};


WINDING a;
EDRK edrk = EDRK_DEFAULT;
FLAG f = FLAG_DEFAULTS;


void project_read_all_pbus2()
{

}

#pragma DATA_SECTION(break_result_1,".fast_vars");
_iq break_result_1 = 0;

#pragma DATA_SECTION(break_result_2,".fast_vars");
_iq break_result_2 = 0;

#pragma DATA_SECTION(break_result_3,".fast_vars");
_iq break_result_3 = 0;

#pragma DATA_SECTION(break_result_4,".fast_vars");
_iq break_result_4 = 0;

//void read_in_sensor_line1(T_cds_in_rotation_sensor *rs){
//
//}
//
//void read_in_sensor_line2(T_cds_in_rotation_sensor *rs){
//
//}
//void read_command_reg(T_cds_in_rotation_sensor *rs){
//
//}
//void write_command_reg(T_cds_in_rotation_sensor *rs){
//
//}
//void tune_sampling_time(T_rotation_sensor *rs){
//
//}
//void wait_for_registers_updated(T_cds_in_rotation_sensor *rs){
//
//}
//void read_direction_in_plane(T_cds_in_rotation_sensor *rs){
//
//}
//void sensor_set(T_rotation_sensor *rs)
//{
//
//}
//void sensor_read(T_rotation_sensor *rs)
//{
//
//}
//void update_sensors_data(T_rotation_sensor *rs)
//{
// //   rs->in_plane.write.regs.comand_reg.bit.update_registers = 1;
// //   write_command_reg(&rs->in_plane);
////    rs->in_plane.write.regs.comand_reg.bit.update_registers = 0;
//}
//void angle_sensor_read(T_cds_angle_sensor *as)
//{}
//
//void angle_plane_set(T_cds_angle_sensor *rs)
//{}
//void in_plane_set(T_cds_in_rotation_sensor* rs)
//{}
//
//void in_sensor_read1(T_cds_in_rotation_sensor *rs)
//{}
//
//void in_sensor_read2(T_cds_in_rotation_sensor *rs)
//{}




// unsigned int BWC_Started()
// {

// }

void inc_RS_timeout_cicle(void)
{

}

void inc_CAN_timeout_cicle(void)
{

}

void pause_1000(void)
{

}

int xerror(unsigned int er_ID, void* CallBackRef)
{
};
unsigned int ReadMemory(unsigned long addr)
{
   //return (*(volatile int *)(addr));
    return 0;
}


void WriteMemory(unsigned long addr, unsigned int data)
{
   //(*(volatile int *)( addr )) = data;
}



void start_pwm(void)
{
	// mPWM_a = 1;
	// mPWM_b = 1;
}

void stop_pwm(void)    
{
	// mPWM_a = 0;
	// mPWM_b = 0;

	// svgen_set_time_keys_closed(&svgen_pwm24_1);
	// svgen_set_time_keys_closed(&svgen_pwm24_2);
	// WriteMemory(ADR_TK_MASK_0, 0xFFFF);
	// WriteMemory(ADR_PWM_START_STOP, 0x8000);
}
void start_break_pwm() {

}


void stop_break_pwm() {

}

void stop_wdog() {

}

void start_pwm_b() {

}
void start_pwm_a() {

}
void stop_pwm_b() {

}
void stop_pwm_a() {

}

void fillADClogs() {

}
void break_resistor_managment_calc(){

}


void break_resistor_managment_init(){

}


void break_resistor_managment_update(){

}


void break_resistor_recup_calc(){

}


void break_resistor_set_closed(){

}


void DetectI_Out_BreakFase(){

}


void test_mem_limit(){

}


void set_start_mem(){

}


void getFastLogs(){

}


//void detect_I_M_overload{
//
// }


void sync_inc_error(){

}


void optical_bus_read(){

}


void optical_bus_write(void){

}


void init_flag_a(void)
{

    unsigned int i = 0;
    int *pStr = (int*)&f;
    for (i = 0; i < sizeof(f) / sizeof(int); i++) {
        *(pStr + i) = 0;
    }

    *pStr = (int*)&a;
    for (i = 0; i < sizeof(a) / sizeof(int); i++) {
        *(pStr + i) = 0;
    }


}
