#include "TestRTC.h"
#include "RTC_ADD.h"
#include "i2c.h"


/*
 * Si sa fonctionne pas regarder le bit HT (bit 6 de l'adresse0x0C
 *
 */

void testRTCLec(){
	uint16_t add= RTCADD;
	uint8_t tab[2];
	tab[0]=SECOND;
	HAL_StatusTypeDef res;

	 res = HAL_I2C_Master_Transmit(&hi2c3,add,tab,1,1000);
	 res = HAL_I2C_Master_Receive(&hi2c3,add,tab,1,1000);
}

void testRTCEcr(){
	uint16_t add= RTCADD;
	uint8_t tab[2];
	tab[0]=SECOND;
	tab[1]=0x42;
	HAL_StatusTypeDef res;

	res = HAL_I2C_Master_Transmit(&hi2c3,add,tab,1,1000);
}

/*
void testshortLong(){
	Date datein;
	char dateout[3];

	datein.second = 20;
	datein.minute = 12;
	datein.heure = 9;
	datein.jour = 12;
	datein.mois =10;
	datein.annee=1992;

	shortDate(&datein,dateout);
	longDate(dateout,&datein);
}

void shortDate(Date *in, char *out){
	out[0]=in->second;
	out[0]=in->minute<<4;
	out[1]=in->heure;
	out[1]=in->jour<<4;
	out[2]=in->mois;
	out[2]=in->annee<<4;
}

void longDate(char *in, Date *out){

	out->second	= in[0]&0x0F;
	out->minute	= in[0]>>4;
	out->heure	= in[1]&0x0F;
	out->jour	= in[1]>>4;
	out->mois	= in[2]&0x0F;
	out->annee	= in[2]>>4;
}*/
