Skip to content

Commit

Permalink
add motor pins
Browse files Browse the repository at this point in the history
  • Loading branch information
ahiuchingau committed Jul 15, 2024
1 parent 1c3197f commit fcd03f5
Show file tree
Hide file tree
Showing 11 changed files with 364 additions and 170 deletions.
2 changes: 1 addition & 1 deletion stm32-modules/include/stacker/stacker/errors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ enum class ErrorCode {
auto errorstring(ErrorCode code) -> const char*;

template <typename Input, typename Limit>
requires std::forward_iterator<Input> && std::sized_sentinel_for<Limit, Input>
requires std::forward_iterator<Input> && std::sized_sentinel_for<Limit, Input>
constexpr auto write_into(Input start, Limit end, ErrorCode code) -> Input {
const char* str = errorstring(code);
return write_string_to_iterpair(start, end, str);
Expand Down
5 changes: 2 additions & 3 deletions stm32-modules/stacker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
# This variable defines the name of the target for this subfolder.
set(TARGET_MODULE_NAME "stacker")

#add_subdirectory(src)
add_subdirectory(src)

if (${CMAKE_CROSSCOMPILING})
add_subdirectory(firmware)
add_subdirectory(src)
else()
add_subdirectory(tests)
# add_subdirectory(simulator)
add_subdirectory(simulator)
endif()

file(GLOB_RECURSE ${TARGET_MODULE_NAME}_SOURCES_FOR_FORMAT
Expand Down
4 changes: 3 additions & 1 deletion stm32-modules/stacker/firmware/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ add_STM32G4_freertos(${TARGET_MODULE_NAME})
add_STM32G4_usb(${TARGET_MODULE_NAME})

set(SYSTEM_DIR "${CMAKE_CURRENT_SOURCE_DIR}/system")
set(MOTOR_CONTROL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/motor_control")
set(COMMS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/host_comms_task")
set(COMMON_MCU_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../common/STM32G491")
set(COMMON_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../common/src")
Expand All @@ -15,7 +16,8 @@ set(GDBINIT_PATH "${CMAKE_CURRENT_BINARY_DIR}/../../common/STM32G491/gdbinit")
# Add source files that should be checked by clang-tidy here
set(${TARGET_MODULE_NAME}_FW_LINTABLE_SRCS
${COMMS_DIR}/usb_hardware.c
)
${MOTOR_CONTROL_DIR}/motor_hardware.c
)

# Add source files that should NOT be checked by clang-tidy here
set(${TARGET_MODULE_NAME}_FW_NONLINTABLE_SRCS
Expand Down
10 changes: 4 additions & 6 deletions stm32-modules/stacker/firmware/host_comms_task/usbd_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
// TODO(frank 05-06-2022): Uncomment these VID/PID definitions and replace
// the temporary values that replicate the Gen1 tempdeck.
//#define USBD_VID 0x04D8
//#define USBD_PID 0xed8c
// TODO(alise): Uncomment these VID/PID definitions and replace
// the temporary values with the actual values for the shuttle
#define USBD_VID 0x04D8 /* same as Gen1 TD */
#define USBD_PID 0xee93 /* same as Gen1 TD */
#define USBD_LANGID_STRING 0x0409 /* Replace '0xbbb' with your device language ID */
#define USBD_MANUFACTURER_STRING "Opentrons" /* Add your manufacturer string */
#define USBD_PRODUCT_HS_STRING "Tempdeck HS" /* Add your product High Speed string */
#define USBD_PRODUCT_FS_STRING "Tempdeck FS" /* Add your product Full Speed string */
#define USBD_PRODUCT_HS_STRING "Stacker HS" /* Add your product High Speed string */
#define USBD_PRODUCT_FS_STRING "Stacker FS" /* Add your product Full Speed string */
#define USBD_CONFIGURATION_HS_STRING "Serial Config HS" /* Add your configuration High Speed string */
#define USBD_INTERFACE_HS_STRING "Serial Interface HS" /* Add your Interface High Speed string */
#define USBD_CONFIGURATION_FS_STRING "Serial Config FS" /* Add your configuration Full Speed string */
Expand Down
60 changes: 60 additions & 0 deletions stm32-modules/stacker/firmware/motor_control/motor_hardware.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#include "stm32g4xx_hal.h"

/******************* Motor Z *******************/

/** Motor hardware **/
#define Z_STEP_PIN (GPIO_PIN_2)
#define Z_STEP_PORT (GPIOC)
#define Z_DIR_PIN (GPIO_PIN_1)
#define Z_DIR_PORT (GPIOC)
#define Z_EN_PIN (GPIO_PIN_3)
#define Z_EN_PORT (GPIOA)
#define Z_N_BRAKE_PIN(GPIO_PIN_7)
#define Z_N_BRAKE_PORT(GPIOB)

/** Limit switches **/
/* Note: Photointerrupters limit switches */
#define Z_MINUS_LIMIT_PIN (GPIO_PIN_3)
#define Z_MINUS_LIMIT_PORT (GPIOC)
#define Z_PLUS_LIMIT_PIN (GPIO_PIN_0)
#define Z_PLUS_LIMIT_PORT (GPIOA)


/******************* Motor X *******************/

/** Motor hardware **/
#define X_STEP_PIN (GPIO_PIN_7)
#define X_STEP_PORT (GPIOA)
#define X_DIR_PIN (GPIO_PIN_6)
#define X_DIR_PORT (GPIOA)
#define X_EN_PIN (GPIO_PIN_4)
#define X_EN_PORT (GPIOA)
#define X_N_BRAKE_PIN(GPIO_PIN_9)
#define X_N_BRAKE_PORT(GPIOB)


/** Limit switches **/
/* Note: Photointerrupters limit switches */
#define X_MINUS_LIMIT_PIN (GPIO_PIN_1)
#define X_MINUS_LIMIT_PORT (GPIOA)
#define X_PLUS_LIMIT_PIN (GPIO_PIN_2)
#define X_PLUS_LIMIT_PORT (GPIOA)


/******************* Motor L *******************/

/** Motor hardware **/
#define L_STEP_PIN (GPIO_PIN_1)
#define L_STEP_PORT (GPIOB)
#define L_DIR_PIN (GPIO_PIN_0)
#define L_DIR_PORT (GPIOB)
#define L_EN_PIN (GPIO_PIN_4)
#define L_EN_PORT (GPIOA)


/** Limit switches **/
/* Note: Mechanical limit switches */
#define L_N_HELD_PIN (GPIO_PIN_5)
#define L_N_HELD_PORT (GPIOB)
#define L_N_RELEASED_PIN (GPIO_PIN_11)
#define L_N_RELEASED_PORT (GPIO_PIN_C)
32 changes: 16 additions & 16 deletions stm32-modules/stacker/firmware/system/main.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : main.h
* @brief : Header for main.c file.
* This file contains the common defines of the application.
******************************************************************************
* @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.
*
******************************************************************************
*/
******************************************************************************
* @file : main.h
* @brief : Header for main.c file.
* This file contains the common defines of the application.
******************************************************************************
* @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 -------------------------------------*/
Expand Down
Loading

0 comments on commit fcd03f5

Please sign in to comment.