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
50 changes: 25 additions & 25 deletions Common/Inc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,39 @@

// BEGIN KELLY DEFS
// FRAME 1
const DataSegment DRIVING_DIRECTION_K = {MOTOR_CONTROLLER_1, 1, 1};
const DataSegment MOTOR_SPEED_K = {MOTOR_CONTROLLER_1, 2, 3};
const DataSegment MOTOR_ERROR_CODE_K = {MOTOR_CONTROLLER_1, 4, 4};
const Data_Segment_t DRIVING_DIRECTION_K = {MOTOR_CONTROLLER_1, 1, 1};
const Data_Segment_t MOTOR_SPEED_K = {MOTOR_CONTROLLER_1, 2, 3};
const Data_Segment_t MOTOR_ERROR_CODE_K = {MOTOR_CONTROLLER_1, 4, 4};
// FRAME 2
const DataSegment BATTERY_VOLTAGE_K = {MOTOR_CONTROLLER_2, 1, 2};
const DataSegment BATTERY_CURRENT_K = {MOTOR_CONTROLLER_2, 3, 4};
const DataSegment MOTOR_TEMP_K = {MOTOR_CONTROLLER_2, 5, 6};
const DataSegment MOTOR_CONTROLLER_TEMP_K = {MOTOR_CONTROLLER_2, 7, 8};
const Data_Segment_t BATTERY_VOLTAGE_K = {MOTOR_CONTROLLER_2, 1, 2};
const Data_Segment_t BATTERY_CURRENT_K = {MOTOR_CONTROLLER_2, 3, 4};
const Data_Segment_t MOTOR_TEMP_K = {MOTOR_CONTROLLER_2, 5, 6};
const Data_Segment_t MOTOR_CONTROLLER_TEMP_K = {MOTOR_CONTROLLER_2, 7, 8};
// END KELLY DEFS

// BEGIN MOTOR CONTROLLER DEFS
const DataSegment BATTERY_VOLTAGE = {MOTOR_CONTROLLER, 1, 2};
const DataSegment BATTERY_CURRENT = {MOTOR_CONTROLLER, 3, 4};
const DataSegment MOTOR_SPEED = {MOTOR_CONTROLLER, 5, 6};
const DataSegment MOTOR_CONTROLLER_TEMP = {MOTOR_CONTROLLER, 7, 7};
const DataSegment DRIVING_DIRECTION = {MOTOR_CONTROLLER, 8, 8};
const DataSegment MOTOR_ERROR_CODE = {MOTOR_CONTROLLER, 8, 8};
const Data_Segment_t BATTERY_VOLTAGE = {MOTOR_CONTROLLER, 1, 2};
const Data_Segment_t BATTERY_CURRENT = {MOTOR_CONTROLLER, 3, 4};
const Data_Segment_t MOTOR_SPEED = {MOTOR_CONTROLLER, 5, 6};
const Data_Segment_t MOTOR_CONTROLLER_TEMP = {MOTOR_CONTROLLER, 7, 7};
const Data_Segment_t DRIVING_DIRECTION = {MOTOR_CONTROLLER, 8, 8};
const Data_Segment_t MOTOR_ERROR_CODE = {MOTOR_CONTROLLER, 8, 8};
// END MOTOR CONTROLLER DEFS

// BEGIN BMS DEFS
const DataSegment MUX1_TEMP = {BMS_BOARD, 1, 1};
const DataSegment MUX2_TEMP = {BMS_BOARD, 2, 2};
const DataSegment MUX3_TEMP = {BMS_BOARD, 3, 3};
const DataSegment MUX4_TEMP = {BMS_BOARD, 4, 4};
const DataSegment MUX5_TEMP = {BMS_BOARD, 5, 5};
const DataSegment MUX6_TEMP = {BMS_BOARD, 6, 6};
const DataSegment BMS_ERROR_CODE = {BMS_BOARD, 7, 7};
const Data_Segment_t MUX1_TEMP = {BMS_BOARD, 1, 1};
const Data_Segment_t MUX2_TEMP = {BMS_BOARD, 2, 2};
const Data_Segment_t MUX3_TEMP = {BMS_BOARD, 3, 3};
const Data_Segment_t MUX4_TEMP = {BMS_BOARD, 4, 4};
const Data_Segment_t MUX5_TEMP = {BMS_BOARD, 5, 5};
const Data_Segment_t MUX6_TEMP = {BMS_BOARD, 6, 6};
const Data_Segment_t BMS_ERROR_CODE = {BMS_BOARD, 7, 7};
// END BMS DEFS

