-
Notifications
You must be signed in to change notification settings - Fork 1
L298n stepper system #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9725783
707cb02
7e3617b
d70b1a5
cdf4090
a54dafd
44dc35f
426fbea
790cf05
b831870
eb2b8a0
674c9df
012deec
d6b3a99
81cc480
a8ed4b6
0c19bbb
8d8c6ac
02353d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| #ifndef L298N_STEPPER_SYSTEM_H | ||
| #define L298N_STEPPER_SYSTEM_H | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| #include <stdbool.h> | ||
| #include <stdint.h> | ||
| #include "stm32l4xx.h" | ||
|
|
||
|
|
||
|
|
||
|
|
||
| typedef volatile uint32_t* TIMER_CHANNEL; | ||
| typedef uint16_t GPIO_PIN; | ||
|
|
||
| typedef struct{ | ||
|
dzhang39 marked this conversation as resolved.
|
||
|
|
||
| GPIO_TypeDef* ena_port; | ||
| GPIO_PIN ena_pin; | ||
|
|
||
| GPIO_TypeDef* enb_port; | ||
| GPIO_PIN enb_pin; | ||
|
|
||
| GPIO_TypeDef* in1_port; | ||
| GPIO_PIN in1_pin; | ||
|
|
||
| GPIO_TypeDef* in2_port; | ||
| GPIO_PIN in2_pin; | ||
|
|
||
| GPIO_TypeDef* in3_port; | ||
| GPIO_PIN in3_pin; | ||
|
|
||
| GPIO_TypeDef* in4_port; | ||
| GPIO_PIN in4_pin; | ||
|
|
||
|
|
||
|
|
||
| uint16_t steps_per_rev; | ||
|
|
||
| uint32_t tick_accumulator; | ||
| uint32_t ticks_per_step; | ||
| uint16_t current_speed; | ||
| uint16_t max_speed; | ||
|
|
||
| uint8_t current_step; | ||
| uint8_t dir; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is dir? |
||
|
|
||
| uint32_t max_time_ms; //max time (currently not implemented) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ignore this then |
||
| uint32_t current_time_running_ms;//how long its been running (not implemented) | ||
|
|
||
| uint8_t status; | ||
|
|
||
| }l298n_stepper_driver_t; | ||
|
|
||
|
|
||
|
|
||
| /* | ||
| * | ||
| * | ||
| * PUT CONFIG HERE | ||
| * | ||
| * | ||
| */ | ||
|
|
||
| #define NUM_STEPPERS 0//replace w number of steppers | ||
|
|
||
| //EXAMPLE | ||
|
|
||
| extern l298n_stepper_driver_t drivers[NUM_STEPPERS]; // needs to be defined in the .c | ||
|
dzhang39 marked this conversation as resolved.
|
||
| extern TIM_TypeDef* global_interrupt_clock; | ||
| extern uint32_t l298n_stepper_timer_period_us; //assumes clock speed is 8mhz | ||
|
|
||
| #define STEPPER_0_VEL_PARAM_NAME "" | ||
|
|
||
| extern char* vel_param_names[NUM_STEPPERS]; | ||
|
|
||
|
|
||
|
|
||
| #define STEPPER_0_STATUS_PARAM_NAME_C "" | ||
|
|
||
| extern char* status_param_names_C[NUM_STEPPERS]; | ||
|
|
||
|
|
||
|
|
||
| #define STEPPER_0_STATUS_PARAM_NAME_R "" | ||
|
|
||
| extern char* status_param_names_R[NUM_STEPPERS]; | ||
|
|
||
|
|
||
| void l298n_stepper_system_controller(void); | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* COPY_RENAME_ME_SYSTEM_H */ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,6 +72,10 @@ extern "C" { | |
| #define PROJECT_CAN_ID_SCIENCE_DC_MOTOR_R 0x071U | ||
| #define PROJECT_CAN_ID_SCIENCE_SERVO_PCB_C 0x080U | ||
| #define PROJECT_CAN_ID_SCIENCE_SERVO_PCB_R 0x081U | ||
| #define PROJECT_CAN_ID_SCIENCE_STEPPER_PCB_C 0x090U | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Internal_Thoughts: From an outside perspective, this is where you would type the 3 bit ID into Cangaroo? |
||
| #define PROJECT_CAN_ID_SCIENCE_STEPPER_PCB_R 0x091U | ||
|
|
||
|
|
||
|
|
||
| /* ========================= | ||
| * Servo application sizing | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,8 @@ const uint32_t g_can_rx_id_filter[] = | |
| PROJECT_CAN_ID_SCIENCE_DC_MOTOR_R, | ||
| PROJECT_CAN_ID_SCIENCE_SERVO_PCB_C, | ||
| PROJECT_CAN_ID_SCIENCE_SERVO_PCB_R, | ||
| PROJECT_CAN_ID_SCIENCE_STEPPER_PCB_C, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Including Science Stepper Now |
||
| PROJECT_CAN_ID_SCIENCE_STEPPER_PCB_R, | ||
| }; | ||
| #else | ||
| const uint32_t g_can_rx_id_filter[] = | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.