/*
 * PWM.h
 *
 *  Created on: 14 janv. 2019
 *      Author: e_rcluze
 */

#ifndef PWM_H_
#define PWM_H_

#include <RTC.h>
#include "tim.h"
#include "Tab.h"

#define S1 0X00
#define S2 0X01
#define S3 0X02
#define S4 0X03
#define S5 0X04
#define S6 0X05
#define S7 0X06
#define S8 0X07
#define S9 0X08
#define S10 0X09


#define MASKS1 	0b0000000001
#define MASKS2 	0b0000000010
#define MASKS3 	0b0000000100
#define MASKS4 	0b0000001000
#define MASKS5 	0b0000010000
#define MASKS6 	0b0000100000
#define MASKS7 	0b0001000000
#define MASKS8 	0b0010000000
#define MASKS9 	0b0100000000
#define MASKS10	0b1000000000



#define PWM_MAX 31250-1

void GerePWM(uint16_t listeSortie, uint8_t pourcentage);

void PWMSetDutyCycle(uint8_t sortie, uint8_t pourcentage);

void PWMStart(uint8_t sortie);

void PWMStop(uint8_t sortie);

uint16_t PourcentageToValue(uint8_t val);

/*
 * Fonction qui retourne un pourcentage en fonction de l'heure
 */
uint8_t PWMPourcentage(Sortie *s, uint16_t heure);


#endif /* PWM_H_ */
