Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion driver
Submodule driver updated 3 files
+15 −9 baro/baro.c
+113 −18 baro/baro.h
+375 −0 baro/baro_r3.c
24 changes: 24 additions & 0 deletions init/rev3/config/Src/stm32h7xx_it.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32h7xx_it.h"
#include "baro.h"
#include "sdr_pin_defines_A0010.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
Expand Down Expand Up @@ -213,5 +216,26 @@ void OTG_HS_IRQHandler(void)
}

/* USER CODE BEGIN 1 */
#if 0 // This is Proof-of-Concept Code, disabled to prevent breaking builds
void HAL_SPI_TxCpltCallback( SPI_HandleTypeDef *hspi ) {
if ( hspi == &( BARO_SPI ) ) {
baro_IT_handler(BARO_EVENT_TX_CPLT);
}
}

void HAL_SPI_TxRxCpltCallback( SPI_HandleTypeDef *hspi ) {
if ( hspi == &( BARO_SPI ) ) {
baro_IT_handler(BARO_EVENT_TXRX_CPLT);
}
}

HAL_TIM_OC_DelayElapsedCallback( TIM_HandleTypeDef *htim ) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont love the idea of having a separate timer for this. we should consider scheduling a task (cc: @NArmistead) or checking the condition synchronously

also missing return type

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wouldn't actually be a separate timer; it is just using the existing microsecond timer. You can reconfigure the channel to fire at a certain time with a feature normally used for PWM implementation and stuff, output capture. The microseconds timer has something like 4 different channels.

I do agree though that instead of my own implementation, it may be sensible to one day implement some sort of functionality in timer.c

// TODO add MICRO_TIM and BARO_TIM_CHANNEL macros to rev3 pin defines
if ( htim->Instance == MICRO_TIM ) {
if( htim->Channel == BARO_TIM_CHANNEL ) {
baro_IT_handler(BARO_EVENT_DELAY_ELAPSED);
}
}
}
#endif
/* USER CODE END 1 */
2 changes: 1 addition & 1 deletion mod