GPS Device
Loading...
Searching...
No Matches
Initialization Public API

Public initialization functions for shared dependencies. More...

Collaboration diagram for Initialization Public API:

Functions

ERR_te init_log (void)
 Initializes the logging subsystem.
ERR_te init_systick (void)
 Initializes the SysTick timer.
ERR_te init_neo6 (void)
 Initializes the NEO-6 GPS module.
ERR_te init_rtc (void)
 Initializes the RTC peripheral and sets a default calendar and time.

Detailed Description

Public initialization functions for shared dependencies.

Function Documentation

◆ init_log()

ERR_te init_log ( void )

Initializes the logging subsystem.

Configures the log module with a fixed hardware target: USART1 at 115200 baud on GPIOA pin 9 (alternate function AF7).

Returns
  • ERR_OK on success
  • Propagated error from log_init on failure
See also
init_log

Definition at line 25 of file init.c.

25 {
26 ERR_te err;
27
28 LOG_HANDLE_ts log_handle = { 0 };
29 log_handle.usart_instance = USART1;
30 log_handle.usart_baud_rate = USART_BAUD_RATE_115200;
31 log_handle.gpio_port = GPIOA;
32 log_handle.gpio_pin = GPIO_PIN_9;
34 err = log_init(&log_handle);
35
36 return err;
37}
ERR_te
Standard return type used by all public API functions.
Definition err.h:35
ERR_te log_init(LOG_HANDLE_ts *log_handle)
Initializes the log subsystem.
Definition log.c:56
@ GPIO_PIN_9
@ GPIO_ALTERNATE_FUNCTION_AF7
#define USART1
#define GPIOA
Configuration handle for initializing the log subsystem.
Definition log.h:80
GPIO_REGDEF_ts * gpio_port
Definition log.h:88
GPIO_ALTERNATE_FUNCTION_te gpio_alternate_function
Definition log.h:94
USART_BAUD_RATE_te usart_baud_rate
Definition log.h:85
USART_REGDEF_ts * usart_instance
Definition log.h:82
GPIO_PIN_te gpio_pin
Definition log.h:91
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_systick()

ERR_te init_systick ( void )

Initializes the SysTick timer.

Configures SysTick to use the processor clock source with interrupt generation enabled, providing the system millisecond tick used by systick_get_ms.

Returns
  • ERR_OK on success
  • Propagated error from systick_init on failure
See also
init_systick

Definition at line 40 of file init.c.

40 {
41 ERR_te err;
42
43 SYSTICK_CFG_ts systick_cfg = { 0 };
45 systick_cfg.interrupt = SYSTICK_IT_TRUE;
46 err = systick_init(&systick_cfg);
47
48 return err;
49}
ERR_te systick_init(SYSTICK_CFG_ts const *systick_cfg)
Initializes and starts the SysTick timer.
@ SYSTICK_CLK_SOURCE_PROCESSOR
@ SYSTICK_IT_TRUE
Configuration structure for initializing the SysTick timer.
SYSTICK_CLK_SOURCE_te clk_source
SYSTICK_IT_te interrupt
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_neo6()

ERR_te init_neo6 ( void )

Initializes the NEO-6 GPS module.

Initializes the NEO-6 subsystem and registers a handle configured for USART6 at 9600 baud, with RX on GPIOA pin 12 and TX on GPIOA pin 11 (alternate function AF8). Starts the subsystem after handle initialization.

Returns
  • ERR_OK on success
  • Propagated error from the last failing NEO-6 call on failure
Note
Errors from intermediate steps (subsys init, handle init) are overwritten by subsequent calls. Only the last error is returned.
See also
init_neo6

Definition at line 52 of file init.c.

