mirror of
https://git.etud.insa-toulouse.fr/boujon/voilier-team-1.git
synced 2025-06-08 16:00:49 +02:00
Finishing the Rtc function
This commit is contained in:
parent
355f050ddd
commit
5ec32ced3e
4 changed files with 89 additions and 8 deletions
|
@ -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;
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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){};
|
||||
}
|
||||
|
|
|
@ -442,7 +442,72 @@
|
|||
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM))</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Breakpoint>
|
||||
<Bp>
|
||||
<Number>0</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>24</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>134219864</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename>C:\Users\alixc\Desktop\Scolarité\INSA\Cours\Microcontroleur\voilier-team-1\implementation\rtc.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>\\cool_reel\../implementation/rtc.c\24</Expression>
|
||||
</Bp>
|
||||
<Bp>
|
||||
<Number>1</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>25</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>134219874</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename>C:\Users\alixc\Desktop\Scolarité\INSA\Cours\Microcontroleur\voilier-team-1\implementation\rtc.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>\\cool_reel\../implementation/rtc.c\25</Expression>
|
||||
</Bp>
|
||||
<Bp>
|
||||
<Number>2</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>16</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>134221212</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename>C:\Users\alixc\Desktop\Scolarité\INSA\Cours\Microcontroleur\voilier-team-1\keilproject\Source\Principale.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>\\cool_reel\Source/Principale.c\16</Expression>
|
||||
</Bp>
|
||||
<Bp>
|
||||
<Number>3</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>23</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>0</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>..\implementation\rtc.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
</Breakpoint>
|
||||
<WatchWindow1>
|
||||
<Ww>
|
||||
<count>0</count>
|
||||
|
|
Loading…
Add table
Reference in a new issue