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
18 changes: 18 additions & 0 deletions src/code/motor_stall/motor_stall_header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
typedef struct {
float measured_current_A; // Measured current in Amperes
float commanded_bus_voltage_V; // Commanded bus voltage in Volts
float motor_speed_rad_per_s; // Motor speed in radians per second from encoder
} motor_input_data_t;

typedef struct {
motor_input_data_t input_data;
bool is_stalled; // True if the motor is stalled, false otherwise
// Additional variables can be added as needed
} motor_handle_t;

/**
* @brief Function to be called every 1 ms for motor stall detection
* @param motor Pointer to the motor handle structure
*/
void motor_stall_detect_period_run_1ms(motor_handle_t *motor);

5 changes: 5 additions & 0 deletions src/main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@
\subfile{buck_vs_ldo.tex} % place after passives.tex, opamp.tex
\newpage

\subfile{second_edition.tex}
\newpage
\subfile{motor_stall.tex}
\newpage

% Appendix
\subfile{appendix_packet_parsing_tests.tex}
\newpage
Expand Down
16 changes: 16 additions & 0 deletions src/motor_stall.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
\documentclass[main.tex]{subfiles}

\begin{document}
\section{Suppose a DC motor is connected to a load - how would you detect a stalled-rotor condition?}
Assume the header in Listing \ref{code:motor-stall-header} is provided. Discuss the implementation of stalled-rotor detection in the following circumstances:
\begin{itemize}
\item The DC motor features only a current sensor.
\item The DC motor features only an encoder.
\end{itemize}

\lstinputlisting[caption={Motor Stall Detection Header}, label={code:motor-stall-header}]{code/motor_stall/motor_stall_header.h}

\spoilerline


\end{document}
12 changes: 12 additions & 0 deletions src/second_edition.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
\documentclass[main.tex]{subfiles}
\begin{document}

\begin{center}
------------ \textbf{2nd Edition} ------------
Copy link

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Avoid hardcoding dashed lines; consider using LaTeX constructs like \hrulefill or \rule to draw a horizontal line, which improves consistency and makes future styling easier.

Suggested change
------------ \textbf{2nd Edition} ------------
\hrulefill \textbf{2nd Edition} \hrulefill

Copilot uses AI. Check for mistakes.

\end{center}

\section{What's new in the 2nd Edition?}
After receiving feedback from readers of the first edition, we've added a couple more new questions and answers from what people felt were missing topics. We hope you enjoy the new content and as always, please reach out with any feedback or suggestions for future editions! \bluehref{Form link to connect with us.}{https://circuits-and-code.github.io/connect/}
Copy link

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The link text “Form link to connect with us.” is unclear and grammatically awkward; consider rephrasing to something like “Fill out our form to connect with us.” for better readability.

Suggested change
After receiving feedback from readers of the first edition, we've added a couple more new questions and answers from what people felt were missing topics. We hope you enjoy the new content and as always, please reach out with any feedback or suggestions for future editions! \bluehref{Form link to connect with us.}{https://circuits-and-code.github.io/connect/}
After receiving feedback from readers of the first edition, we've added a couple more new questions and answers from what people felt were missing topics. We hope you enjoy the new content and as always, please reach out with any feedback or suggestions for future editions! \bluehref{Fill out our form to connect with us.}{https://circuits-and-code.github.io/connect/}

Copilot uses AI. Check for mistakes.



\end{document}