52 {
53 ERR_te err;
55
56 NEO6_CFG_ts neo6_cfg = { 0 };
57 neo6_cfg.usart_instance = USART6;
58 neo6_cfg.usart_baud_rate = 9600;
59 neo6_cfg.rx_gpio_port = GPIOA;
60 neo6_cfg.rx_gpio_pin = GPIO_PIN_12;
61 neo6_cfg.tx_gpio_port = GPIOA;
62 neo6_cfg.tx_gpio_pin = GPIO_PIN_11;
64 err = neo6_init_subsys();
65 err = neo6_init_handle(&neo6_cfg, &neo6_handle);
66 err = neo6_start_subsys();
67
68 return err;
69}
ERR_te neo6_start_subsys(void)
Starts the NEO-6 subsystem.
Definition neo6.c:274
ERR_te neo6_init_handle(NEO6_CFG_ts *neo6_cfg, NEO6_HANDLE_ts **neo6_handle_o)
Initializes the NEO-6 hardware handle.
Definition neo6.c:322
ERR_te neo6_init_subsys(void)
Initializes the NEO-6 subsystem.
Definition neo6.c:205
struct neo6_handle_s NEO6_HANDLE_ts
Opaque handle representing the NEO-6 hardware instance.
Definition neo6.h:142
@ GPIO_PIN_11
@ GPIO_PIN_12
@ GPIO_ALTERNATE_FUNCTION_AF8
#define USART6
NEO6_HANDLE_ts * neo6_handle
Definition main.c:65
Configuration structure for initializing a NEO-6 handle.
Definition neo6.h:110
USART_REGDEF_ts * usart_instance
Definition neo6.h:112
GPIO_REGDEF_ts * rx_gpio_port
Definition neo6.h:118
GPIO_REGDEF_ts * tx_gpio_port
Definition neo6.h:124
USART_BAUD_RATE_te usart_baud_rate
Definition neo6.h:115
GPIO_PIN_te rx_gpio_pin
Definition neo6.h:121
GPIO_ALTERNATE_FUNCTION_te gpio_alternate_function
Definition neo6.h:130
GPIO_PIN_te tx_gpio_pin
Definition neo6.h:127
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_rtc()

ERR_te init_rtc ( void )

Initializes the RTC peripheral and sets a default calendar and time.

Initializes the RTC hardware. If the RTC is already initialized (ERR_MODULE_ALREADY_INITIALIZED), the function returns immediately without overwriting the current time, preserving any previously set value.

If initialization succeeds, sets the calendar to Thursday, 29 January 2026 and the time to 00:00:00 as a compile-time default.

Returns
  • ERR_OK on success
  • ERR_MODULE_ALREADY_INITIALIZED if the RTC was already initialized
  • Propagated error from rtc_init on failure
See also
init_rtc

Definition at line 72 of file init.c.

72 {
73 ERR_te err;
74
75 err = rtc_init();
76
78 return err;
79 }
80
81 CALENDAR_ts rtc_calendar;
82 rtc_calendar.date = 29;
83 rtc_calendar.months = MONTHS_JANUARY;
84 rtc_calendar.week_days = WEEK_DAYS_THURSDAY;
85 rtc_calendar.year = 2026;
86 rtc_set_calendar(&rtc_calendar);
87
88 TIME_ts rtc_time;
89 rtc_time.hours = 0;
90 rtc_time.minutes = 0;
91 rtc_time.seconds = 0;
92 rtc_set_time(&rtc_time);
93
94 return ERR_OK;
95}
@ ERR_OK
Definition err.h:36
@ ERR_MODULE_ALREADY_INITIALIZED
Definition err.h:54
void rtc_set_calendar(CALENDAR_ts const *date)
Sets the RTC calendar (date and weekday).
void rtc_set_time(TIME_ts const *time)
Sets the RTC time (hours, minutes, seconds).
ERR_te rtc_init(void)
Initializes the RTC peripheral.
@ WEEK_DAYS_THURSDAY
@ MONTHS_JANUARY
Holds a calendar date (year, month, day, weekday).
MONTHS_te months
WEEK_DAYS_te week_days
Holds a time-of-day value (hours, minutes, seconds).
uint8_t seconds
uint8_t hours
uint8_t minutes
Here is the call graph for this function:
Here is the caller graph for this function: