/*
 * servoPWM.h
 *
 *  Created on: Nov 30, 2017
 *      Author: Harold
 */

#ifndef SRC_SERVOPWM_H_
#define SRC_SERVOPWM_H_


#include <xtmrctr.h> // Xilinx Timer Control Library
#include <xparameters.h>

float Duty_val( float Degree);      //Convert the degree value into Duty Cycle for PWM register

void PWM_Freq_Duty(u32 PWM_ADDRESS, float CLOCK_PERIOD, float Freq, float Duty); //This works
void PWM_START( u32 PWM_ADDRESS);  // This works
void PWM_STOP(u32 PWM_ADDRESS); //This works

#define PWM_X_BASE  XPAR_AXI_TIMER_0_BASEADDR // Base Address
#define PWM_Z_BASE  XPAR_AXI_TIMER_1_BASEADDR // Base Address

#define CLK_PERIOD 1e-8   // AXI Clock Period : (1 / 100Mhz)
#define SERVO_FREQ 20e-3  // Servo PWM frequency 20ms

#endif /* SRC_SERVOPWM_H_ */
