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

Timer unit test declarations for NAVHAL. More...

#include "unity.h"
#include <stdint.h>
Include dependency graph for test_timer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void test_timer_init_sets_prescaler_and_arr (void)
 Test timer initialization.
void test_timer_start_sets_CEN_bit (void)
 Test timer start functionality.
void test_timer_stop_clears_CEN_bit (void)
 Test timer stop functionality.
void test_timer_reset_clears_count (void)
 Test timer counter reset.
void test_timer_set_compare_and_get_compare (void)
 Test compare register operations.
void test_timer_enable_and_disable_channel (void)
 Test channel enable/disable.
void test_timer_enable_and_disable_interrupt (void)
 Test interrupt control.
void test_timer_clear_interrupt_flag_clears_UIF (void)
 Test interrupt flag clearing.
void test_timer_get_arr_returns_arr_value (void)
 Test auto-reload register access.
void test_timer_get_count_returns_count_value (void)
 Test counter value access.

Detailed Description

Timer unit test declarations for NAVHAL.

This header defines the test cases for verifying Timer peripheral functionality in the NAVHAL hardware abstraction layer. It includes tests for:

  • Timer initialization and configuration
  • Start/stop control
  • Counter operations
  • Compare register functionality
  • Channel control
  • Interrupt handling
Note
Uses Unity test framework for assertions
Tests cover both general-purpose and advanced timers

Function Documentation

◆ test_timer_clear_interrupt_flag_clears_UIF()

void test_timer_clear_interrupt_flag_clears_UIF ( void )

Test interrupt flag clearing.

Verifies timer_clear_interrupt_flag() clears the update interrupt flag

Verifies that timer_clear_interrupt_flag() clears the Update Interrupt Flag (UIF) in the SR register

◆ test_timer_enable_and_disable_channel()

void test_timer_enable_and_disable_channel ( void )

Test channel enable/disable.

Verifies timer_enable_channel() and timer_disable_channel() functions

Verifies:

  1. timer_disable_channel() clears the channel enable bit in CCER register
  2. timer_enable_channel() sets the channel enable bit in CCER register

◆ test_timer_enable_and_disable_interrupt()

void test_timer_enable_and_disable_interrupt ( void )

Test interrupt control.

Verifies timer interrupt enable/disable functionality

Note
May affect other tests if interrupts are globally enabled

Test interrupt control.

Verifies that timer_enable_interrupt() sets the Update Interrupt Enable (UIE) bit in the DIER register

◆ test_timer_get_arr_returns_arr_value()

void test_timer_get_arr_returns_arr_value ( void )

Test auto-reload register access.

Verifies timer_get_arr() returns the correct auto-reload value

Verifies that timer_get_arr() correctly returns the value from the ARR register

◆ test_timer_get_count_returns_count_value()

void test_timer_get_count_returns_count_value ( void )

Test counter value access.

Verifies timer_get_count() returns the current counter value

Verifies that timer_get_count() correctly returns the current counter value from the CNT register

◆ test_timer_init_sets_prescaler_and_arr()

void test_timer_init_sets_prescaler_and_arr ( void )

Test timer initialization.

Verifies timer_init() correctly sets prescaler and auto-reload values

Verifies that timer_init() correctly sets:

  1. The prescaler value in PSC register
  2. The auto-reload value in ARR register

◆ test_timer_reset_clears_count()

void test_timer_reset_clears_count ( void )

Test timer counter reset.

Verifies timer_reset() clears the counter value to zero

Verifies that timer_reset() clears the counter value to zero by checking the CNT register

◆ test_timer_set_compare_and_get_compare()

void test_timer_set_compare_and_get_compare ( void )

Test compare register operations.

Verifies timer_set_compare() and timer_get_compare() functionality

Verifies:

  1. timer_set_compare() correctly sets the compare value in CCR register
  2. timer_get_compare() correctly returns the compare value

◆ test_timer_start_sets_CEN_bit()

void test_timer_start_sets_CEN_bit ( void )

Test timer start functionality.

Verifies timer_start() properly sets the counter enable (CEN) bit

Verifies that timer_start() sets the Counter ENable (CEN) bit in the CR1 register

◆ test_timer_stop_clears_CEN_bit()

void test_timer_stop_clears_CEN_bit ( void )

Test timer stop functionality.

Verifies timer_stop() properly clears the counter enable (CEN) bit

Verifies that timer_stop() clears the Counter ENable (CEN) bit in the CR1 register