/* Sets the RTC BCD time second value. 
Requires unlocking the RTC write-protection (RTC_WPR)  */
void rtc_time_set_second(uint8_t second)
/* Sets the RTC BCD time second value. 
Requires unlocking the RTC write-protection (RTC_WPR)  */
void rtc_time_set_second(uint8_t second)
{
	uint8_t bcd_second = _rtc_dec_to_bcd(second);
	RTC_TR &= ~(RTC_TR_ST_MASK << RTC_TR_ST_SHIFT | RTC_TR_SU_MASK << RTC_TR_SU_SHIFT);
	RTC_TR |= (((bcd_second >> 4) & RTC_TR_ST_MASK) << RTC_TR_ST_SHIFT) |
		((bcd_second & RTC_TR_SU_MASK) << RTC_TR_SU_SHIFT);
}