106 while (*msg !=
'\0') {
111 int32_t num = va_arg(args,
int);
116 else if (*msg ==
's') {
117 char *str = va_arg(args,
char*);
120 else if(*msg ==
'.') {
123 char dec_places_str[2];
124 dec_places_str[0] = *msg;
125 dec_places_str[1] =
'\0';
130 double num = va_arg(args,
double);
131 char num_buf[20] = { 0 };
193 if(
str_cmp(str,
"none") ==
true) {
196 else if(
str_cmp(str,
"info") ==
true) {
199 else if(
str_cmp(str,
"debug") ==
true) {
202 else if(
str_cmp(str,
"warning") ==
true) {
205 else if(
str_cmp(str,
"error") ==
true) {
208 else if(
str_cmp(str,
"critical") ==
true) {
255 char temp = seconds[0];
263 char temp = minutes[0];
271 char temp = hours[0];
276 char time_format[] =
"(__:__:__)";
278 str_set(time_format, seconds, 2, 7);
279 str_set(time_format, minutes, 2, 4);
280 str_set(time_format, hours, 2, 1);
284 char log_level_str[16];
285 uint8_t log_level_len = 0;
286 log_level_str[0] =
'(';
289 log_level_str[log_level_len] =
')';
290 log_level_str[log_level_len + 1] =
'\0';
294 (uint8_t*)log_level_str,
static struct internal_state_s internal_state
Singleton instance of the SysTick driver internal state.
Common utility module public API.
System-wide error code definitions.
bool str_cmp(const char *str1, const char *str2)
Compares two null-terminated strings for equality.
int str_to_int(const char *str)
Converts a decimal string to an integer.
int str_cpy(char *str_to, const char *str_from, uint32_t len)
Copies a null-terminated string into a destination buffer.
void str_set(char *target_str, char const *host_str, uint32_t host_str_len, uint32_t pos)
Overwrites a region of a target string with the contents of a source string.
uint32_t get_str_len(char const *str)
Returns the length of a string, excluding the null terminator.
void double_to_str(double num, char *str, int8_t frac_digits)
Converts a double to a decimal string with a fixed number of fractional digits.
void int_to_str(int num, char *str)
Converts an integer to its decimal string representation.
ERR_te
Standard return type used by all public API functions.
@ ERR_UNINITIALZIED_OBJECT
@ ERR_MODULE_ALREADY_INITIALIZED
ERR_te init_rtc(void)
Initializes the RTC peripheral and sets a default calendar and time.
static ERR_te log_print_prologue(MODULES_te subsys, LOG_LEVEL_te log_level)
Prints the log message prologue: timestamp, severity, and subsystem name.
ERR_te log_level_to_int(char const *str, LOG_LEVEL_te *log_level)
Converts a log level name string to its LOG_LEVEL_te value.
ERR_te log_deinit()
Deinitializes the log subsystem.
ERR_te log_set_force_disable(bool bool_status)
Enables or disables forced suppression of all log output.
ERR_te log_init(LOG_HANDLE_ts *log_handle)
Initializes the log subsystem.
ERR_te log_get_level_name(LOG_LEVEL_te log_level, char *str)
Converts a LOG_LEVEL_te value to its lowercase string name.
ERR_te log_print(MODULES_te subsys, LOG_LEVEL_te subsys_log_level, LOG_LEVEL_te log_level, char *msg,...)
Prints a formatted message to the serial terminal if the severity threshold is met.
LOG_LEVEL_te
Log severity levels, in ascending order of severity.
MODULES_te
Identifies a subsystem for use in logging and CLI output.
void gpio_init(GPIO_CFG_ts *gpio_cfg)
Initializes a GPIO pin according to the given configuration.
@ GPIO_MODE_ALTERNATE_FUNCTION
void rtc_get_time(TIME_ts *time)
Reads the current time from the RTC.
void usart_deinit(USART_REGDEF_ts const *usart_instance)
Deinitializes the USART peripheral, disables its NVIC interrupt, and disables its clock.
void usart_init(USART_CFG_ts *usart_cfg)
Initializes the USART peripheral with the given configuration.
void usart_send(USART_REGDEF_ts *usart_instance, uint8_t *tx_buffer, uint32_t len)
Blocking USART transmit. Sends len bytes from tx_buffer.
void usart_set_transmission(USART_REGDEF_ts *usart_instance, EN_STATUS_te en_status)
Enables or disables the USART transmitter (TE bit).
Common initialization public API.
const char * modules_names[]
External array mapping MODULES_te values to their name strings.
Log subsystem public API.
System module identifier definitions.
STM32F401RE GPIO driver public API.
STM32F401RE RTC driver public API.
STM32F401RE USART driver public API.
Configuration structure for initializing a GPIO pin.
GPIO_ALTERNATE_FUNCTION_te alternate_function
Configuration handle for initializing the log subsystem.
GPIO_REGDEF_ts * gpio_port
GPIO_ALTERNATE_FUNCTION_te gpio_alternate_function
USART_BAUD_RATE_te usart_baud_rate
USART_REGDEF_ts * usart_instance
Holds a time-of-day value (hours, minutes, seconds).
Configuration structure for initializing a USART peripheral.
USART_BAUD_RATE_te baud_rate
USART_REGDEF_ts * instance
Internal state of the SysTick driver.
USART_REGDEF_ts * usart_instance