79 #include <stm32f4xx.h>
126 temp = time->
sec % 10;
127 temp |= ((time->
sec / 10) << 4);
133 temp = time->
min % 10;
134 temp |= ((time->
min / 10) << 4);
139 temp = time->
hour % 10;
140 if (time->
hour / 20 > 0) {
144 if (time->
hour / 10 > 0) {
158 temp = time->
day % 10;
159 temp |= ((time->
day / 10) << 4);
164 temp = time->
month % 10;
165 temp |= ((time->
month / 10) << 4);
170 temp = time->
year % 10;
171 temp |= ((time->
year / 10) << 4);
191 time->
year = temp & 0x0F;
192 time->
year += ((temp & 0xF0) >> 4) * 10;
197 time->
month = temp & 0x0F;
198 time->
month += ((temp & 0x10) >> 4) * 10;
203 time->
day = temp & 0x0F;
204 time->
day += ((temp & 0x30) >> 4) * 10;
209 time->
wday = temp & 0x07;
214 time->
hour = temp & 0x0F;
227 time->
min = temp & 0x0F;
228 time->
min += ((temp & 0x70) >> 4) * 10;
233 time->
sec = temp & 0x0F;
234 time->
sec += ((temp & 0x70) >> 4) * 10;
RTC interface. Communication interface to use the RTC from the CARME-M4.
#define CARME_RTC_REG_DAY
void CARME_RTC_Ext_GetTime(CARME_RTC_TIME_t *time)
Get the Time from the external RTC on mainboard.
#define CARME_RTC_REG_CTRL
#define CARME_RTC_REG_YEAR
#define CARME_RTC_I2C_ADDR
ERROR_CODES CARME_I2C_Read(I2C_TypeDef *I2Cx, uint8_t addr, uint16_t reg, uint8_t twoByte, uint8_t *pdata, uint16_t count)
Read data from an I2C slave device on a specific register address.
void CARME_RTC_Ext_SetTime(CARME_RTC_TIME_t *time)
Set the Time of the external RTC on the mainboard.
#define CARME_RTC_REG_MIN
#define CARME_RTC_REG_SEC
#define CARME_RTC_REG_HOUR
void CARME_I2C_Init(I2C_TypeDef *I2Cx)
I2C initialization.
Structure to store a full date and time.
#define CARME_RTC_REG_MONTH
void CARME_RTC_Ext_Init(void)
Initialize the RTC on the CARME mainboard.
ERROR_CODES CARME_I2C_Write(I2C_TypeDef *I2Cx, uint8_t addr, uint16_t reg, uint8_t twoByte, uint8_t *pdata, uint16_t count)
Write data to an I2C slave device on a specific register address.
Communication interface to use the RTC on the CARME mainboard.
#define CARME_RTC_REG_WDAY
I2C board support package for the CARME module.