\section{aversive\_\-10-03-12/modules/devices/brushless\_\-motors/brushless\_\-3phase\_\-digital\_\-hall\_\-double/brushless.c File Reference}
\label{double_2brushless_8c}\index{aversive\_\-10-03-12/modules/devices/brushless\_\-motors/brushless\_\-3phase\_\-digital\_\-hall\_\-double/brushless.c@{aversive\_\-10-03-12/modules/devices/brushless\_\-motors/brushless\_\-3phase\_\-digital\_\-hall\_\-double/brushless.c}}
{\tt \#include $<$avr/io.h$>$}\par
{\tt \#include $<$avr/signal.h$>$}\par
{\tt \#include $<$pwm.h$>$}\par
{\tt \#include $<$utils.h$>$}\par
{\tt \#include $<$avr/pgmspace.h$>$}\par
{\tt \#include $<$brushless.h$>$}\par
{\tt \#include \char`\"{}brushless\_\-3phase\_\-digital\_\-hall\_\-double\_\-config.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define {\bf INIT\_\-INT}()~sbi(TIMSK, TOIE0)
\item 
\#define {\bf INT}~SIG\_\-OVERFLOW0
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void {\bf brushless\_\-speed\_\-update\_\-manage} (void $\ast$dummy)
\item 
volatile uint8\_\-t pwm\_\-division\_\-timer {\bf asm} (\char`\"{}pwm\_\-div\char`\"{})
\item 
{\bf SIGNAL} (INT)
\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$motor\_\-num)
\item 
int32\_\-t {\bf brushless\_\-get\_\-pos} (void $\ast$motor\_\-num)
\item 
void {\bf brushless\_\-set\_\-torque} (void $\ast$motor\_\-num, int32\_\-t torque)
\item 
void {\bf brushless\_\-set\_\-speed} (void $\ast$motor\_\-num, int32\_\-t speed)
\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
const int8\_\-t {\bf g\_\-brushless\_\-angle} [$\,$] = \{0, 1, 5, 0, 3, 2, 4, 0\}
\item 
const int8\_\-t {\bf PROGMEM} {\bf g\_\-brushless\_\-phase1} [$\,$] = \{0, 1, -1, 0, 0, 1, -1, 0\}
\item 
const int8\_\-t {\bf PROGMEM} {\bf g\_\-brushless\_\-phase2} [$\,$] = \{0, 0, 1, 1, -1, -1, 0, 0\}
\item 
const int8\_\-t {\bf PROGMEM} {\bf g\_\-brushless\_\-phase3} [$\,$] = \{0, -1, 0, -1, 1, 0, 1, 0\}
\item 
brushless\_\-position {\bf g\_\-brushless\_\-0\_\-position\_\-previous}
\item 
brushless\_\-position {\bf g\_\-brushless\_\-1\_\-position\_\-previous}
\item 
{\bf brushless} {\bf g\_\-brushless\_\-0}
\item 
{\bf brushless} {\bf g\_\-brushless\_\-1}
\item 
brushless\_\-torque {\bf g\_\-brushless\_\-0\_\-torque}
\item 
brushless\_\-torque {\bf g\_\-brushless\_\-1\_\-torque}
\item 
uint16\_\-t {\bf g\_\-brushless\_\-0\_\-pwm\_\-divider} = 1
\item 
uint16\_\-t {\bf g\_\-brushless\_\-1\_\-pwm\_\-divider} = 1
\item 
void($\ast$ {\bf periodic\_\-event\_\-0} )({\bf brushless})=0
\item 
void($\ast$ {\bf periodic\_\-event\_\-1} )({\bf brushless})=0
\item 
volatile uint8\_\-t {\bf interrupt\_\-pwm}
\item 
volatile uint8\_\-t {\bf pwm\_\-previous\_\-sensors\_\-0} = 0
\item 
volatile uint8\_\-t {\bf pwm\_\-previous\_\-sensors\_\-1} = 0
\item 
brushless\_\-speed {\bf speed\_\-mem\_\-0} = BRUSHLESS\_\-MAX\_\-SPEED
\item 
brushless\_\-torque {\bf torque\_\-mem\_\-0} = 0
\item 
brushless\_\-speed {\bf speed\_\-mem\_\-1} = BRUSHLESS\_\-MAX\_\-SPEED
\item 
brushless\_\-torque {\bf torque\_\-mem\_\-1} = 0
\end{CompactItemize}


\subsection{Define Documentation}
\index{double/brushless.c@{double/brushless.c}!INIT\_\-INT@{INIT\_\-INT}}
\index{INIT\_\-INT@{INIT\_\-INT}!double/brushless.c@{double/brushless.c}}
\subsubsection[INIT\_\-INT]{\setlength{\rightskip}{0pt plus 5cm}\#define INIT\_\-INT()~sbi(TIMSK, TOIE0)}\label{double_2brushless_8c_d94ed6bd7fe0f1469ccf9afce74f2dda}


This module handles a \doxyref{brushless}{p.}{structbrushless} motor with 3 phases, wired in triangle or star. 3 hall sensors are used wih digital output. 3 PWM are outputted, these MUST be synchronized !!

The control value is a voltage. This can be assimiled to a torque at low speeds.

There is a possibility of also of limiting the speed. This is accomplished by slowing down the sampling speed of the sensors. Doing this,the motor effective torque is reduced when the speed is such that the sensor actuation approaches the sampling frequency. use this technique carefully, because the motor has already his full voltage applied, an can dissipate a lot of energy, especially at low speeds.

there is no external manage function, as the manage is done at the PWM speed (overflow of one PWM timer is used.) This function is speed optimized. ceci est une commande de moteur \doxyref{brushless}{p.}{structbrushless} triphase en etoile, utilisant 3 capteurs a effet hall digitaux. En sortie on a 3 PWM (il est necessaire de les synchroniser !)

pour le commande en couple, on joue sur les pwm (pseudo-couple) et pour la commande en vitesse, on joue sur la frequence de rafraichissement des phases par rapport aux capteurs. cette astuce simple permet de faire facilement une consigne de vitesse (pas besoin d'asservissement) mais des vitesses faibles sont saccadees. calculating the event to use, based on PWM definition of the phase 1 The two motors function on the same timer! 

Definition at line 78 of file brushless.c.\index{double/brushless.c@{double/brushless.c}!INT@{INT}}
\index{INT@{INT}!double/brushless.c@{double/brushless.c}}
\subsubsection[INT]{\setlength{\rightskip}{0pt plus 5cm}\#define INT~SIG\_\-OVERFLOW0}\label{double_2brushless_8c_feeffe52c8fd59db7c61cf8b02042dbf}




Definition at line 79 of file brushless.c.

\subsection{Function Documentation}
\index{double/brushless.c@{double/brushless.c}!asm@{asm}}
\index{asm@{asm}!double/brushless.c@{double/brushless.c}}
\subsubsection[asm]{\setlength{\rightskip}{0pt plus 5cm}volatile uint8\_\-t pwm\_\-division\_\-timer asm (\char`\"{}pwm\_\-div\char`\"{})}\label{double_2brushless_8c_476a9cc314407b29514ce8e1e2a2927e}


This function is made of 5 parts :\begin{itemize}
\item pwm divsion : gives a master frequency for the next parts, by dividing the PWM frequency (can also be set to 1)\item sensors acquisition : done every time\item angle update : done when there is a change in sensor state since last angle update\item PWM update : done only every x (every g\_\-brushless\_\-recurrence -1) and skipped if there is no change since last pwm update\item speed update : done only every y () this updates the speed\end{itemize}


Typically, PWM update is slower than angle update, in order to not skip angle counting.

Typically, speed update is a lot slower than angle update in order to have a speed that is sampled at a correct rate. This event can trigger an action, this is especially used if you have a servo control.

examples for a pretty fast motor :\begin{itemize}
\item PWM at 30 kHz\item angle update at 10 kHz\item PWM update at 5 kHz or lower, depending on speed setting\item speed update at 100 Hz \end{itemize}
\index{double/brushless.c@{double/brushless.c}!brushless\_\-0\_\-get\_\-mesures@{brushless\_\-0\_\-get\_\-mesures}}
\index{brushless\_\-0\_\-get\_\-mesures@{brushless\_\-0\_\-get\_\-mesures}!double/brushless.c@{double/brushless.c}}
\subsubsection[brushless\_\-0\_\-get\_\-mesures]{\setlength{\rightskip}{0pt plus 5cm}{\bf brushless} brushless\_\-0\_\-get\_\-mesures (void)}\label{double_2brushless_8c_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 623 of file brushless.c.

References IRQ\_\-LOCK, and IRQ\_\-UNLOCK.\index{double/brushless.c@{double/brushless.c}!brushless\_\-0\_\-register\_\-periodic\_\-event@{brushless\_\-0\_\-register\_\-periodic\_\-event}}
\index{brushless\_\-0\_\-register\_\-periodic\_\-event@{brushless\_\-0\_\-register\_\-periodic\_\-event}!double/brushless.c@{double/brushless.c}}
\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_8c_6f17e78b390032ca77bcc1915dd737d0}


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

Definition at line 666 of file brushless.c.

References parse\_\-symbols::f, IRQ\_\-LOCK, IRQ\_\-UNLOCK, and periodic\_\-event\_\-0.\index{double/brushless.c@{double/brushless.c}!brushless\_\-0\_\-set\_\-parameters@{brushless\_\-0\_\-set\_\-parameters}}
\index{brushless\_\-0\_\-set\_\-parameters@{brushless\_\-0\_\-set\_\-parameters}!double/brushless.c@{double/brushless.c}}
\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_8c_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 555 of file brushless.c.

References g\_\-brushless\_\-0\_\-pwm\_\-divider, g\_\-brushless\_\-0\_\-torque, IRQ\_\-LOCK, IRQ\_\-UNLOCK, and pwm\_\-previous\_\-sensors\_\-0.\index{double/brushless.c@{double/brushless.c}!brushless\_\-0\_\-set\_\-position@{brushless\_\-0\_\-set\_\-position}}
\index{brushless\_\-0\_\-set\_\-position@{brushless\_\-0\_\-set\_\-position}!double/brushless.c@{double/brushless.c}}
\subsubsection[brushless\_\-0\_\-set\_\-position]{\setlength{\rightskip}{0pt plus 5cm}void brushless\_\-0\_\-set\_\-position (brushless\_\-position {\em p})}\label{double_2brushless_8c_acc1256e5c10a361cc7b4fafe89b3df3}


sets the position counter 

Definition at line 648 of file brushless.c.

References g\_\-brushless\_\-0\_\-position\_\-previous, IRQ\_\-LOCK, IRQ\_\-UNLOCK, and brushless::position.\index{double/brushless.c@{double/brushless.c}!brushless\_\-1\_\-get\_\-mesures@{brushless\_\-1\_\-get\_\-mesures}}
\index{brushless\_\-1\_\-get\_\-mesures@{brushless\_\-1\_\-get\_\-mesures}!double/brushless.c@{double/brushless.c}}
\subsubsection[brushless\_\-1\_\-get\_\-mesures]{\setlength{\rightskip}{0pt plus 5cm}{\bf brushless} brushless\_\-1\_\-get\_\-mesures (void)}\label{double_2brushless_8c_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.c@{double/brushless.c}!brushless\_\-1\_\-register\_\-periodic\_\-event@{brushless\_\-1\_\-register\_\-periodic\_\-event}}
\index{brushless\_\-1\_\-register\_\-periodic\_\-event@{brushless\_\-1\_\-register\_\-periodic\_\-event}!double/brushless.c@{double/brushless.c}}
\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_8c_d5da706548af1cacfd4fe95abcec3731}




Definition at line 673 of file brushless.c.

References parse\_\-symbols::f, IRQ\_\-LOCK, IRQ\_\-UNLOCK, and periodic\_\-event\_\-1.\index{double/brushless.c@{double/brushless.c}!brushless\_\-1\_\-set\_\-parameters@{brushless\_\-1\_\-set\_\-parameters}}
\index{brushless\_\-1\_\-set\_\-parameters@{brushless\_\-1\_\-set\_\-parameters}!double/brushless.c@{double/brushless.c}}
\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_8c_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.c@{double/brushless.c}!brushless\_\-1\_\-set\_\-position@{brushless\_\-1\_\-set\_\-position}}
\index{brushless\_\-1\_\-set\_\-position@{brushless\_\-1\_\-set\_\-position}!double/brushless.c@{double/brushless.c}}
\subsubsection[brushless\_\-1\_\-set\_\-position]{\setlength{\rightskip}{0pt plus 5cm}void brushless\_\-1\_\-set\_\-position (brushless\_\-position {\em p})}\label{double_2brushless_8c_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.c@{double/brushless.c}!brushless\_\-get\_\-pos@{brushless\_\-get\_\-pos}}
\index{brushless\_\-get\_\-pos@{brushless\_\-get\_\-pos}!double/brushless.c@{double/brushless.c}}
\subsubsection[brushless\_\-get\_\-pos]{\setlength{\rightskip}{0pt plus 5cm}int32\_\-t brushless\_\-get\_\-pos (void $\ast$ {\em motor\_\-num})}\label{double_2brushless_8c_93c096b3f66b3e74977256620a2911a0}


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

Definition at line 700 of file brushless.c.

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


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

Definition at line 687 of file brushless.c.

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


initialisation, also executes pwm\_\-init 

Definition at line 528 of file brushless.c.

References INIT\_\-INT, pwm\_\-init(), and sbi.\index{double/brushless.c@{double/brushless.c}!brushless\_\-set\_\-speed@{brushless\_\-set\_\-speed}}
\index{brushless\_\-set\_\-speed@{brushless\_\-set\_\-speed}!double/brushless.c@{double/brushless.c}}
\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_8c_a363e834ead59b050b763245bde14219}


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

Definition at line 722 of file brushless.c.

References brushless\_\-0\_\-set\_\-parameters(), and brushless\_\-1\_\-set\_\-parameters().\index{double/brushless.c@{double/brushless.c}!brushless\_\-set\_\-torque@{brushless\_\-set\_\-torque}}
\index{brushless\_\-set\_\-torque@{brushless\_\-set\_\-torque}!double/brushless.c@{double/brushless.c}}
\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_8c_14942e7c6915d8876257aa52275d256b}


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

Definition at line 713 of file brushless.c.

References brushless\_\-0\_\-set\_\-parameters(), and brushless\_\-1\_\-set\_\-parameters().\index{double/brushless.c@{double/brushless.c}!brushless\_\-speed\_\-update\_\-manage@{brushless\_\-speed\_\-update\_\-manage}}
\index{brushless\_\-speed\_\-update\_\-manage@{brushless\_\-speed\_\-update\_\-manage}!double/brushless.c@{double/brushless.c}}
\subsubsection[brushless\_\-speed\_\-update\_\-manage]{\setlength{\rightskip}{0pt plus 5cm}void brushless\_\-speed\_\-update\_\-manage (void $\ast$ {\em dummy})}\label{double_2brushless_8c_128c0146712a50e1a4fcea2440122176}


\index{double/brushless.c@{double/brushless.c}!SIGNAL@{SIGNAL}}
\index{SIGNAL@{SIGNAL}!double/brushless.c@{double/brushless.c}}
\subsubsection[SIGNAL]{\setlength{\rightskip}{0pt plus 5cm}SIGNAL (INT)}\label{double_2brushless_8c_a6f619912e40d56460003b114deb9b0f}




PWM division part

various definitions

sensors acquisition part extraction of the sensor signals, and built up of a 3 bit ordened byte this is done every time

the angle update part

sensors acquisition part extraction of the sensor signals, and built up of a 3 bit ordened byte this is done every time

the angle update part

speed update part 

Definition at line 215 of file brushless.c.

References brushless\_\-speed\_\-update\_\-manage(), g\_\-brushless\_\-0\_\-pwm\_\-divider, g\_\-brushless\_\-0\_\-torque, g\_\-brushless\_\-1\_\-pwm\_\-divider, g\_\-brushless\_\-1\_\-torque, g\_\-brushless\_\-angle, g\_\-brushless\_\-phase1, g\_\-brushless\_\-phase2, g\_\-brushless\_\-phase3, interrupt\_\-pwm, IRQ\_\-LOCK, IRQ\_\-UNLOCK, PIN, brushless::position, PWM\_\-MAX, pwm\_\-previous\_\-sensors\_\-0, pwm\_\-previous\_\-sensors\_\-1, and sei.

\subsection{Variable Documentation}
\index{double/brushless.c@{double/brushless.c}!g\_\-brushless\_\-0@{g\_\-brushless\_\-0}}
\index{g\_\-brushless\_\-0@{g\_\-brushless\_\-0}!double/brushless.c@{double/brushless.c}}
\subsubsection[g\_\-brushless\_\-0]{\setlength{\rightskip}{0pt plus 5cm}{\bf brushless} {\bf g\_\-brushless\_\-0}}\label{double_2brushless_8c_00b42cd1a8b97cde281c526e45db0300}




Definition at line 126 of file brushless.c.\index{double/brushless.c@{double/brushless.c}!g\_\-brushless\_\-0\_\-position\_\-previous@{g\_\-brushless\_\-0\_\-position\_\-previous}}
\index{g\_\-brushless\_\-0\_\-position\_\-previous@{g\_\-brushless\_\-0\_\-position\_\-previous}!double/brushless.c@{double/brushless.c}}
\subsubsection[g\_\-brushless\_\-0\_\-position\_\-previous]{\setlength{\rightskip}{0pt plus 5cm}brushless\_\-position {\bf g\_\-brushless\_\-0\_\-position\_\-previous}}\label{double_2brushless_8c_381e9e000eb592d9f6896b758b81eecf}




Definition at line 122 of file brushless.c.\index{double/brushless.c@{double/brushless.c}!g\_\-brushless\_\-0\_\-pwm\_\-divider@{g\_\-brushless\_\-0\_\-pwm\_\-divider}}
\index{g\_\-brushless\_\-0\_\-pwm\_\-divider@{g\_\-brushless\_\-0\_\-pwm\_\-divider}!double/brushless.c@{double/brushless.c}}
\subsubsection[g\_\-brushless\_\-0\_\-pwm\_\-divider]{\setlength{\rightskip}{0pt plus 5cm}uint16\_\-t {\bf g\_\-brushless\_\-0\_\-pwm\_\-divider} = 1}\label{double_2brushless_8c_ccef0e3189ceed323349785125786218}




Definition at line 134 of file brushless.c.\index{double/brushless.c@{double/brushless.c}!g\_\-brushless\_\-0\_\-torque@{g\_\-brushless\_\-0\_\-torque}}
\index{g\_\-brushless\_\-0\_\-torque@{g\_\-brushless\_\-0\_\-torque}!double/brushless.c@{double/brushless.c}}
\subsubsection[g\_\-brushless\_\-0\_\-torque]{\setlength{\rightskip}{0pt plus 5cm}brushless\_\-torque {\bf g\_\-brushless\_\-0\_\-torque}}\label{double_2brushless_8c_5c6c3adac30e436ba80b07067bb47ac6}




Definition at line 130 of file brushless.c.\index{double/brushless.c@{double/brushless.c}!g\_\-brushless\_\-1@{g\_\-brushless\_\-1}}
\index{g\_\-brushless\_\-1@{g\_\-brushless\_\-1}!double/brushless.c@{double/brushless.c}}
\subsubsection[g\_\-brushless\_\-1]{\setlength{\rightskip}{0pt plus 5cm}{\bf brushless} {\bf g\_\-brushless\_\-1}}\label{double_2brushless_8c_9a885435b2c1989269687967f88571f4}




Definition at line 127 of file brushless.c.\index{double/brushless.c@{double/brushless.c}!g\_\-brushless\_\-1\_\-position\_\-previous@{g\_\-brushless\_\-1\_\-position\_\-previous}}
\index{g\_\-brushless\_\-1\_\-position\_\-previous@{g\_\-brushless\_\-1\_\-position\_\-previous}!double/brushless.c@{double/brushless.c}}
\subsubsection[g\_\-brushless\_\-1\_\-position\_\-previous]{\setlength{\rightskip}{0pt plus 5cm}brushless\_\-position {\bf g\_\-brushless\_\-1\_\-position\_\-previous}}\label{double_2brushless_8c_a6c4b9f1d47b0953701d952e8ffacf94}




Definition at line 123 of file brushless.c.

Referenced by brushless\_\-1\_\-set\_\-position().\index{double/brushless.c@{double/brushless.c}!g\_\-brushless\_\-1\_\-pwm\_\-divider@{g\_\-brushless\_\-1\_\-pwm\_\-divider}}
\index{g\_\-brushless\_\-1\_\-pwm\_\-divider@{g\_\-brushless\_\-1\_\-pwm\_\-divider}!double/brushless.c@{double/brushless.c}}
\subsubsection[g\_\-brushless\_\-1\_\-pwm\_\-divider]{\setlength{\rightskip}{0pt plus 5cm}uint16\_\-t {\bf g\_\-brushless\_\-1\_\-pwm\_\-divider} = 1}\label{double_2brushless_8c_552b6f1bc865fcc8bfe5a861c1474f9c}




Definition at line 135 of file brushless.c.

Referenced by brushless\_\-1\_\-set\_\-parameters(), and SIGNAL().\index{double/brushless.c@{double/brushless.c}!g\_\-brushless\_\-1\_\-torque@{g\_\-brushless\_\-1\_\-torque}}
\index{g\_\-brushless\_\-1\_\-torque@{g\_\-brushless\_\-1\_\-torque}!double/brushless.c@{double/brushless.c}}
\subsubsection[g\_\-brushless\_\-1\_\-torque]{\setlength{\rightskip}{0pt plus 5cm}brushless\_\-torque {\bf g\_\-brushless\_\-1\_\-torque}}\label{double_2brushless_8c_4d47fa93cd0649dd531136562c7f8b3c}




Definition at line 131 of file brushless.c.

Referenced by brushless\_\-1\_\-set\_\-parameters(), and SIGNAL().\index{double/brushless.c@{double/brushless.c}!g\_\-brushless\_\-angle@{g\_\-brushless\_\-angle}}
\index{g\_\-brushless\_\-angle@{g\_\-brushless\_\-angle}!double/brushless.c@{double/brushless.c}}
\subsubsection[g\_\-brushless\_\-angle]{\setlength{\rightskip}{0pt plus 5cm}const int8\_\-t {\bf g\_\-brushless\_\-angle}[$\,$] = \{0, 1, 5, 0, 3, 2, 4, 0\}}\label{double_2brushless_8c_427d5361a39448badf1815b8a08dc07c}


2 LUT tables: sensors $>$ relative electric angle sensors $>$ phase information

decimal value : 0 1 2 3 4 5 6 7 sensors state : 000 001 010 011 100 101 110 111 is this a valid state? : NO yes yes yes yes yes yes NO 

Definition at line 108 of file brushless.c.\index{double/brushless.c@{double/brushless.c}!g\_\-brushless\_\-phase1@{g\_\-brushless\_\-phase1}}
\index{g\_\-brushless\_\-phase1@{g\_\-brushless\_\-phase1}!double/brushless.c@{double/brushless.c}}
\subsubsection[g\_\-brushless\_\-phase1]{\setlength{\rightskip}{0pt plus 5cm}const int8\_\-t {\bf PROGMEM} {\bf g\_\-brushless\_\-phase1}[$\,$] = \{0, 1, -1, 0, 0, 1, -1, 0\}}\label{double_2brushless_8c_6e9c1b0bfcafdcad887323512b159025}




Definition at line 111 of file brushless.c.\index{double/brushless.c@{double/brushless.c}!g\_\-brushless\_\-phase2@{g\_\-brushless\_\-phase2}}
\index{g\_\-brushless\_\-phase2@{g\_\-brushless\_\-phase2}!double/brushless.c@{double/brushless.c}}
\subsubsection[g\_\-brushless\_\-phase2]{\setlength{\rightskip}{0pt plus 5cm}const int8\_\-t {\bf PROGMEM} {\bf g\_\-brushless\_\-phase2}[$\,$] = \{0, 0, 1, 1, -1, -1, 0, 0\}}\label{double_2brushless_8c_99fb69cebd7c4096ee75c0edbd9f3ff5}




Definition at line 112 of file brushless.c.\index{double/brushless.c@{double/brushless.c}!g\_\-brushless\_\-phase3@{g\_\-brushless\_\-phase3}}
\index{g\_\-brushless\_\-phase3@{g\_\-brushless\_\-phase3}!double/brushless.c@{double/brushless.c}}
\subsubsection[g\_\-brushless\_\-phase3]{\setlength{\rightskip}{0pt plus 5cm}const int8\_\-t {\bf PROGMEM} {\bf g\_\-brushless\_\-phase3}[$\,$] = \{0, -1, 0, -1, 1, 0, 1, 0\}}\label{double_2brushless_8c_6bc7ca97607485f0d635a6f116be4272}




Definition at line 113 of file brushless.c.\index{double/brushless.c@{double/brushless.c}!interrupt\_\-pwm@{interrupt\_\-pwm}}
\index{interrupt\_\-pwm@{interrupt\_\-pwm}!double/brushless.c@{double/brushless.c}}
\subsubsection[interrupt\_\-pwm]{\setlength{\rightskip}{0pt plus 5cm}volatile uint8\_\-t {\bf interrupt\_\-pwm}}\label{double_2brushless_8c_8e1edd895d9dcd83a60b79438a78cdcb}




Definition at line 168 of file brushless.c.\index{double/brushless.c@{double/brushless.c}!periodic\_\-event\_\-0@{periodic\_\-event\_\-0}}
\index{periodic\_\-event\_\-0@{periodic\_\-event\_\-0}!double/brushless.c@{double/brushless.c}}
\subsubsection[periodic\_\-event\_\-0]{\setlength{\rightskip}{0pt plus 5cm}void($\ast$ {\bf periodic\_\-event\_\-0})({\bf brushless})=0}\label{double_2brushless_8c_d81942b9b2a86175db69fd36c1874ea1}


\index{double/brushless.c@{double/brushless.c}!periodic\_\-event\_\-1@{periodic\_\-event\_\-1}}
\index{periodic\_\-event\_\-1@{periodic\_\-event\_\-1}!double/brushless.c@{double/brushless.c}}
\subsubsection[periodic\_\-event\_\-1]{\setlength{\rightskip}{0pt plus 5cm}void($\ast$ {\bf periodic\_\-event\_\-1})({\bf brushless})=0}\label{double_2brushless_8c_73874d31dc101a33d9b3d80b5a785992}




Referenced by brushless\_\-1\_\-register\_\-periodic\_\-event().\index{double/brushless.c@{double/brushless.c}!pwm\_\-previous\_\-sensors\_\-0@{pwm\_\-previous\_\-sensors\_\-0}}
\index{pwm\_\-previous\_\-sensors\_\-0@{pwm\_\-previous\_\-sensors\_\-0}!double/brushless.c@{double/brushless.c}}
\subsubsection[pwm\_\-previous\_\-sensors\_\-0]{\setlength{\rightskip}{0pt plus 5cm}volatile uint8\_\-t {\bf pwm\_\-previous\_\-sensors\_\-0} = 0}\label{double_2brushless_8c_ebaa64f289dfb5e91f8f517ace3ec961}




Definition at line 169 of file brushless.c.\index{double/brushless.c@{double/brushless.c}!pwm\_\-previous\_\-sensors\_\-1@{pwm\_\-previous\_\-sensors\_\-1}}
\index{pwm\_\-previous\_\-sensors\_\-1@{pwm\_\-previous\_\-sensors\_\-1}!double/brushless.c@{double/brushless.c}}
\subsubsection[pwm\_\-previous\_\-sensors\_\-1]{\setlength{\rightskip}{0pt plus 5cm}volatile uint8\_\-t {\bf pwm\_\-previous\_\-sensors\_\-1} = 0}\label{double_2brushless_8c_b1bf6b1f6893adfc26349ba08fd51ed8}




Definition at line 170 of file brushless.c.

Referenced by brushless\_\-1\_\-set\_\-parameters(), and SIGNAL().\index{double/brushless.c@{double/brushless.c}!speed\_\-mem\_\-0@{speed\_\-mem\_\-0}}
\index{speed\_\-mem\_\-0@{speed\_\-mem\_\-0}!double/brushless.c@{double/brushless.c}}
\subsubsection[speed\_\-mem\_\-0]{\setlength{\rightskip}{0pt plus 5cm}brushless\_\-speed {\bf speed\_\-mem\_\-0} = BRUSHLESS\_\-MAX\_\-SPEED}\label{double_2brushless_8c_07db5651a3818b9edf048785d2b6fb43}




Definition at line 521 of file brushless.c.\index{double/brushless.c@{double/brushless.c}!speed\_\-mem\_\-1@{speed\_\-mem\_\-1}}
\index{speed\_\-mem\_\-1@{speed\_\-mem\_\-1}!double/brushless.c@{double/brushless.c}}
\subsubsection[speed\_\-mem\_\-1]{\setlength{\rightskip}{0pt plus 5cm}brushless\_\-speed {\bf speed\_\-mem\_\-1} = BRUSHLESS\_\-MAX\_\-SPEED}\label{double_2brushless_8c_3ec46e9f47e25117e25afa64b7a3facc}




Definition at line 523 of file brushless.c.\index{double/brushless.c@{double/brushless.c}!torque\_\-mem\_\-0@{torque\_\-mem\_\-0}}
\index{torque\_\-mem\_\-0@{torque\_\-mem\_\-0}!double/brushless.c@{double/brushless.c}}
\subsubsection[torque\_\-mem\_\-0]{\setlength{\rightskip}{0pt plus 5cm}brushless\_\-torque {\bf torque\_\-mem\_\-0} = 0}\label{double_2brushless_8c_22d7d85d0b779e341f1ef0d53f7f9fb6}




Definition at line 522 of file brushless.c.\index{double/brushless.c@{double/brushless.c}!torque\_\-mem\_\-1@{torque\_\-mem\_\-1}}
\index{torque\_\-mem\_\-1@{torque\_\-mem\_\-1}!double/brushless.c@{double/brushless.c}}
\subsubsection[torque\_\-mem\_\-1]{\setlength{\rightskip}{0pt plus 5cm}brushless\_\-torque {\bf torque\_\-mem\_\-1} = 0}\label{double_2brushless_8c_bce1bf7ee6281ab0086201f5def0e246}




Definition at line 524 of file brushless.c.