|
|
|
|
|
|
|
|
} timeAndDate; |
|
|
} timeAndDate; |
|
|
|
|
|
|
|
|
typedef struct { |
|
|
typedef struct { |
|
|
char *hours; |
|
|
|
|
|
char *minutes; |
|
|
|
|
|
char *seconds; |
|
|
|
|
|
} timeAndDateChar; |
|
|
|
|
|
|
|
|
char hours[10]; |
|
|
|
|
|
char minutes[10]; |
|
|
|
|
|
char seconds[10]; |
|
|
|
|
|
char *fullTimeStamp; |
|
|
|
|
|
} timeStamp; |
|
|
|
|
|
|
|
|
timeAndDateChar time; |
|
|
|
|
|
|
|
|
timeStamp time; |
|
|
|
|
|
|
|
|
/* USER CODE END PV */ |
|
|
/* USER CODE END PV */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/*timeAndDateChar get_time(timeAndDateChar *time){ |
|
|
|
|
|
|
|
|
void get_time(timeStamp *time){ |
|
|
|
|
|
|
|
|
|
|
|
char str[200]; |
|
|
|
|
|
|
|
|
if (HAL_RTC_GetTime(&hrtc, &sTime, RTC_FORMAT_BIN) == HAL_OK) |
|
|
if (HAL_RTC_GetTime(&hrtc, &sTime, RTC_FORMAT_BIN) == HAL_OK) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
sprintf(time->seconds, "%d", sTime.Seconds); |
|
|
sprintf(time->seconds, "%d", sTime.Seconds); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
strcpy(str, time->hours); |
|
|
|
|
|
strcat(str, ":"); |
|
|
|
|
|
strcat(str, time->minutes); |
|
|
|
|
|
strcat(str, ":"); |
|
|
|
|
|
strcat(str, time->seconds); |
|
|
|
|
|
strcat(str, " | "); |
|
|
|
|
|
|
|
|
|
|
|
time->fullTimeStamp = str; |
|
|
} |
|
|
} |
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
// sending to UART |
|
|
// sending to UART |
|
|
void transmit_uart(char *string){ |
|
|
void transmit_uart(char *string){ |
|
|
//char divider[] = ":"; |
|
|
|
|
|
//get_time(time); |
|
|
|
|
|
|
|
|
//char str[200]; |
|
|
|
|
|
//get_time(&time); |
|
|
|
|
|
//strcat(time.fullTimeStamp, string); |
|
|
|
|
|
//strcpy(str, time.fullTimeStamp); |
|
|
uint8_t len = strlen(string); |
|
|
uint8_t len = strlen(string); |
|
|
HAL_UART_Transmit(&huart2, (uint8_t*) string, len, 200); |
|
|
HAL_UART_Transmit(&huart2, (uint8_t*) string, len, 200); |
|
|
} |
|
|
} |