// BEGIN SENSORS BOARD DEFS
const DataSegment PRESSURE_SENSOR_DATA = {SENSOR_BOARD, 1, 1};
const DataSegment IMU_DATA = {SENSOR_BOARD, 2, 3};
const DataSegment LIM_ONE_TEMP = {SENSOR_BOARD, 4, 5};
const DataSegment LIM_TWO_TEMP = {SENSOR_BOARD, 6, 7};
const DataSegment SENSORS_ERROR_CODE = {SENSOR_BOARD, 8, 8};
const Data_Segment_t PRESSURE_SENSOR_DATA = {SENSOR_BOARD, 1, 1};
const Data_Segment_t IMU_DATA = {SENSOR_BOARD, 2, 3};
const Data_Segment_t LIM_ONE_TEMP = {SENSOR_BOARD, 4, 5};
const Data_Segment_t LIM_TWO_TEMP = {SENSOR_BOARD, 6, 7};
const Data_Segment_t SENSORS_ERROR_CODE = {SENSOR_BOARD, 8, 8};
// END SENSORS BOARD DEFS
1 change: 1 addition & 0 deletions Common/Src/can_driver.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "can_driver.h"

static uint32_t tx_mailbox;
#define WARN_OFFSET 0xFF

CAN_Frame_t CAN_frame_init(CAN_HandleTypeDef* handler, uint32_t id) {
// default conditions
Expand Down
1 change: 1 addition & 0 deletions G6-STM32
Submodule G6-STM32 added at f06657
362 changes: 185 additions & 177 deletions Sensors/.cproject

Large diffs are not rendered by default.

60 changes: 31 additions & 29 deletions Sensors/.mxproject

Large diffs are not rendered by default.

78 changes: 39 additions & 39 deletions Sensors/.project
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Sensors</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.st.stm32cube.ide.mcu.MCUProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUCubeProjectNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAev2ProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUAdvancedStructureProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCURootProjectNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<linkedResources>
<link>
<name>Common</name>
<type>2</type>
<location>C:/Users/mahir/Desktop/Waterloop/G6-STM32/Common</location>
</link>
</linkedResources>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Sensors</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.st.stm32cube.ide.mcu.MCUProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUCubeProjectNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAev2ProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUAdvancedStructureProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCURootProjectNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<linkedResources>
<link>
<name>Common</name>
<type>2</type>
<location>C:/Users/mahir/Desktop/Waterloop/G6-STM32/Common</location>
</link>
</linkedResources>
</projectDescription>
52 changes: 52 additions & 0 deletions Sensors/Core/Inc/adc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file adc.h
* @brief This file contains all the function prototypes for
* the adc.c file
******************************************************************************
* @attention
*
* Copyright (c) 2024 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 __ADC_H__
#define __ADC_H__

#ifdef __cplusplus
extern "C" {
#endif

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

/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

extern ADC_HandleTypeDef hadc1;

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

void MX_ADC1_Init(void);

/* USER CODE BEGIN Prototypes */

/* USER CODE END Prototypes */

#ifdef __cplusplus
}
#endif

#endif /* __ADC_H__ */

16 changes: 16 additions & 0 deletions Sensors/Core/Inc/pressure.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* pressure.h
*
* Created on: Apr 25, 2024
* Author: mahesh, mahir
*/

#ifndef INC_PRESSURE_H_
#define INC_PRESSURE_H_

#include <stdint.h>
#define MAX_ADC_VALUE 4095

uint8_t poll_pressure_sensor(void);

#endif /* INC_PRESSURE_H_ */
Loading