diff --git a/implementation/rtc.c b/implementation/rtc.c index 1e35d79..86e15b4 100644 --- a/implementation/rtc.c +++ b/implementation/rtc.c @@ -11,14 +11,27 @@ void MyRTC_Init() MyI2C_Init(I2C1, 15, IT_I2C_Err); } -void MyRTC_GetTime() +void MyRTC_GetTime(int* sec, int* min, int* hour, int* day, int* date, int* month, int* year) { MyI2C_RecSendData_Typedef data; char regCopy = 0; - data.SlaveAdress7bits = 0xC8; + data.SlaveAdress7bits = 0x68; data.Ptr_Data = ®Copy; data.Nb_Data = 1; - MyI2C_GetString(I2C1, 0x0, &data); + MyI2C_GetString(I2C1, 0x00, &data); + *sec = ((regCopy >> 4) & 0x07) * 10 + (regCopy & 0x0F); + MyI2C_GetString(I2C1, 0x01, &data); + *min = ((regCopy >> 4) & 0x07) * 10 + (regCopy & 0x0F); + MyI2C_GetString(I2C1, 0x02, &data); + *hour = 0; + MyI2C_GetString(I2C1, 0x03, &data); + *day = (regCopy & 0x07); + MyI2C_GetString(I2C1, 0x04, &data); + *date = ((regCopy >> 4) & 0x03) * 10 + (regCopy & 0x0F); + MyI2C_GetString(I2C1, 0x05, &data); + *month = ((regCopy >> 4) & 0x01) * 10 + (regCopy & 0x0F); + MyI2C_GetString(I2C1, 0x06, &data); + *year = ((regCopy >> 4) & 0xF0) * 10 + (regCopy & 0x0F) + 2000; } \ No newline at end of file diff --git a/implementation/rtc.h b/implementation/rtc.h index 2b4b45e..caaa6ba 100644 --- a/implementation/rtc.h +++ b/implementation/rtc.h @@ -4,6 +4,6 @@ #include "MyI2C.h" void MyRTC_Init(); -void MyRTC_GetTime(); +void MyRTC_GetTime(int* sec, int* min, int* hour, int* day, int* date, int* month, int* year); #endif diff --git a/keilproject/Source/Principale.c b/keilproject/Source/Principale.c index 10d4324..a0cfee4 100644 --- a/keilproject/Source/Principale.c +++ b/keilproject/Source/Principale.c @@ -1,16 +1,19 @@ #include "stm32f10x.h" #include "servo.h" #include "motoreducteur.h" +#include "rtc.h" int main (void) { MyServo_Init(); MyServo_ChangeAngle(179); - MyMotor_Init(); + //MyMotor_Init(); - MyMotor_ChangeSpeed(2000); - MyMotor_ChangeDirection(HORAIRE); + //MyMotor_ChangeSpeed(2000); + //MyMotor_ChangeDirection(HORAIRE); + MyRTC_Init(); + MyRTC_GetTime(); while(1){}; } diff --git a/keilproject/voilier.uvoptx b/keilproject/voilier.uvoptx index 8bffbb5..7292b15 100644 --- a/keilproject/voilier.uvoptx +++ b/keilproject/voilier.uvoptx @@ -442,7 +442,72 @@ UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)) - + + + 0 + 0 + 24 + 1 +
134219864
+ 0 + 0 + 0 + 0 + 0 + 1 + C:\Users\alixc\Desktop\Scolarité\INSA\Cours\Microcontroleur\voilier-team-1\implementation\rtc.c + + \\cool_reel\../implementation/rtc.c\24 +
+ + 1 + 0 + 25 + 1 +
134219874
+ 0 + 0 + 0 + 0 + 0 + 1 + C:\Users\alixc\Desktop\Scolarité\INSA\Cours\Microcontroleur\voilier-team-1\implementation\rtc.c + + \\cool_reel\../implementation/rtc.c\25 +
+ + 2 + 0 + 16 + 1 +
134221212
+ 0 + 0 + 0 + 0 + 0 + 1 + C:\Users\alixc\Desktop\Scolarité\INSA\Cours\Microcontroleur\voilier-team-1\keilproject\Source\Principale.c + + \\cool_reel\Source/Principale.c\16 +
+ + 3 + 0 + 23 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + ..\implementation\rtc.c + + +
+
0