81 .name =
"Sensor_Task",
82 .stack_size = 128 * 4,
83 .priority = (osPriority_t) osPriorityRealtime7,
89 .stack_size = 128 * 4,
90 .priority = (osPriority_t) osPriorityNormal,
96 .stack_size = 512 * 4,
97 .priority = (osPriority_t) osPriorityNormal,
103 .stack_size = 128 * 4,
104 .priority = (osPriority_t) osPriorityNormal,
109 .name =
"ReceiveVel_Task",
110 .stack_size = 128 * 4,
111 .priority = (osPriority_t) osPriorityNormal,
237double q[] = {0.7061377159181262, -0.03700710955926802, 0.03700710955926802, -0.7061377159181262};
239static double P[]
__attribute__((aligned(4))) = {1.0, 0.0, 0.0, 0.0, 0.0, 0.0,0.0, 1.0, 0.0, 0.0, 0.0, 0.0,0.0, 0.0, 1.0, 0.0, 0.0, 0.0,0.0, 0.0, 0.0, 1.0, 0.0, 0.0,0.0, 0.0, 0.0, 0.0, 1.0, 0.0,0.0, 0.0, 0.0, 0.0, 0.0, 1.0};
240double omega[] = {3.760494829166693e-05, -1.4118446451604494e-07, 0.0003572545679652845};
245static double P_new[]
__attribute__((aligned(4)))= {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
248double z[] = {5003.24140978,329.14706741};
252const double Q[] = {2769,1846,1846,1385};
253const double R[] = {5.54e-3,0,0,0.121};
263static double cd_table[] ={0.4510,0.3940,0.3610,0.3390,0.3320,0.5430,0.4960,0.4690,0.4250,0.4170,0.6240,0.5790,0.5550,0.5350,0.5280, 0.7450,0.7140,0.6780,0.6760,0.6720,0.7520,0.7230,0.6980,0.6850,0.6820,0.85,0.81,0.8,0.8,0.8};
283#define SENSOR_FLAG (1U << 0)
284#define MPC_FLAG (1U << 1)
285#define RECEIVED_VEL_FLAG (1U << 2)
286#define KALMAN_FLAG (1U << 3)
287#define FSM_FLAG (1U << 4)
288#define UART_RX_ERROR_FLAG (1U << 5)
367 {
NOTE_B5,
TEMPO_BASE_MS*2},{
NOTE_B5,
TEMPO_BASE_MS},{
NOTE_A5,
TEMPO_BASE_MS},{
NOTE_B5,
TEMPO_BASE_MS*2},{
NOTE_B5,
TEMPO_BASE_MS*2},{
NOTE_B5,
TEMPO_BASE_MS},{
NOTE_A5,
TEMPO_BASE_MS},{
NOTE_B5,
TEMPO_BASE_MS},{
NOTE_A5,
TEMPO_BASE_MS},{
NOTE_Gb5,
TEMPO_BASE_MS*5} };
371 if (huart->Instance == USART1) {
380 if (huart->Instance == USART1){
381 uint32_t error = HAL_UART_GetError(huart);
382 __HAL_UART_CLEAR_OREFLAG(huart);
383 HAL_UART_AbortReceive(huart);
460 LED_ON(GPIO_LED_FLASH_GPIO_Port, GPIO_LED_FLASH_Pin);
482 if(result_1 != 0 || result_3 != 0){
483 LED_ON(GPIO_LED2_GPIO_Port, GPIO_LED2_Pin);
501 uint8_t small_buffer[4];
510 HAL_TIM_PWM_Start(&
htim15, TIM_CHANNEL_2);
512 for(
int i = 0; i < 10; i++) {
515 __HAL_TIM_SET_PRESCALER(&
htim15, 0);
519 __HAL_TIM_SET_PRESCALER(&
htim15, 0);
527 HAL_TIM_PWM_Stop(&
htim15, TIM_CHANNEL_2);
531 HAL_TIM_PWM_Start(&
htim15, TIM_CHANNEL_2);
536 HAL_TIM_PWM_Stop(&
htim15, TIM_CHANNEL_2);
539 LED_ON(GPIO_LED1_GPIO_Port, GPIO_LED1_Pin);
547 osKernelInitialize();
613 RCC_OscInitTypeDef RCC_OscInitStruct = {0};
614 RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
618 HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);
622 __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0);
624 while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
629 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
630 RCC_OscInitStruct.HSEState = RCC_HSE_ON;
631 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
632 RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
633 RCC_OscInitStruct.PLL.PLLM = 1;
634 RCC_OscInitStruct.PLL.PLLN = 60;
635 RCC_OscInitStruct.PLL.PLLP = 2;
636 RCC_OscInitStruct.PLL.PLLQ = 15;
637 RCC_OscInitStruct.PLL.PLLR = 2;
638 RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_3;
639 RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE;
640 RCC_OscInitStruct.PLL.PLLFRACN = 0;
641 if (HAL_RCC_OscConfig(&RCC_OscInitStruct) !=
HAL_OK)
648 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
649 |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2
650 |RCC_CLOCKTYPE_D3PCLK1|RCC_CLOCKTYPE_D1PCLK1;
651 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
652 RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
653 RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2;
654 RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2;
655 RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2;
656 RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2;
657 RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2;
659 if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) !=
HAL_OK)
671 RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
675 PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_ADC;
676 PeriphClkInitStruct.PLL2.PLL2M = 1;
677 PeriphClkInitStruct.PLL2.PLL2N = 10;
678 PeriphClkInitStruct.PLL2.PLL2P = 2;
679 PeriphClkInitStruct.PLL2.PLL2Q = 2;
680 PeriphClkInitStruct.PLL2.PLL2R = 2;
681 PeriphClkInitStruct.PLL2.PLL2RGE = RCC_PLL2VCIRANGE_3;
682 PeriphClkInitStruct.PLL2.PLL2VCOSEL = RCC_PLL2VCOMEDIUM;
683 PeriphClkInitStruct.PLL2.PLL2FRACN = 0;
684 PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLL2;
685 if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) !=
HAL_OK)
703 ADC_MultiModeTypeDef multimode = {0};
704 ADC_ChannelConfTypeDef sConfig = {0};
712 hadc1.Instance = ADC1;
713 hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1;
714 hadc1.Init.Resolution = ADC_RESOLUTION_16B;
715 hadc1.Init.ScanConvMode = ADC_SCAN_DISABLE;
716 hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
717 hadc1.Init.LowPowerAutoWait = DISABLE;
718 hadc1.Init.ContinuousConvMode = DISABLE;
719 hadc1.Init.NbrOfConversion = 1;
720 hadc1.Init.DiscontinuousConvMode = DISABLE;
721 hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
722 hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
723 hadc1.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DR;
724 hadc1.Init.Overrun = ADC_OVR_DATA_PRESERVED;
725 hadc1.Init.LeftBitShift = ADC_LEFTBITSHIFT_NONE;
726 hadc1.Init.OversamplingMode = DISABLE;
727 hadc1.Init.Oversampling.Ratio = 1;
735 multimode.Mode = ADC_MODE_INDEPENDENT;
736 if (HAL_ADCEx_MultiModeConfigChannel(&
hadc1, &multimode) !=
HAL_OK)
743 sConfig.Channel = ADC_CHANNEL_11;
744 sConfig.Rank = ADC_REGULAR_RANK_1;
745 sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;
746 sConfig.SingleDiff = ADC_SINGLE_ENDED;
747 sConfig.OffsetNumber = ADC_OFFSET_NONE;
749 sConfig.OffsetSignedSaturation = DISABLE;
750 if (HAL_ADC_ConfigChannel(&
hadc1, &sConfig) !=
HAL_OK)
772 ADC_ChannelConfTypeDef sConfig = {0};
780 hadc2.Instance = ADC2;
781 hadc2.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1;
782 hadc2.Init.Resolution = ADC_RESOLUTION_16B;
783 hadc2.Init.ScanConvMode = ADC_SCAN_DISABLE;
784 hadc2.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
785 hadc2.Init.LowPowerAutoWait = DISABLE;
786 hadc2.Init.ContinuousConvMode = DISABLE;
787 hadc2.Init.NbrOfConversion = 1;
788 hadc2.Init.DiscontinuousConvMode = DISABLE;
789 hadc2.Init.ExternalTrigConv = ADC_SOFTWARE_START;
790 hadc2.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
791 hadc2.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DR;
792 hadc2.Init.Overrun = ADC_OVR_DATA_PRESERVED;
793 hadc2.Init.LeftBitShift = ADC_LEFTBITSHIFT_NONE;
794 hadc2.Init.OversamplingMode = DISABLE;
795 hadc2.Init.Oversampling.Ratio = 1;
803 sConfig.Channel = ADC_CHANNEL_9;
804 sConfig.Rank = ADC_REGULAR_RANK_1;
805 sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;
806 sConfig.SingleDiff = ADC_SINGLE_ENDED;
807 sConfig.OffsetNumber = ADC_OFFSET_NONE;
809 sConfig.OffsetSignedSaturation = DISABLE;
810 if (HAL_ADC_ConfigChannel(&
hadc2, &sConfig) !=
HAL_OK)
832 ADC_ChannelConfTypeDef sConfig = {0};
840 hadc3.Instance = ADC3;
841 hadc3.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1;
842 hadc3.Init.Resolution = ADC_RESOLUTION_12B;
843 hadc3.Init.ScanConvMode = ADC_SCAN_DISABLE;
844 hadc3.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
845 hadc3.Init.LowPowerAutoWait = DISABLE;
846 hadc3.Init.ContinuousConvMode = DISABLE;
847 hadc3.Init.NbrOfConversion = 1;
848 hadc3.Init.DiscontinuousConvMode = DISABLE;
849 hadc3.Init.ExternalTrigConv = ADC_SOFTWARE_START;
850 hadc3.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
851 hadc3.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DR;
852 hadc3.Init.Overrun = ADC_OVR_DATA_PRESERVED;
853 hadc3.Init.LeftBitShift = ADC_LEFTBITSHIFT_NONE;
854 hadc3.Init.OversamplingMode = DISABLE;
855 hadc3.Init.Oversampling.Ratio = 1;
863 sConfig.Channel = ADC_CHANNEL_11;
864 sConfig.Rank = ADC_REGULAR_RANK_1;
865 sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;
866 sConfig.SingleDiff = ADC_SINGLE_ENDED;
867 sConfig.OffsetNumber = ADC_OFFSET_NONE;
869 sConfig.OffsetSignedSaturation = DISABLE;
870 if (HAL_ADC_ConfigChannel(&
hadc3, &sConfig) !=
HAL_OK)
896 hfdcan1.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
897 hfdcan1.Init.Mode = FDCAN_MODE_NORMAL;
898 hfdcan1.Init.AutoRetransmission = DISABLE;
899 hfdcan1.Init.TransmitPause = DISABLE;
900 hfdcan1.Init.ProtocolException = DISABLE;
901 hfdcan1.Init.NominalPrescaler = 16;
902 hfdcan1.Init.NominalSyncJumpWidth = 1;
903 hfdcan1.Init.NominalTimeSeg1 = 1;
904 hfdcan1.Init.NominalTimeSeg2 = 1;
905 hfdcan1.Init.DataPrescaler = 1;
906 hfdcan1.Init.DataSyncJumpWidth = 1;
909 hfdcan1.Init.MessageRAMOffset = 0;
910 hfdcan1.Init.StdFiltersNbr = 0;
911 hfdcan1.Init.ExtFiltersNbr = 0;
912 hfdcan1.Init.RxFifo0ElmtsNbr = 0;
913 hfdcan1.Init.RxFifo0ElmtSize = FDCAN_DATA_BYTES_8;
914 hfdcan1.Init.RxFifo1ElmtsNbr = 0;
915 hfdcan1.Init.RxFifo1ElmtSize = FDCAN_DATA_BYTES_8;
917 hfdcan1.Init.RxBufferSize = FDCAN_DATA_BYTES_8;
920 hfdcan1.Init.TxFifoQueueElmtsNbr = 0;
921 hfdcan1.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION;
922 hfdcan1.Init.TxElmtSize = FDCAN_DATA_BYTES_8;
949 hqspi.Instance = QUADSPI;
950 hqspi.Init.ClockPrescaler = 1;
951 hqspi.Init.FifoThreshold = 32;
952 hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_NONE;
953 hqspi.Init.FlashSize = 25;
954 hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_1_CYCLE;
955 hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;
956 hqspi.Init.FlashID = QSPI_FLASH_ID_2;
957 hqspi.Init.DualFlash = QSPI_DUALFLASH_DISABLE;
984 hspi1.Instance = SPI1;
985 hspi1.Init.Mode = SPI_MODE_MASTER;
986 hspi1.Init.Direction = SPI_DIRECTION_2LINES;
987 hspi1.Init.DataSize = SPI_DATASIZE_4BIT;
988 hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
989 hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
990 hspi1.Init.NSS = SPI_NSS_SOFT;
991 hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;
992 hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
993 hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
994 hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
995 hspi1.Init.CRCPolynomial = 0x0;
996 hspi1.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;
997 hspi1.Init.NSSPolarity = SPI_NSS_POLARITY_LOW;
998 hspi1.Init.FifoThreshold = SPI_FIFO_THRESHOLD_01DATA;
999 hspi1.Init.TxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN;
1000 hspi1.Init.RxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN;
1001 hspi1.Init.MasterSSIdleness = SPI_MASTER_SS_IDLENESS_00CYCLE;
1002 hspi1.Init.MasterInterDataIdleness = SPI_MASTER_INTERDATA_IDLENESS_00CYCLE;
1003 hspi1.Init.MasterReceiverAutoSusp = SPI_MASTER_RX_AUTOSUSP_DISABLE;
1004 hspi1.Init.MasterKeepIOState = SPI_MASTER_KEEP_IO_STATE_DISABLE;
1005 hspi1.Init.IOSwap = SPI_IO_SWAP_DISABLE;
1032 hspi2.Instance = SPI2;
1033 hspi2.Init.Mode = SPI_MODE_MASTER;
1034 hspi2.Init.Direction = SPI_DIRECTION_2LINES;
1035 hspi2.Init.DataSize = SPI_DATASIZE_8BIT;
1036 hspi2.Init.CLKPolarity = SPI_POLARITY_HIGH;
1037 hspi2.Init.CLKPhase = SPI_PHASE_2EDGE;
1038 hspi2.Init.NSS = SPI_NSS_SOFT;
1039 hspi2.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;
1040 hspi2.Init.FirstBit = SPI_FIRSTBIT_MSB;
1041 hspi2.Init.TIMode = SPI_TIMODE_DISABLE;
1042 hspi2.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
1043 hspi2.Init.CRCPolynomial = 0x0;
1044 hspi2.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;
1045 hspi2.Init.NSSPolarity = SPI_NSS_POLARITY_LOW;
1046 hspi2.Init.FifoThreshold = SPI_FIFO_THRESHOLD_01DATA;
1047 hspi2.Init.TxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN;
1048 hspi2.Init.RxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN;
1049 hspi2.Init.MasterSSIdleness = SPI_MASTER_SS_IDLENESS_00CYCLE;
1050 hspi2.Init.MasterInterDataIdleness = SPI_MASTER_INTERDATA_IDLENESS_00CYCLE;
1051 hspi2.Init.MasterReceiverAutoSusp = SPI_MASTER_RX_AUTOSUSP_DISABLE;
1052 hspi2.Init.MasterKeepIOState = SPI_MASTER_KEEP_IO_STATE_DISABLE;
1053 hspi2.Init.IOSwap = SPI_IO_SWAP_DISABLE;
1080 hspi3.Instance = SPI3;
1081 hspi3.Init.Mode = SPI_MODE_MASTER;
1082 hspi3.Init.Direction = SPI_DIRECTION_2LINES;
1083 hspi3.Init.DataSize = SPI_DATASIZE_8BIT;
1084 hspi3.Init.CLKPolarity = SPI_POLARITY_HIGH;
1085 hspi3.Init.CLKPhase = SPI_PHASE_2EDGE;
1086 hspi3.Init.NSS = SPI_NSS_SOFT;
1087 hspi3.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;
1088 hspi3.Init.FirstBit = SPI_FIRSTBIT_MSB;
1089 hspi3.Init.TIMode = SPI_TIMODE_DISABLE;
1090 hspi3.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
1091 hspi3.Init.CRCPolynomial = 0x0;
1092 hspi3.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;
1093 hspi3.Init.NSSPolarity = SPI_NSS_POLARITY_LOW;
1094 hspi3.Init.FifoThreshold = SPI_FIFO_THRESHOLD_01DATA;
1095 hspi3.Init.TxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN;
1096 hspi3.Init.RxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN;
1097 hspi3.Init.MasterSSIdleness = SPI_MASTER_SS_IDLENESS_00CYCLE;
1098 hspi3.Init.MasterInterDataIdleness = SPI_MASTER_INTERDATA_IDLENESS_00CYCLE;
1099 hspi3.Init.MasterReceiverAutoSusp = SPI_MASTER_RX_AUTOSUSP_DISABLE;
1100 hspi3.Init.MasterKeepIOState = SPI_MASTER_KEEP_IO_STATE_DISABLE;
1101 hspi3.Init.IOSwap = SPI_IO_SWAP_DISABLE;
1124 TIM_MasterConfigTypeDef sMasterConfig = {0};
1125 TIM_OC_InitTypeDef sConfigOC = {0};
1130 htim2.Instance = TIM2;
1131 htim2.Init.Prescaler = 0;
1132 htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
1133 htim2.Init.Period = 4294967295;
1134 htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
1135 htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
1140 sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
1141 sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
1142 if (HAL_TIMEx_MasterConfigSynchronization(&
htim2, &sMasterConfig) !=
HAL_OK)
1146 sConfigOC.OCMode = TIM_OCMODE_PWM1;
1147 sConfigOC.Pulse = 0;
1148 sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
1149 sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
1150 if (HAL_TIM_PWM_ConfigChannel(&
htim2, &sConfigOC, TIM_CHANNEL_3) !=
HAL_OK)
1173 TIM_MasterConfigTypeDef sMasterConfig = {0};
1178 htim6.Instance = TIM6;
1179 htim6.Init.Prescaler = 5999;
1180 htim6.Init.CounterMode = TIM_COUNTERMODE_UP;
1181 htim6.Init.Period = 9;
1182 htim6.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
1187 sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
1188 sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
1189 if (HAL_TIMEx_MasterConfigSynchronization(&
htim6, &sMasterConfig) !=
HAL_OK)
1211 TIM_MasterConfigTypeDef sMasterConfig = {0};
1216 htim7.Instance = TIM7;
1217 htim7.Init.Prescaler = 23999;
1218 htim7.Init.CounterMode = TIM_COUNTERMODE_UP;
1219 htim7.Init.Period = 4999;
1220 htim7.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
1225 sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
1226 sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
1227 if (HAL_TIMEx_MasterConfigSynchronization(&
htim7, &sMasterConfig) !=
HAL_OK)
1253 htim13.Init.Prescaler = 239;
1254 htim13.Init.CounterMode = TIM_COUNTERMODE_UP;
1255 htim13.Init.Period = 9999;
1256 htim13.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
1257 htim13.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
1280 TIM_MasterConfigTypeDef sMasterConfig = {0};
1281 TIM_OC_InitTypeDef sConfigOC = {0};
1282 TIM_BreakDeadTimeConfigTypeDef sBreakDeadTimeConfig = {0};
1288 htim15.Init.Prescaler = 239;
1289 htim15.Init.CounterMode = TIM_COUNTERMODE_UP;
1290 htim15.Init.Period = 999;
1291 htim15.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
1292 htim15.Init.RepetitionCounter = 0;
1293 htim15.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
1298 sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
1299 sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
1300 if (HAL_TIMEx_MasterConfigSynchronization(&
htim15, &sMasterConfig) !=
HAL_OK)
1304 sConfigOC.OCMode = TIM_OCMODE_PWM1;
1305 sConfigOC.Pulse = 499;
1306 sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
1307 sConfigOC.OCNPolarity = TIM_OCNPOLARITY_HIGH;
1308 sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
1309 sConfigOC.OCIdleState = TIM_OCIDLESTATE_RESET;
1310 sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_RESET;
1311 if (HAL_TIM_PWM_ConfigChannel(&
htim15, &sConfigOC, TIM_CHANNEL_2) !=
HAL_OK)
1315 sBreakDeadTimeConfig.OffStateRunMode = TIM_OSSR_DISABLE;
1316 sBreakDeadTimeConfig.OffStateIDLEMode = TIM_OSSI_DISABLE;
1317 sBreakDeadTimeConfig.LockLevel = TIM_LOCKLEVEL_OFF;
1318 sBreakDeadTimeConfig.DeadTime = 0;
1319 sBreakDeadTimeConfig.BreakState = TIM_BREAK_DISABLE;
1320 sBreakDeadTimeConfig.BreakPolarity = TIM_BREAKPOLARITY_HIGH;
1321 sBreakDeadTimeConfig.BreakFilter = 0;
1322 sBreakDeadTimeConfig.AutomaticOutput = TIM_AUTOMATICOUTPUT_DISABLE;
1323 if (HAL_TIMEx_ConfigBreakDeadTime(&
htim15, &sBreakDeadTimeConfig) !=
HAL_OK)
1350 huart4.Init.BaudRate = 115200;
1351 huart4.Init.WordLength = UART_WORDLENGTH_8B;
1352 huart4.Init.StopBits = UART_STOPBITS_1;
1353 huart4.Init.Parity = UART_PARITY_NONE;
1354 huart4.Init.Mode = UART_MODE_TX_RX;
1355 huart4.Init.HwFlowCtl = UART_HWCONTROL_NONE;
1356 huart4.Init.OverSampling = UART_OVERSAMPLING_16;
1357 huart4.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
1358 huart4.Init.ClockPrescaler = UART_PRESCALER_DIV1;
1359 huart4.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
1364 if (HAL_UARTEx_SetTxFifoThreshold(&
huart4, UART_TXFIFO_THRESHOLD_1_8) !=
HAL_OK)
1368 if (HAL_UARTEx_SetRxFifoThreshold(&
huart4, UART_RXFIFO_THRESHOLD_1_8) !=
HAL_OK)
1397 huart1.Instance = USART1;
1398 huart1.Init.BaudRate = 1843200;
1399 huart1.Init.WordLength = UART_WORDLENGTH_8B;
1400 huart1.Init.StopBits = UART_STOPBITS_1;
1401 huart1.Init.Parity = UART_PARITY_NONE;
1402 huart1.Init.Mode = UART_MODE_TX_RX;
1403 huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
1404 huart1.Init.OverSampling = UART_OVERSAMPLING_16;
1405 huart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
1406 huart1.Init.ClockPrescaler = UART_PRESCALER_DIV1;
1407 huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
1412 if (HAL_UARTEx_SetTxFifoThreshold(&
huart1, UART_TXFIFO_THRESHOLD_1_8) !=
HAL_OK)
1416 if (HAL_UARTEx_SetRxFifoThreshold(&
huart1, UART_RXFIFO_THRESHOLD_1_8) !=
HAL_OK)
1473 __HAL_RCC_DMA1_CLK_ENABLE();
1477 HAL_NVIC_SetPriority(DMA1_Stream0_IRQn, 5, 0);
1478 HAL_NVIC_EnableIRQ(DMA1_Stream0_IRQn);
1480 HAL_NVIC_SetPriority(DMA1_Stream1_IRQn, 5, 0);
1481 HAL_NVIC_EnableIRQ(DMA1_Stream1_IRQn);
1492 __HAL_RCC_MDMA_CLK_ENABLE();
1497 HAL_NVIC_SetPriority(MDMA_IRQn, 5, 0);
1498 HAL_NVIC_EnableIRQ(MDMA_IRQn);
1509 GPIO_InitTypeDef GPIO_InitStruct = {0};
1515 __HAL_RCC_GPIOE_CLK_ENABLE();
1516 __HAL_RCC_GPIOH_CLK_ENABLE();
1517 __HAL_RCC_GPIOC_CLK_ENABLE();
1518 __HAL_RCC_GPIOA_CLK_ENABLE();
1519 __HAL_RCC_GPIOB_CLK_ENABLE();
1520 __HAL_RCC_GPIOD_CLK_ENABLE();
1523 HAL_GPIO_WritePin(GPIOE, GPIO_1_Pin|GPIO_LED_FLASH_Pin|GPIO_LED2_Pin|GPIO_LED3_Pin, GPIO_PIN_RESET);
1526 HAL_GPIO_WritePin(GPIOA, GPIO_2_Pin|GPIO_3_AIRBRAKES_AUX_Pin|GPIO4_CAMERA_Pin|GIO_SPI1_CS_Pin
1527 |GPIO_LED_USB_Pin, GPIO_PIN_RESET);
1530 HAL_GPIO_WritePin(GPIOD, BARO_CS_Pin|IMU_CS_Pin|MAG_CS_Pin|GPIO_LED1_Pin, GPIO_PIN_RESET);
1533 HAL_GPIO_WritePin(GPIOC, GPIO_Pyro_EN1_Pin|GPIO_Pyro_EN2_Pin|GPIO_DaVinci_Marc_SYNC_Pin, GPIO_PIN_RESET);
1536 GPIO_InitStruct.Pin = GPIO_1_Pin|GPIO_LED_FLASH_Pin|GPIO_LED2_Pin|GPIO_LED3_Pin;
1537 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
1538 GPIO_InitStruct.Pull = GPIO_NOPULL;
1539 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
1540 HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
1544 GPIO_InitStruct.Pin = GPIO_2_Pin|GPIO_3_AIRBRAKES_AUX_Pin|GPIO4_CAMERA_Pin|GIO_SPI1_CS_Pin
1546 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
1547 GPIO_InitStruct.Pull = GPIO_NOPULL;
1548 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
1549 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
1552 GPIO_InitStruct.Pin = BARO_CS_Pin|IMU_CS_Pin|MAG_CS_Pin|GPIO_LED1_Pin;
1553 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
1554 GPIO_InitStruct.Pull = GPIO_NOPULL;
1555 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
1556 HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
1559 GPIO_InitStruct.Pin = GPIO_Pyro_EN1_Pin|GPIO_Pyro_EN2_Pin|GPIO_DaVinci_Marc_SYNC_Pin;
1560 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
1561 GPIO_InitStruct.Pull = GPIO_NOPULL;
1562 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
1563 HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
1566 HAL_SYSCFG_AnalogSwitchConfig(SYSCFG_SWITCH_PA0, SYSCFG_SWITCH_PA0_CLOSE);
1569 HAL_SYSCFG_AnalogSwitchConfig(SYSCFG_SWITCH_PA1, SYSCFG_SWITCH_PA1_CLOSE);
1593 uint32_t num_esecuzioni = 0;
1596 HAL_TIM_Base_Start_IT(&
htim6);
1602 osThreadFlagsWait(
SENSOR_FLAG, osFlagsWaitAny, osWaitForever);
1614 num_esecuzioni %= (uint32_t)40;
1620 if (num_esecuzioni == 0){
1725 HAL_TIM_Base_Start_IT(&
htim13);
1729 osThreadFlagsWait(
FSM_FLAG, osFlagsWaitAny, osWaitForever);
1761 static uint32_t prescaler = 0;
1765 osThreadFlagsWait(
KALMAN_FLAG, osFlagsWaitAny, osWaitForever);
1800 if (prescaler == 25) {
1803 LED_TOGGLE(GPIO_LED1_GPIO_Port,GPIO_LED1_Pin);
1840 static uint32_t prescaler = 0;
1842 HAL_TIM_Base_Start_IT(&
htim7);
1847 osThreadFlagsWait(
MPC_FLAG, osFlagsWaitAny, osWaitForever);
1848 HAL_ADC_Start(&
hadc3);
1849 HAL_ADC_PollForConversion(&
hadc3, HAL_MAX_DELAY);
1851 HAL_ADC_Stop(&
hadc3);
1853 Vr=(
Vin*((2700.0f+4700.0f)/2700.0f));
1926 LED_TOGGLE(GPIO_LED3_GPIO_Port,GPIO_LED3_Pin);
1953 uint32_t flags = osThreadFlagsWait(
RECEIVED_VEL_FLAG , osFlagsWaitAny, osWaitForever);
1962 LED_TOGGLE(GPIO_LED_USB_GPIO_Port, GPIO_LED_USB_Pin);
1973 MPU_Region_InitTypeDef MPU_InitStruct = {0};
1980 MPU_InitStruct.Enable = MPU_REGION_ENABLE;
1981 MPU_InitStruct.Number = MPU_REGION_NUMBER0;
1982 MPU_InitStruct.BaseAddress = 0x0;
1983 MPU_InitStruct.Size = MPU_REGION_SIZE_4GB;
1984 MPU_InitStruct.SubRegionDisable = 0x87;
1985 MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
1986 MPU_InitStruct.AccessPermission = MPU_REGION_NO_ACCESS;
1987 MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
1988 MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;
1989 MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
1990 MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
1992 HAL_MPU_ConfigRegion(&MPU_InitStruct);
1994 HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
2011 if (htim->Instance == TIM4)
2016 if (htim->Instance == TIM7) {
2017 if (HAL_UART_GetState(&
huart1) == HAL_UART_STATE_READY || HAL_UART_GetState(&
huart1) == HAL_UART_STATE_BUSY_RX)
2024 if (htim->Instance == TIM6) {
2031 if(htim->Instance == TIM13){
2052#ifdef USE_FULL_ASSERT
2060void assert_failed(uint8_t *file, uint32_t line)
void attitude_estimation(const double quat[4], double ts, double omega_x, double omega_y, double omega_z, double *alpha, double quat_new[4])
Propagates the rocket's attitude quaternion and calculates the angle from vertical.
A temporary, gyroscope-based attitude estimator.
int8_t bmp3_get_sensor_data(uint8_t sensor_comp, struct bmp3_data *comp_data, struct bmp3_dev *dev)
This API reads the pressure, temperature or both data from the sensor, compensates the data and store...
Provides a driver for playing musical notes on a PWM-driven buzzer.
void check_flight_phase(flight_fsm_t *phase, estimation_output_t MotionData, linear_acceleration_t acc_data)
Main FSM router function that delegates to the current state's handler.
#define NOTE_A5
Note A, 5th octave.
#define TEMPO_BASE_MS
The base duration for a note, in milliseconds.
#define NOTE_D6
Note D, 6th octave.
#define NOTE_B5
Note B, 5th octave.
#define NOTE_Db6
Note D-flat, 6th octave.
#define NOTE_Gb5
Note G-flat, 5th octave.
void musica_maestro(buzzer_t *bz, const note_t *partition, uint16_t melody_length)
Plays a melody by iterating through an array of notes.
void buzzer_init(buzzer_t *bz, TIM_HandleTypeDef *htim, uint32_t channel)
Initializes the buzzer object and its associated timer hardware.
flight_phase_t
Enumeration of all possible flight phases (states) in the FSM.
@ CALIBRATING
On the launchpad, calibrating sensors.
@ MAIN
Main parachute has been deployed.
@ LIFTOFF
Rocket has cleared the launch rail.
@ ABCSDEPLOYED
Airbrakes are deployed for apogee control.
@ DROGUE
Drogue parachute has been deployed.
@ BURNING
Engine is burning; under powered ascent.
@ INVALID
An undefined or error state.
@ TOUCHDOWN
Rocket has landed.
bool flag_kf
RTOS event flag to trigger the Kalman Filter task.
bool flag_MPC
RTOS event flag to trigger the MPC task.
TIM_HandleTypeDef htim15
HAL Timer handle for the buzzer PWM.
bool flag_flash
RTOS event flag to trigger the data logging task.
uint8_t drogue
Status flag for the drogue parachute pyro channel.
SPI_HandleTypeDef hspi2
HAL SPI handle for Sensor Bus 1 (e.g., IMU, Baro).
bool flag_attitude
RTOS event flag to trigger the attitude estimation task.
QSPI_HandleTypeDef hqspi
HAL QSPI handle for the external flash memory.
SPI_HandleTypeDef hspi3
HAL SPI handle for Sensor Bus 2 (e.g., secondary sensors).
uint8_t mainp
Status flag for the main parachute pyro channel.
int32_t lsm6dso32_angular_rate_raw_get(stmdev_ctx_t *ctx, int16_t *val)
Angular rate sensor. The value is expressed as a 16-bit word in two’s complement.[get].
int32_t lsm6dso32_acceleration_raw_get(stmdev_ctx_t *ctx, int16_t *val)
Linear acceleration output register. The value is expressed as a 16-bit word in two’s complement....
float_t lsm6dso32_from_fs16_to_mg(int16_t lsb)
float_t lsm6dso32_from_fs2000_to_mdps(int16_t lsb)
int8_t calibrateIMU(stmdev_ctx_t *imu, uint16_t iterationNum, OFFSET_TYPE type)
Calibrates the IMU by calculating sensor offsets.
int8_t init_imup(stmdev_ctx_t *imu, lsm6dso32_fs_xl_t acc_full_scale, lsm6dso32_fs_g_t gyro_full_scale, lsm6dso32_odr_xl_t acc_output_data_rate, lsm6dso32_odr_g_t gyro_output_data_rate)
Initializes the primary IMU (LSM6DSO32).
int8_t init_imuB(stmdev_ctx_t *imu, lsm6dso32_fs_xl_t acc_full_scale, lsm6dso32_fs_g_t gyro_full_scale, lsm6dso32_odr_xl_t acc_output_data_rate, lsm6dso32_odr_g_t gyro_output_data_rate)
Initializes the backup IMU (LSM6DSO32).
@ HWOFFSET
Use the hardware's internal offset registers.
void StartKalman_mkf(void *argument)
Function implementing the Kalman_mkf thread.
void StartSensor_Task(void *argument)
Function implementing the Sensor_Task thread.
void StartMPC_Task(void *argument)
Function implementing the MPC_Task thread.
void StartFSM(void *argument)
Function implementing the FSM thread.
HAL_StatusTypeDef QFlash_Init()
HAL_StatusTypeDef QFlash_ChipErase()
HAL_StatusTypeDef QFlash_Write(uint32_t addr, uint8_t *data, uint32_t dataSize)
HAL_StatusTypeDef QFlash_Read(uint32_t address, uint8_t *buffer, uint32_t dataSize)
int8_t init_bmp390_B(struct bmp3_dev *bmp390)
Initializes the backup barometer (BMP390).
int8_t init_bmp390_p(struct bmp3_dev *bmp390)
Initializes the primary barometer (BMP390).
void kalmanFilter(double x_est[2], double P[4], const double z[2], double alpha, double a_m, double Ts, const double Q[4], const double R[4], bool gnss_signal)
Executes one prediction and correction step of the Kalman filter.
@ LSM6DSO32_XL_ODR_6667Hz_HIGH_PERF
@ LSM6DSO32_GY_ODR_208Hz_HIGH_PERF
osThreadId_t xReceived_VelID
static void MX_USB_OTG_FS_PCD_Init(void)
USB_OTG_FS Initialization Function.
flight_phase_t flight_phase
void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart)
osThreadId_t Sensor_TaskHandle
void Error_Handler(void)
This function is executed in case of error occurrence.
static float_t acceleration_mg_1[3]
const osThreadAttr_t FSM_attributes
TaskHandle_t xMPCTaskHandle
osThreadId_t xKalman_TaskID
static void MX_TIM7_Init(void)
TIM7 Initialization Function.
static void MX_QUADSPI_Init(void)
QUADSPI Initialization Function.
TaskHandle_t xReceived_VelHandle
static void MX_SPI1_Init(void)
SPI1 Initialization Function.
const double mach_states[]
flight_fsm_t flight_state
UART_HandleTypeDef huart1
stmdev_ctx_t lis2mdl_dev_ctx_2
void PeriphCommonClock_Config(void)
Peripherals Common Clock Configuration.
DMA_HandleTypeDef hdma_usart1_rx
stmdev_ctx_t lis2mdl_dev_ctx
struct bmp3_data barometer_data_2
uint32_t num_of_lin_acc_saved_flash
uint32_t num_of_saved_rest_packages_flash
TaskHandle_t xKalman_TaskHandle
PCD_HandleTypeDef hpcd_USB_OTG_FS
uint32_t num_of_lin_acc_saved
static double P[] __attribute__((aligned(4)))
Data_Package_For_Marconi message
static int16_t data_raw_acceleration_1[3]
static void MX_ADC2_Init(void)
ADC2 Initialization Function.
osThreadId_t xSensorsTaskID
MDMA_HandleTypeDef hmdma_quadspi_fifo_th
DMA_HandleTypeDef hdma_usart1_tx
static void MX_DMA_Init(void)
static void MX_USART1_UART_Init(void)
USART1 Initialization Function.
const osThreadAttr_t Kalman_mkf_attributes
static void MX_MDMA_Init(void)
const osThreadAttr_t ReceiveVel_Task_attributes
static void MX_FDCAN1_Init(void)
FDCAN1 Initialization Function.
uint8_t data_buffer[4224]
void SystemClock_Config(void)
System Clock Configuration.
#define UART_RX_ERROR_FLAG
TaskHandle_t xSensorsTaskHandle
FDCAN_HandleTypeDef hfdcan1
int main(void)
The application entry point.
osThreadId_t ReceiveVel_TaskHandle
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
Period elapsed callback in non blocking mode.
osThreadId_t MPC_TaskHandle
static void MPU_Config(void)
static void MX_ADC1_Init(void)
ADC1 Initialization Function.
osThreadId_t Kalman_mkfHandle
#define RECEIVED_VEL_FLAG
const osThreadAttr_t MPC_Task_attributes
struct bmp3_data barometer_data_1
static float_t angular_rate_mdps_1[3]
const double deployment_states[]
static void MX_TIM15_Init(void)
TIM15 Initialization Function.
static void MX_SPI3_Init(void)
SPI3 Initialization Function.
static void MX_UART4_Init(void)
UART4 Initialization Function.
void StartReceiveVel_Task(void *argument)
Function implementing the ReceiveVel_Task thread.
static void MX_SPI2_Init(void)
SPI2 Initialization Function.
static void MX_ADC3_Init(void)
ADC3 Initialization Function.
UART_HandleTypeDef huart4
uint32_t num_of_saved_rest_packages
uint32_t num_of_saved_rest_packages_locked
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
static int16_t data_raw_angular_rate_1[3]
static void MX_GPIO_Init(void)
GPIO Initialization Function.
static void MX_TIM13_Init(void)
TIM13 Initialization Function.
static void MX_TIM6_Init(void)
TIM6 Initialization Function.
const osThreadAttr_t Sensor_Task_attributes
static void MX_TIM2_Init(void)
TIM2 Initialization Function.
: Header for main.c file. This file contains the common defines of the application.
Multiplicative Extended Kalman Filter (MEKF) for attitude and gyroscope bias estimation.
double optimalAngle(double sim_time_step, double altitude, double temperature, double velocity, double pressure, double current_delta, double tilt_angle, double target_apogee, double tolerance, const double mach_states[5], const double deployment_states[6], const double cd_table[30])
Calculates the optimal constant airbrake angle to reach a target apogee.
Model Predictive Controller (MPC) to determine the optimal airbrake angle.
DWT-based microsecond profiler for ARM Cortex-M microcontrollers.
void initDWT(void)
Initializes the DWT (Data Watchpoint and Trace) cycle counter.
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim)
Data packet formatted for transmission to the Marconi ground station.
float_t acc_x
Acceleration along the X-axis in g's.
float_t acc_y
Acceleration along the Y-axis in g's.
float_t Battery_Voltage
Current battery voltage in Volts.
float_t mag_z
Magnetic field strength on the Z-axis in mG.
uint8_t parachute_2
Status of the main parachute (e.g., 0=Armed, 1=Deployed).
float_t mag_y
Magnetic field strength on the Y-axis in mG.
float_t altitude
Calculated altitude above sea level in meters (m).
float_t temperature
Ambient temperature in degrees Celsius (°C).
float_t acc_z
Acceleration along the Z-axis in g's.
float_t dps_y
Angular rate around the Y-axis in dps.
float_t pressure
Atmospheric pressure in Pascals (Pa).
uint8_t parachute_1
Status of the drogue parachute (e.g., 0=Armed, 1=Deployed).
uint8_t phase
Current flight phase identifier (e.g., 0=Calibration, 1=Liftoff).
float_t mag_x
Magnetic field strength on the X-axis in mG (milligauss).
float_t deg
Current airbrakes opening degrees.
float_t velocity
Calculated module of velocity in meters per second (m/s).
float_t dps_z
Angular rate around the Z-axis in dps.
float_t dps_x
Angular rate around the X-axis in degrees per second (dps).
A comprehensive sensor data packet, excluding linear acceleration.
float_t altitude
Calculated altitude above sea level in meters (m).
float_t dps_x
Angular rate around the X-axis in degrees per second (dps).
float_t mag_z
Magnetic field strength on the Z-axis in mG.
float_t pressure
Atmospheric pressure in Pascals (Pa).
float_t dps_y
Angular rate around the Y-axis in dps.
float_t deg
Current airbrakes opening degrees.
float_t mag_x
Magnetic field strength on the X-axis in mG (milligauss).
float_t dps_z
Angular rate around the Z-axis in dps.
float_t temperature
Ambient temperature in degrees Celsius (°C).
float_t phase
Current flight phase (as a floating point representation for memory alignment).
float_t velocity
Calculated vertical velocity in meters per second (m/s).
float_t mag_y
Magnetic field strength on the Y-axis in mG.
Represents a 3-axis linear acceleration data packet.
float_t acc_y
Acceleration along the Y-axis in g's.
float_t acc_x
Acceleration along the X-axis in g's.
float_t acc_z
Acceleration along the Z-axis in g's.
bmp3 sensor structure which comprises of temperature and pressure data.
Represents the buzzer device handle.
Holds the primary outputs of the state estimation filter (e.g., Kalman filter).
float_t velocity
Vertical velocity in meters per second (m/s).
float_t height
Vertical altitude above ground level in meters (m).
float_t acceleration
Vertical acceleration in meters per second squared (m/s^2).
Main data structure for the Flight State Machine.
flight_phase_t flight_state
The current state of the FSM.
Represents a 3-axis linear acceleration vector from an IMU.
float_t accZ
Acceleration along the Z-axis in m/s^2.
float_t accX
Acceleration along the X-axis in m/s^2.
float_t accY
Acceleration along the Y-axis in m/s^2.
Represents a single musical note with a frequency and duration.
float_t readAltitude(float_t seaLevelPa, float_t seaLevelT, float_t currentPa)
Calculates altitude based on the barometric formula.
Driver for W25Qxxx series Quad-SPI NOR Flash memory.