NavHAL 0.1.0
NAVRobotec's architecture-agnostic HAL for embedded systems.
Loading...
Searching...
No Matches
main.c File Reference

Unit test runner for NAVHAL Cortex-M4 hardware abstraction layer. More...

#include "navhal.h"
#include "test_gpio.h"
#include "test_timer.h"
#include "unity.h"
Include dependency graph for main.c:

Macros

#define CORTEX_M4

Functions

void setUp (void)
 Unity test framework setup function.
void tearDown (void)
 Unity test framework teardown function.
int test_gpio (void)
 Run all GPIO tests.
int test_timer (void)
 Run all Timer tests.
void print_startup_message (void)
 Print startup banner to UART.
int main (void)
 Main test runner function.

Detailed Description

Unit test runner for NAVHAL Cortex-M4 hardware abstraction layer.

This file implements the main test runner for the NAVHAL unit tests. It includes:

  • Test setup/teardown functions
  • Individual test suite runners (GPIO, Timer)
  • Test result reporting
  • ANSI terminal control for output formatting

Tests are implemented using the Unity test framework and output results via UART2 at 9600 baud.

Note
Requires UART2 to be properly configured before running

Macro Definition Documentation

◆ CORTEX_M4

#define CORTEX_M4

Function Documentation

◆ main()

int main ( void )

Main test runner function.

Returns
Total number of failed tests

Initializes UART2, prints startup message, runs all test suites, and reports final results

◆ print_startup_message()

void print_startup_message ( void )

Print startup banner to UART.

Clears terminal screen and prints formatted startup message using ANSI escape sequences

◆ setUp()

void setUp ( void )

Unity test framework setup function.

Empty implementation since no special setup is required

◆ tearDown()

void tearDown ( void )

Unity test framework teardown function.

Empty implementation since no special cleanup is required

◆ test_gpio()

int test_gpio ( void )

Run all GPIO tests.

Returns
Number of failed tests

Executes the following test cases:

  • GPIO mode setting/reading
  • Digital write operations
  • Alternate function configuration

◆ test_timer()

int test_timer ( void )

Run all Timer tests.

Returns
Number of failed tests

Executes the following test cases:

  • Timer initialization
  • Start/stop functionality
  • Counter operations
  • Compare register functionality
  • Channel enable/disable