Clock working, I2C communication to be proven

This commit is contained in:
StefansE
2026-03-26 19:26:58 +01:00
parent 6b3f588fb0
commit ba8855eb21
6 changed files with 153 additions and 21 deletions

View File

@@ -29,6 +29,7 @@
#include "ws2812_drv.h"
#include "ws2812_effect.h"
#include "ds1307.h"
#include "clock.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@@ -108,7 +109,7 @@ int main(void)
// RTC config
ds1307_init();
ds1307_dev_t my_rtc;
ds1307_config(0, 44, 12, SATURDAY, 18, SEPTEMBER, 2021, +8, 00);
ds1307_config(0, 10, 19, THURSDAY, 26, MARCH, 2026, +1, 33);
/* USER CODE END 2 */
@@ -126,28 +127,26 @@ int main(void)
#define EFFECT_TIME 10000
// ds1307_update(&my_rtc);
ds1307_update(&my_rtc);
mytimer = HAL_GetTick();
while(mytimer + EFFECT_TIME > HAL_GetTick()){
ws_Effect_RoudTheClock();
}
uint8_t hour = my_rtc.hours;
uint8_t minutes = my_rtc.minutes;
uint8_t seconds = my_rtc.seconds;
hour = clock_convert_hours(my_rtc.hours);
minutes = clock_convert_min_sec(my_rtc.minutes);
seconds = clock_convert_min_sec(my_rtc.seconds);
mytimer = HAL_GetTick();
while(mytimer + EFFECT_TIME > HAL_GetTick()){
ws_Effect_RandRound();
}
ws_effect_display_time(hour, (uint8_t) minutes, (uint8_t) seconds);
// ws_Effect_RoudTheClock();
mytimer = HAL_GetTick();
while(mytimer + EFFECT_TIME > HAL_GetTick()){
ws_Effect_RandRand();
}
HAL_GPIO_TogglePin(LED_Green_GPIO_Port, LED_Green_Pin);
HAL_Delay(1000);
}
/* USER CODE END 3 */
}