consistant naming for global_state and implemented
This commit is contained in:
@@ -12,7 +12,8 @@
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
#include "global_state.h"
|
||||
#include "ring_buffer.h"
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
@@ -80,6 +81,7 @@ const osThreadAttr_t camTask_attributes = {
|
||||
};
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
global_state_t state_g ={0};
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
@@ -102,12 +104,12 @@ void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim) {
|
||||
switch (htim->Channel) {
|
||||
// HAL_TIM_ACTIVE_CHANNEL_2 is the channel used for cam interupts
|
||||
case HAL_TIM_ACTIVE_CHANNEL_2:
|
||||
// TODO push timestamp to the cam ring buffer
|
||||
ringBufferPush(&state_g.cam_RB,HAL_TIM_ReadCapturedValue(htim,HAL_TIM_ACTIVE_CHANNEL_2));
|
||||
osThreadFlagsSet(camTaskHandle, 0x01);
|
||||
break;
|
||||
// HAL_TIM_ACTIVE_CHANNEL_1 is the channel used for crank interupts
|
||||
case HAL_TIM_ACTIVE_CHANNEL_1:
|
||||
// TODO push timestamp to the crank ring buffer
|
||||
ringBufferPush(&state_g.crank_RB,HAL_TIM_ReadCapturedValue(htim,HAL_TIM_ACTIVE_CHANNEL_1));
|
||||
osThreadFlagsSet(crankTaskHandle, 0x01);
|
||||
break;
|
||||
default:
|
||||
@@ -154,7 +156,7 @@ int main(void) {
|
||||
HAL_Init();
|
||||
|
||||
/* USER CODE BEGIN Init */
|
||||
|
||||
state_g.sync=SYNC_NOT_OK;
|
||||
/* USER CODE END Init */
|
||||
|
||||
/* Configure the system clock */
|
||||
@@ -415,7 +417,10 @@ void crankHandler(void *argument) {
|
||||
/* Infinite loop */
|
||||
for (;;) {
|
||||
osThreadFlagsWait(0x01, osFlagsWaitAny, osWaitForever);
|
||||
// TODO Handle the call
|
||||
if (state_g.sync == SYNC_OK) {
|
||||
//TODO complete algorithm for scheduling spark
|
||||
|
||||
}
|
||||
}
|
||||
/* USER CODE END crankHandler */
|
||||
}
|
||||
@@ -432,7 +437,10 @@ void camHandler(void *argument) {
|
||||
/* Infinite loop */
|
||||
for (;;) {
|
||||
osThreadFlagsWait(0x01, osFlagsWaitAny, osWaitForever);
|
||||
// TODO Handle the call
|
||||
if (state_g.sync == SYNC_OK) {
|
||||
//TODO complete algorithm for scheduling spark
|
||||
|
||||
}
|
||||
}
|
||||
/* USER CODE END camHandler */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user