added uart transmit timestamp (not working properly)
This commit is contained in:
parent
367c294f1c
commit
9e4072b3cb
@ -84,12 +84,13 @@ typedef struct {
|
|||||||
} timeAndDate;
|
} timeAndDate;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *hours;
|
char hours[10];
|
||||||
char *minutes;
|
char minutes[10];
|
||||||
char *seconds;
|
char seconds[10];
|
||||||
} timeAndDateChar;
|
char *fullTimeStamp;
|
||||||
|
} timeStamp;
|
||||||
|
|
||||||
timeAndDateChar time;
|
timeStamp time;
|
||||||
|
|
||||||
/* USER CODE END PV */
|
/* USER CODE END PV */
|
||||||
|
|
||||||
@ -393,7 +394,9 @@ void set_alarm(int h, int min, int weekDay, char* alarm, RTC_AlarmTypeDef* alarm
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*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)
|
||||||
{
|
{
|
||||||
@ -402,12 +405,22 @@ void set_alarm(int h, int min, int weekDay, char* alarm, RTC_AlarmTypeDef* alarm
|
|||||||
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[] = ":";
|
//char str[200];
|
||||||
//get_time(time);
|
//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);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user