ACDC Senior Project v1.0.0
Senior Project for Textron Aviation
|
Header file containing functions for system timing using a hardware timer. More...
Go to the source code of this file.
Data Structures | |
struct | TIMx_CHx |
Enumerations | |
enum | PWM_MODE { PWM_MODE_1 = 0b01100000 , PWM_MODE_2 = 0b01110000 } |
Functions | |
void | TIMER_Init (SystemClockSpeed SCS_x) |
(SHOULD NOT BE CALLED BY USER, CALLED IN ACDC_CLOCK.h) Initilizes the SysClock timer and sets the value of SysClock->LOAD | |
void | TIMER_SetSystemClockSpeed (SystemClockSpeed SCS_x) |
(SHOULD NOT BE CALLED BY USER, CALLED IN ACDC_CLOCK.h) Sets the value for SysClock->LOAD | |
void | TIMER_PWM_Init (TIMx_CHx TIMx_CHx_Pxx, PWM_MODE PWM_MODE_x, uint32_t frequency) |
Initializes PWM output on the specified timer and channel with the given parameters. (Default duty cycle = 0) | |
void | TIMER_PWM_SetDuty (TIMx_CHx TIMx_CHx_Pxx, uint32_t dutyCycle) |
Sets the duty cycle of the PWM signal on the specified timer and channel. | |
uint32_t | TIMER_PWM_GetDuty (TIMx_CHx TIMx_CHx_Pxx) |
Retrieves the current duty cycle of the specified timer and channel. | |
uint32_t | TIMER_PWM_GetPeriod (TIMx_CHx TIMx_CHx_Pxx) |
Retrieves the period of the PWM signal on the specified timer. | |
uint64_t | Millis () |
Grabs and returns the total number of milliseconds since the MCU turned on. | |
uint64_t | Micros () |
Grabs and returns the total number of microseconds since the MCU turned on. | |
void | Delay_MS (uint64_t delayVal) |
Pauses code execution for delayVal number of milliseconds. | |
void | Delay_US (uint64_t delayVal) |
Pauses code execution for delayVal number of microseconds. | |
Header file containing functions for system timing using a hardware timer.
This file defines functions for initializing a system clock timer, setting its value, and providing timing-related functionalities such as retrieving number of milliseconds since startup and introducing delays in code execution.
#define TIM1_CH1_PB13 ((TIMx_CHx){TIM1, 1, GPIOB, GPIO_PIN_13, false}) |
#define TIM1_CH2_PB14 ((TIMx_CHx){TIM1, 2, GPIOB, GPIO_PIN_14, false}) |
#define TIM1_CH3_PA10 ((TIMx_CHx){TIM1, 3, GPIOA, GPIO_PIN_10, false}) |
#define TIM1_CH4_PA11 ((TIMx_CHx){TIM1, 4, GPIOA, GPIO_PIN_11, false}) |
#define TIM2_CH1_PA0 ((TIMx_CHx){TIM2, 1, GPIOA, GPIO_PIN_0, false}) |
#define TIM2_CH2_PA1 ((TIMx_CHx){TIM2, 2, GPIOA, GPIO_PIN_1, false}) |
#define TIM2_CH3_PA2 ((TIMx_CHx){TIM2, 3, GPIOA, GPIO_PIN_2, false}) |
#define TIM2_CH4_PA3 ((TIMx_CHx){TIM2, 4, GPIOA, GPIO_PIN_3, false}) |
#define TIM3_CH1_PA6 ((TIMx_CHx){TIM3, 1, GPIOA, GPIO_PIN_6, false}) |
#define TIM3_CH2_PA7 ((TIMx_CHx){TIM3, 2, GPIOA, GPIO_PIN_7, false}) |
#define TIM3_CH3_PB0 ((TIMx_CHx){TIM3, 3, GPIOB, GPIO_PIN_0, false}) |
#define TIM3_CH4_PB1 ((TIMx_CHx){TIM3, 4, GPIOB, GPIO_PIN_1, false}) |
#define TIM4_CH1_PB6 ((TIMx_CHx){TIM4, 1, GPIOB, GPIO_PIN_6, false}) |
#define TIM4_CH2_PB7 ((TIMx_CHx){TIM4, 2, GPIOB, GPIO_PIN_7, false}) |
#define TIM4_CH3_PB8 ((TIMx_CHx){TIM4, 3, GPIOB, GPIO_PIN_8, false}) |
#define TIM4_CH4_PB9 ((TIMx_CHx){TIM4, 4, GPIOB, GPIO_PIN_9, false}) |
enum PWM_MODE |
void Delay_MS | ( | uint64_t | delayVal | ) |
Pauses code execution for delayVal number of milliseconds.
delayVal | Number of milliseconds to delay for |
void Delay_US | ( | uint64_t | delayVal | ) |
Pauses code execution for delayVal number of microseconds.
delayVal | Number of microseconds to delay for |
uint64_t Micros | ( | ) |
Grabs and returns the total number of microseconds since the MCU turned on.
uint64_t Millis | ( | ) |
Grabs and returns the total number of milliseconds since the MCU turned on.
void TIMER_Init | ( | SystemClockSpeed | SCS_x | ) |
(SHOULD NOT BE CALLED BY USER, CALLED IN ACDC_CLOCK.h) Initilizes the SysClock timer and sets the value of SysClock->LOAD
SCS_x | System Clock Speed (Ex. SCS_72Mhz, SCS_36Mhz, ...) |
Retrieves the current duty cycle of the specified timer and channel.
TIMx_CHx_Pxx | Struct containing configuration data for the specific timer and channel |
Retrieves the period of the PWM signal on the specified timer.
TIMx_CHx_Pxx | Struct containing configuration data for the specific timer and channel |
Initializes PWM output on the specified timer and channel with the given parameters. (Default duty cycle = 0)
TIMx_CHx_Pxx | Struct containing configuration data for the specific timer and channel |
PWM_MODE_x | Desired PWM mode |
frequency | Desired frequency (in Hz) for PWM to run at |
Sets the duty cycle of the PWM signal on the specified timer and channel.
TIMx_CHx_Pxx | Struct containing configuration data for the specific timer and channel |
dutyCycle | Duty cycle value in timer ticks. |
void TIMER_SetSystemClockSpeed | ( | SystemClockSpeed | SCS_x | ) |
(SHOULD NOT BE CALLED BY USER, CALLED IN ACDC_CLOCK.h) Sets the value for SysClock->LOAD
SCS_x | System Clock Speed (Ex. SCS_72Mhz, SCS_36Mhz, ...) |