/*
 * e_phi.h
 *
 *  Created on: 11-02-2017
 *      Author: Krzysztof Jakubczyk
 */

#ifndef E_PHI_H_
#define E_PHI_H_

#include "tdefs.h"

struct e_phi_logic
{
	float *orta_a;
	float *ortb_a;

	float *orta_b;
	float *ortb_b;

	float *phi;
};

struct e_phi_io
{
	u32 orta_a_float_in;
	u32 ortb_a_float_in;
	u32 orta_b_float_in;
	u32 ortb_b_float_in;
	u32 phi_float_out;
}__attribute__((__packed__));

struct e_phi_params
{
}__attribute__((__packed__));

struct e_phi_args
{
	struct e_phi_io io;
	struct e_phi_params params;
//	u16 crc;
}__attribute__((__packed__));

extern int e_phi_initlog(void *arguments, void *logic);
extern void e_phi_20hz(void *arguments, void *logic);

extern float get_phase(float cos, float sin);
extern float get_phase_diff(float phi1, float phi2);

#endif /* E_PHI_H_ */
