\section{aversive\_\-10-03-12/modules/devices/brushless\_\-motors/brushless\_\-3phase\_\-digital\_\-hall\_\-double/brushless.h File Reference}
\label{double_2brushless_8h}\index{aversive\_\-10-03-12/modules/devices/brushless\_\-motors/brushless\_\-3phase\_\-digital\_\-hall\_\-double/brushless.h@{aversive\_\-10-03-12/modules/devices/brushless\_\-motors/brushless\_\-3phase\_\-digital\_\-hall\_\-double/brushless.h}}
{\tt \#include $<$utils.h$>$}\par
{\tt \#include $<$brushless\_\-3phase\_\-digital\_\-hall\_\-double\_\-config.h$>$}\par
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct {\bf brushless}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void {\bf brushless\_\-init} (void)
\item 
void {\bf brushless\_\-0\_\-set\_\-parameters} (brushless\_\-speed speed, brushless\_\-torque torque)
\item 
void {\bf brushless\_\-1\_\-set\_\-parameters} (brushless\_\-speed speed, brushless\_\-torque torque)
\item 
{\bf brushless} {\bf brushless\_\-0\_\-get\_\-mesures} (void)
\item 
{\bf brushless} {\bf brushless\_\-1\_\-get\_\-mesures} (void)
\item 
void {\bf brushless\_\-0\_\-set\_\-position} (brushless\_\-position p)
\item 
void {\bf brushless\_\-1\_\-set\_\-position} (brushless\_\-position p)
\item 
void {\bf brushless\_\-0\_\-register\_\-periodic\_\-event} (void($\ast$f)({\bf brushless}))
\item 
void {\bf brushless\_\-1\_\-register\_\-periodic\_\-event} (void($\ast$f)({\bf brushless}))
\item 
int32\_\-t {\bf brushless\_\-get\_\-speed} (void $\ast$)
\item 
int32\_\-t {\bf brushless\_\-get\_\-pos} (void $\ast$)
\item 
void {\bf brushless\_\-set\_\-torque} (void $\ast$, int32\_\-t torque)
\item 
void {\bf brushless\_\-set\_\-speed} (void $\ast$, int32\_\-t speed)
\end{CompactItemize}


\subsection{Function Documentation}
\index{double/brushless.h@{double/brushless.h}!brushless\_\-0\_\-get\_\-mesures@{brushless\_\-0\_\-get\_\-mesures}}
\index{brushless\_\-0\_\-get\_\-mesures@{brushless\_\-0\_\-get\_\-mesures}!double/brushless.h@{double/brushless.h}}
\subsubsection[brushless\_\-0\_\-get\_\-mesures]{\setlength{\rightskip}{0pt plus 5cm}{\bf brushless} brushless\_\-0\_\-get\_\-mesures (void)}\label{double_2brushless_8h_6b7453842da7738f63bdf673fab877e7}


calculates the speed update info. To be called externally only if not internally, ie if the BRUSHLESS\_\-MANAGE\_\-EXTERNAL is set get current speed and position This function is very useful to get synchronous speed and torque info 

Definition at line 475 of file brushless.c.

References IRQ\_\-LOCK, and IRQ\_\-UNLOCK.

Referenced by brushless\_\-get\_\-pos(), and brushless\_\-get\_\-speed().\index{double/brushless.h@{double/brushless.h}!brushless\_\-0\_\-register\_\-periodic\_\-event@{brushless\_\-0\_\-register\_\-periodic\_\-event}}
\index{brushless\_\-0\_\-register\_\-periodic\_\-event@{brushless\_\-0\_\-register\_\-periodic\_\-event}!double/brushless.h@{double/brushless.h}}
\subsubsection[brushless\_\-0\_\-register\_\-periodic\_\-event]{\setlength{\rightskip}{0pt plus 5cm}void brushless\_\-0\_\-register\_\-periodic\_\-event (void($\ast$)({\bf brushless}) {\em f})}\label{double_2brushless_8h_6f17e78b390032ca77bcc1915dd737d0}


registers an event function that triggers periodically, and synchronously with the speed measurement 

Definition at line 500 of file brushless.c.

References parse\_\-symbols::f, IRQ\_\-LOCK, IRQ\_\-UNLOCK, and periodic\_\-event\_\-0.\index{double/brushless.h@{double/brushless.h}!brushless\_\-0\_\-set\_\-parameters@{brushless\_\-0\_\-set\_\-parameters}}
\index{brushless\_\-0\_\-set\_\-parameters@{brushless\_\-0\_\-set\_\-parameters}!double/brushless.h@{double/brushless.h}}
\subsubsection[brushless\_\-0\_\-set\_\-parameters]{\setlength{\rightskip}{0pt plus 5cm}void brushless\_\-0\_\-set\_\-parameters (brushless\_\-speed {\em speed}, \/  brushless\_\-torque {\em torque})}\label{double_2brushless_8h_cc7d58938deec5e61bf770ed626e56f5}


sets a consign speed and torque if you do not use the speed coarse limitation, please configure with BRUSHLESS\_\-MAX\_\-SPEED 

Definition at line 438 of file brushless.c.

References g\_\-brushless\_\-0\_\-pwm\_\-divider, g\_\-brushless\_\-0\_\-torque, IRQ\_\-LOCK, IRQ\_\-UNLOCK, and pwm\_\-previous\_\-sensors\_\-0.

Referenced by brushless\_\-set\_\-speed(), and brushless\_\-set\_\-torque().\index{double/brushless.h@{double/brushless.h}!brushless\_\-0\_\-set\_\-position@{brushless\_\-0\_\-set\_\-position}}
\index{brushless\_\-0\_\-set\_\-position@{brushless\_\-0\_\-set\_\-position}!double/brushless.h@{double/brushless.h}}
\subsubsection[brushless\_\-0\_\-set\_\-position]{\setlength{\rightskip}{0pt plus 5cm}void brushless\_\-0\_\-set\_\-position (brushless\_\-position {\em p})}\label{double_2brushless_8h_acc1256e5c10a361cc7b4fafe89b3df3}


sets the position counter 

Definition at line 489 of file brushless.c.

References g\_\-brushless\_\-0\_\-position\_\-previous, IRQ\_\-LOCK, IRQ\_\-UNLOCK, and brushless::position.\index{double/brushless.h@{double/brushless.h}!brushless\_\-1\_\-get\_\-mesures@{brushless\_\-1\_\-get\_\-mesures}}
\index{brushless\_\-1\_\-get\_\-mesures@{brushless\_\-1\_\-get\_\-mesures}!double/brushless.h@{double/brushless.h}}
\subsubsection[brushless\_\-1\_\-get\_\-mesures]{\setlength{\rightskip}{0pt plus 5cm}{\bf brushless} brushless\_\-1\_\-get\_\-mesures (void)}\label{double_2brushless_8h_59ef06622ea577a3eed6809940cc161f}




Definition at line 634 of file brushless.c.

References IRQ\_\-LOCK, and IRQ\_\-UNLOCK.

Referenced by brushless\_\-get\_\-pos(), and brushless\_\-get\_\-speed().\index{double/brushless.h@{double/brushless.h}!brushless\_\-1\_\-register\_\-periodic\_\-event@{brushless\_\-1\_\-register\_\-periodic\_\-event}}
\index{brushless\_\-1\_\-register\_\-periodic\_\-event@{brushless\_\-1\_\-register\_\-periodic\_\-event}!double/brushless.h@{double/brushless.h}}
\subsubsection[brushless\_\-1\_\-register\_\-periodic\_\-event]{\setlength{\rightskip}{0pt plus 5cm}void brushless\_\-1\_\-register\_\-periodic\_\-event (void($\ast$)({\bf brushless}) {\em f})}\label{double_2brushless_8h_d5da706548af1cacfd4fe95abcec3731}




Definition at line 673 of file brushless.c.

References parse\_\-symbols::f, IRQ\_\-LOCK, IRQ\_\-UNLOCK, and periodic\_\-event\_\-1.\index{double/brushless.h@{double/brushless.h}!brushless\_\-1\_\-set\_\-parameters@{brushless\_\-1\_\-set\_\-parameters}}
\index{brushless\_\-1\_\-set\_\-parameters@{brushless\_\-1\_\-set\_\-parameters}!double/brushless.h@{double/brushless.h}}
\subsubsection[brushless\_\-1\_\-set\_\-parameters]{\setlength{\rightskip}{0pt plus 5cm}void brushless\_\-1\_\-set\_\-parameters (brushless\_\-speed {\em speed}, \/  brushless\_\-torque {\em torque})}\label{double_2brushless_8h_9d0039676070088bbd00a7b635d69ba4}




Definition at line 588 of file brushless.c.

References g\_\-brushless\_\-1\_\-pwm\_\-divider, g\_\-brushless\_\-1\_\-torque, IRQ\_\-LOCK, IRQ\_\-UNLOCK, and pwm\_\-previous\_\-sensors\_\-1.

Referenced by brushless\_\-set\_\-speed(), and brushless\_\-set\_\-torque().\index{double/brushless.h@{double/brushless.h}!brushless\_\-1\_\-set\_\-position@{brushless\_\-1\_\-set\_\-position}}
\index{brushless\_\-1\_\-set\_\-position@{brushless\_\-1\_\-set\_\-position}!double/brushless.h@{double/brushless.h}}
\subsubsection[brushless\_\-1\_\-set\_\-position]{\setlength{\rightskip}{0pt plus 5cm}void brushless\_\-1\_\-set\_\-position (brushless\_\-position {\em p})}\label{double_2brushless_8h_50303cb9d376d6f8e2e8ca91d0f2d30d}




Definition at line 656 of file brushless.c.

References g\_\-brushless\_\-1\_\-position\_\-previous, IRQ\_\-LOCK, IRQ\_\-UNLOCK, and brushless::position.\index{double/brushless.h@{double/brushless.h}!brushless\_\-get\_\-pos@{brushless\_\-get\_\-pos}}
\index{brushless\_\-get\_\-pos@{brushless\_\-get\_\-pos}!double/brushless.h@{double/brushless.h}}
\subsubsection[brushless\_\-get\_\-pos]{\setlength{\rightskip}{0pt plus 5cm}int32\_\-t brushless\_\-get\_\-pos (void $\ast$ {\em motor\_\-num})}\label{double_2brushless_8h_1139da9b279d32981019b469b2d18969}


get position function, compatible with control\_\-system. Argument is the number of the adressed motor, which is casted to (void$\ast$)

get position function, compatible with control\_\-system. Argument not used. 

Definition at line 524 of file brushless.c.

References brushless\_\-0\_\-get\_\-mesures(), brushless\_\-1\_\-get\_\-mesures(), and brushless::position.\index{double/brushless.h@{double/brushless.h}!brushless\_\-get\_\-speed@{brushless\_\-get\_\-speed}}
\index{brushless\_\-get\_\-speed@{brushless\_\-get\_\-speed}!double/brushless.h@{double/brushless.h}}
\subsubsection[brushless\_\-get\_\-speed]{\setlength{\rightskip}{0pt plus 5cm}int32\_\-t brushless\_\-get\_\-speed (void $\ast$ {\em motor\_\-num})}\label{double_2brushless_8h_f75eb45fe7c46235ba795e797e661cc4}


acess functions for the control system interface get speed function, compatible with control\_\-system. Argument is the number of the adressed motor, which is casted to (void$\ast$)

acess functions for the control system interface get speed function, compatible with control\_\-system. Argument not used. 

Definition at line 514 of file brushless.c.

References brushless\_\-0\_\-get\_\-mesures(), brushless\_\-1\_\-get\_\-mesures(), and brushless::speed.\index{double/brushless.h@{double/brushless.h}!brushless\_\-init@{brushless\_\-init}}
\index{brushless\_\-init@{brushless\_\-init}!double/brushless.h@{double/brushless.h}}
\subsubsection[brushless\_\-init]{\setlength{\rightskip}{0pt plus 5cm}void brushless\_\-init (void)}\label{double_2brushless_8h_5bcb47056126e1f5d75692599eafdf1f}


initialisation, also executes pwm\_\-init 

Definition at line 417 of file brushless.c.

References INIT\_\-INT, pwm\_\-init(), and sbi.\index{double/brushless.h@{double/brushless.h}!brushless\_\-set\_\-speed@{brushless\_\-set\_\-speed}}
\index{brushless\_\-set\_\-speed@{brushless\_\-set\_\-speed}!double/brushless.h@{double/brushless.h}}
\subsubsection[brushless\_\-set\_\-speed]{\setlength{\rightskip}{0pt plus 5cm}void brushless\_\-set\_\-speed (void $\ast$ {\em motor\_\-num}, \/  int32\_\-t {\em speed})}\label{double_2brushless_8h_30909f3244dfa44e947d7be786b089bc}


set speed function, compatible with control\_\-system. Argument is the number of the adressed motor, which is casted to (void$\ast$)

set speed function, compatible with control\_\-system. first argument not used. 

Definition at line 540 of file brushless.c.

References brushless\_\-0\_\-set\_\-parameters(), and brushless\_\-1\_\-set\_\-parameters().\index{double/brushless.h@{double/brushless.h}!brushless\_\-set\_\-torque@{brushless\_\-set\_\-torque}}
\index{brushless\_\-set\_\-torque@{brushless\_\-set\_\-torque}!double/brushless.h@{double/brushless.h}}
\subsubsection[brushless\_\-set\_\-torque]{\setlength{\rightskip}{0pt plus 5cm}void brushless\_\-set\_\-torque (void $\ast$ {\em motor\_\-num}, \/  int32\_\-t {\em torque})}\label{double_2brushless_8h_8d02023af51879add6e1ba3ce110714c}


set torque function, compatible with control\_\-system. Argument is the number of the adressed motor, which is casted to (void$\ast$)

set torque function, compatible with control\_\-system. first argument not used. 

Definition at line 534 of file brushless.c.

References brushless\_\-0\_\-set\_\-parameters(), and brushless\_\-1\_\-set\_\-parameters().