f303k8 wav player
Dependencies: SDFileSystem mbed
TIM6Driver.cpp@4:6e56da5068f3, 2016-12-02 (annotated)
- Committer:
- nameless129
- Date:
- Fri Dec 02 03:58:42 2016 +0000
- Revision:
- 4:6e56da5068f3
- Parent:
- 1:7a3f34b2d18b
open
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nameless129 | 1:7a3f34b2d18b | 1 | #include "TIM6Driver.h" |
nameless129 | 1:7a3f34b2d18b | 2 | |
nameless129 | 1:7a3f34b2d18b | 3 | TIM_HandleTypeDef htim6; |
nameless129 | 1:7a3f34b2d18b | 4 | |
nameless129 | 1:7a3f34b2d18b | 5 | void MX_NVIC_Init(void) |
nameless129 | 1:7a3f34b2d18b | 6 | { |
nameless129 | 1:7a3f34b2d18b | 7 | /* TIM6_DAC1_IRQn interrupt configuration */ |
nameless129 | 1:7a3f34b2d18b | 8 | HAL_NVIC_SetPriority(TIM6_DAC1_IRQn, 0, 0); |
nameless129 | 1:7a3f34b2d18b | 9 | HAL_NVIC_EnableIRQ(TIM6_DAC1_IRQn); |
nameless129 | 1:7a3f34b2d18b | 10 | } |
nameless129 | 1:7a3f34b2d18b | 11 | |
nameless129 | 1:7a3f34b2d18b | 12 | /* TIM6 init function */ |
nameless129 | 1:7a3f34b2d18b | 13 | void MX_TIM6_Init(void) |
nameless129 | 1:7a3f34b2d18b | 14 | { |
nameless129 | 1:7a3f34b2d18b | 15 | __TIM6_CLK_ENABLE(); |
nameless129 | 1:7a3f34b2d18b | 16 | htim6.Instance = TIM6; |
nameless129 | 1:7a3f34b2d18b | 17 | htim6.Init.Prescaler = 1; |
nameless129 | 1:7a3f34b2d18b | 18 | htim6.Init.CounterMode = TIM_COUNTERMODE_UP; |
nameless129 | 1:7a3f34b2d18b | 19 | htim6.Init.Period = 2000; |
nameless129 | 1:7a3f34b2d18b | 20 | HAL_TIM_Base_Init(&htim6); |
nameless129 | 1:7a3f34b2d18b | 21 | HAL_TIM_Base_Start_IT(&htim6); |
nameless129 | 1:7a3f34b2d18b | 22 | } |
nameless129 | 1:7a3f34b2d18b | 23 | |
nameless129 | 1:7a3f34b2d18b | 24 | void TIM6ClockSet(uint16_t setPeriod) |
nameless129 | 1:7a3f34b2d18b | 25 | { |
nameless129 | 1:7a3f34b2d18b | 26 | htim6.Instance = TIM6; |
nameless129 | 1:7a3f34b2d18b | 27 | htim6.Init.Prescaler = 1; |
nameless129 | 1:7a3f34b2d18b | 28 | htim6.Init.CounterMode = TIM_COUNTERMODE_UP; |
nameless129 | 1:7a3f34b2d18b | 29 | htim6.Init.Period = setPeriod; |
nameless129 | 1:7a3f34b2d18b | 30 | HAL_TIM_Base_Init(&htim6); |
nameless129 | 1:7a3f34b2d18b | 31 | } |
nameless129 | 1:7a3f34b2d18b | 32 | |
nameless129 | 1:7a3f34b2d18b | 33 | void TIM6ClearInt(void) |
nameless129 | 1:7a3f34b2d18b | 34 | { |
nameless129 | 1:7a3f34b2d18b | 35 | __HAL_TIM_CLEAR_IT(&htim6 , TIM_FLAG_UPDATE); |
nameless129 | 1:7a3f34b2d18b | 36 | } |