drivers: stepper: Renamed Fault Event + Non Static Event Trigger

Renamed fault event to be more in line with other events and added it to
the stepper shell.
Makes the event callback trigger function of the step-dir implementation
non-static so that step-dir stepper drivers can use it to trigger events
themself.

Signed-off-by: Jan Behrens <jan.behrens@navimatix.de>
This commit is contained in:
Jan Behrens 2025-03-28 11:25:21 +01:00 committed by Benjamin Cabé
parent 2b8af597ce
commit c8c79a9fc6
4 changed files with 12 additions and 2 deletions

View File

@ -53,7 +53,7 @@ static inline int step_dir_stepper_perform_step(const struct device *dev)
return 0;
}
static void stepper_trigger_callback(const struct device *dev, enum stepper_event event)
void stepper_trigger_callback(const struct device *dev, enum stepper_event event)
{
struct step_dir_stepper_common_data *data = dev->data;

View File

@ -225,6 +225,13 @@ int step_dir_stepper_common_set_event_callback(const struct device *dev,
*/
void stepper_handle_timing_signal(const struct device *dev);
/**
* @brief Trigger callback function for stepper motor events.
* @param dev Pointer to the device structure.
* @param event The stepper_event to rigger the callback for.
*/
void stepper_trigger_callback(const struct device *dev, enum stepper_event event);
/** @} */
#endif /* ZEPHYR_DRIVER_STEPPER_STEP_DIR_STEPPER_COMMON_H_ */

View File

@ -64,6 +64,9 @@ static void print_callback(const struct device *dev, const enum stepper_event ev
case STEPPER_EVENT_STOPPED:
shell_info(sh, "%s: Stepper stopped.", dev->name);
break;
case STEPPER_EVENT_FAULT_DETECTED:
shell_info(sh, "%s: Fault detected.", dev->name);
break;
default:
shell_info(sh, "%s: Unknown signal received.", dev->name);
break;

View File

@ -103,7 +103,7 @@ enum stepper_event {
/** Stepper has stopped */
STEPPER_EVENT_STOPPED = 4,
/** Fault with the stepper controller detected */
STEPPER_FAULT_EVENT = 5,
STEPPER_EVENT_FAULT_DETECTED = 5,
};
/**