Skip to content
Open
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
24 changes: 13 additions & 11 deletions MC/.mxproject

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions MC/Core/Inc/DAC.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ typedef struct {
uint8_t dac_address;
uint8_t buffer[2];
uint8_t high_speed_mode;
uint8_t throttle;
} DAC_t;

// Sends a reset command to ensure EEPROM data is available to output
Expand Down
1 change: 1 addition & 0 deletions MC/Core/Inc/stm32f7xx_it.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void DebugMon_Handler(void);
void CAN1_RX0_IRQHandler(void);
void TIM3_IRQHandler(void);
/* USER CODE BEGIN EFP */

Expand Down
57 changes: 57 additions & 0 deletions MC/Core/Inc/tim.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file tim.h
* @brief This file contains all the function prototypes for
* the tim.c file
******************************************************************************
* @attention
*
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __TIM_H__
#define __TIM_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "main.h"

/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

extern TIM_HandleTypeDef htim1;

extern TIM_HandleTypeDef htim2;

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

void MX_TIM1_Init(void);
void MX_TIM2_Init(void);

void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);

/* USER CODE BEGIN Prototypes */

/* USER CODE END Prototypes */

#ifdef __cplusplus
}
#endif

#endif /* __TIM_H__ */

1 change: 1 addition & 0 deletions MC/Core/Src/DAC.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ DAC_t DAC_init(I2C_HandleTypeDef* hi2c)
dacInstance.dac_address = DAC_I2C_WRITE_ADDRESS;
dacInstance.high_speed_mode = 0;
dacInstance.hi2c = hi2c;
dacInstance.throttle = 0;
reset_dac(&dacInstance);

return dacInstance;
Expand Down
26 changes: 17 additions & 9 deletions MC/Core/Src/can.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ void MX_CAN1_Init(void)
}
/* USER CODE BEGIN CAN1_Init 2 */

CAN_FilterTypeDef filter_config;

filter_config.FilterActivation = CAN_FILTER_ENABLE;
filter_config.FilterScale = CAN_FILTERSCALE_32BIT;
filter_config.FilterMode = CAN_FILTERMODE_IDLIST;
filter_config.FilterBank = 0;

uint32_t cmd_id = 0x123 << 5;
filter_config.FilterFIFOAssignment = CAN_FILTER_FIFO0;
filter_config.FilterIdHigh = (cmd_id >> 16) & 0xFFFF;
filter_config.FilterIdLow = cmd_id & 0xFFFF;
HAL_CAN_ConfigFilter(&hcan1, &filter_config);
/* USER CODE END CAN1_Init 2 */

}
Expand Down Expand Up @@ -98,15 +110,6 @@ void MX_CAN3_Init(void)
filter_config.FilterFIFOAssignment = CAN_FILTER_FIFO0;
filter_config.FilterIdHigh = 0x10F8109A >> 13;
filter_config.FilterIdLow = 0x10F8109A << 3;
filter_config.FilterMaskIdHigh = 0x10F8108D >> 13;
filter_config.FilterMaskIdLow = 0x10F8108D << 3;
HAL_CAN_ConfigFilter(&hcan3, &filter_config);

filter_config.FilterFIFOAssignment = CAN_FILTER_FIFO1;
filter_config.FilterIdHigh = 0;
filter_config.FilterIdLow = 0;
filter_config.FilterMaskIdHigh = 0;
filter_config.FilterMaskIdLow = 0;
HAL_CAN_ConfigFilter(&hcan3, &filter_config);

/* USER CODE END CAN3_Init 2 */
Expand Down Expand Up @@ -137,6 +140,9 @@ void HAL_CAN_MspInit(CAN_HandleTypeDef* canHandle)
GPIO_InitStruct.Alternate = GPIO_AF9_CAN1;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);

/* CAN1 interrupt Init */
HAL_NVIC_SetPriority(CAN1_RX0_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(CAN1_RX0_IRQn);
/* USER CODE BEGIN CAN1_MspInit 1 */

/* USER CODE END CAN1_MspInit 1 */
Expand Down Expand Up @@ -184,6 +190,8 @@ void HAL_CAN_MspDeInit(CAN_HandleTypeDef* canHandle)
*/
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_0|GPIO_PIN_1);

/* CAN1 interrupt Deinit */
HAL_NVIC_DisableIRQ(CAN1_RX0_IRQn);
/* USER CODE BEGIN CAN1_MspDeInit 1 */

/* USER CODE END CAN1_MspDeInit 1 */
Expand Down
Loading