forked from commaai/panda
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
56 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
// TACH interrupt handler | ||
void EXTI2_IRQ_Handler(void) { | ||
volatile unsigned int pr = EXTI->PR & (1U << 2); | ||
if ((pr & (1U << 2)) != 0U) { | ||
fan_state.tach_counter++; | ||
} | ||
EXTI->PR = (1U << 2); | ||
volatile unsigned int pr = EXTI->PR & (1U << 2); | ||
if ((pr & (1U << 2)) != 0U) { | ||
fan_state.tach_counter++; | ||
} | ||
EXTI->PR = (1U << 2); | ||
} | ||
|
||
void fan_init(void){ | ||
// 5000RPM * 4 tach edges / 60 seconds | ||
REGISTER_INTERRUPT(EXTI2_IRQn, EXTI2_IRQ_Handler, 700U, FAULT_INTERRUPT_RATE_TACH) | ||
void llfan_init(void) { | ||
// 5000RPM * 4 tach edges / 60 seconds | ||
REGISTER_INTERRUPT(EXTI2_IRQn, EXTI2_IRQ_Handler, 700U, FAULT_INTERRUPT_RATE_TACH) | ||
|
||
// Init PWM speed control | ||
pwm_init(TIM3, 3); | ||
// Init PWM speed control | ||
pwm_init(TIM3, 3); | ||
|
||
// Init TACH interrupt | ||
register_set(&(SYSCFG->EXTICR[0]), SYSCFG_EXTICR1_EXTI2_PD, 0xF00U); | ||
register_set_bits(&(EXTI->IMR), (1U << 2)); | ||
register_set_bits(&(EXTI->RTSR), (1U << 2)); | ||
register_set_bits(&(EXTI->FTSR), (1U << 2)); | ||
NVIC_EnableIRQ(EXTI2_IRQn); | ||
// Init TACH interrupt | ||
register_set(&(SYSCFG->EXTICR[0]), SYSCFG_EXTICR1_EXTI2_PD, 0xF00U); | ||
register_set_bits(&(EXTI->IMR), (1U << 2)); | ||
register_set_bits(&(EXTI->RTSR), (1U << 2)); | ||
register_set_bits(&(EXTI->FTSR), (1U << 2)); | ||
NVIC_EnableIRQ(EXTI2_IRQn); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,23 @@ | ||
void EXTI2_IRQ_Handler(void) { } | ||
void fan_init(void){ } | ||
// TACH interrupt handler | ||
void EXTI2_IRQ_Handler(void) { | ||
volatile unsigned int pr = EXTI->PR1 & (1U << 2); | ||
if ((pr & (1U << 2)) != 0U) { | ||
fan_state.tach_counter++; | ||
} | ||
EXTI->PR1 = (1U << 2); | ||
} | ||
|
||
void llfan_init(void) { | ||
// 5000RPM * 4 tach edges / 60 seconds | ||
REGISTER_INTERRUPT(EXTI2_IRQn, EXTI2_IRQ_Handler, 700U, FAULT_INTERRUPT_RATE_TACH) | ||
|
||
// Init PWM speed control | ||
pwm_init(TIM3, 3); | ||
|
||
// Init TACH interrupt | ||
register_set(&(SYSCFG->EXTICR[0]), SYSCFG_EXTICR1_EXTI2_PD, 0xF00U); | ||
register_set_bits(&(EXTI->IMR1), (1U << 2)); | ||
register_set_bits(&(EXTI->RTSR1), (1U << 2)); | ||
register_set_bits(&(EXTI->FTSR1), (1U << 2)); | ||
NVIC_EnableIRQ(EXTI2_IRQn); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters