Khangai Robot Play - Naive  01
THe naive play of the Khangai Robot
Bound< N > Class Template Reference

#include <bound_box.h>

Public Member Functions

 Bound ()
 
 Bound (Bound &&)=default
 
 Bound (const Bound &)=default
 
Boundoperator= (Bound &&)=default
 
Boundoperator= (const Bound &)=default
 
 ~Bound ()
 
void add_LimitSwitch (GPIO_TypeDef *gpio, uint16_t pin)
 Add limit switch gpio to the bound. More...
 
uint8_t read ()
 Read which limit switches are pressed. More...
 
void update ()
 
uint8_t get_Num_Switches ()
 
void clear ()
 

Private Attributes

GPIO_TypeDef * gpios_ [N]
 
uint16_t gpio_pins_ [N]
 
uint8_t num_switches_
 
uint8_t switch_state_
 

Constructor & Destructor Documentation

◆ Bound() [1/3]

template<uint8_t N>
Bound< N >::Bound ( )
inline

◆ Bound() [2/3]

template<uint8_t N>
Bound< N >::Bound ( Bound< N > &&  )
default

◆ Bound() [3/3]

template<uint8_t N>
Bound< N >::Bound ( const Bound< N > &  )
default

◆ ~Bound()

template<uint8_t N>
Bound< N >::~Bound ( )
inline

Member Function Documentation

◆ add_LimitSwitch()

template<uint8_t N>
void Bound< N >::add_LimitSwitch ( GPIO_TypeDef *  gpio,
uint16_t  pin 
)
inline

Add limit switch gpio to the bound.

\func add_LimitSwitch

Parameters
gpioPointer to the gpio the limit switch is connected to(eg. GPIOA)
pinThe number of gpio pin(eg. GPIO_PIN_0)

\ret 1 if buffer to hold gpio is full and 0 if gpio is correctly added

Note
The order of addition of limit switch matters.
Here is the caller graph for this function:

◆ clear()

template<uint8_t N>
void Bound< N >::clear ( )
inline
Here is the caller graph for this function:

◆ get_Num_Switches()

template<uint8_t N>
uint8_t Bound< N >::get_Num_Switches ( )
inline

◆ operator=() [1/2]

template<uint8_t N>
Bound& Bound< N >::operator= ( Bound< N > &&  )
default

◆ operator=() [2/2]

template<uint8_t N>
Bound& Bound< N >::operator= ( const Bound< N > &  )
default

◆ read()

template<uint8_t N>
uint8_t Bound< N >::read ( )
inline

Read which limit switches are pressed.

\func read

Parameters
none\ret 1 in place of limit switch pressed. If 0x0F is retured, the first added 4 limit switch are pressed and rest are not.
Note
The order of addition of limit switch matters.
Here is the caller graph for this function:

◆ update()

template<uint8_t N>
void Bound< N >::update ( )
inline
Here is the caller graph for this function:

Member Data Documentation

◆ gpio_pins_

template<uint8_t N>
uint16_t Bound< N >::gpio_pins_[N]
private

◆ gpios_

template<uint8_t N>
GPIO_TypeDef* Bound< N >::gpios_[N]
private

◆ num_switches_

template<uint8_t N>
uint8_t Bound< N >::num_switches_
private

◆ switch_state_

template<uint8_t N>
uint8_t Bound< N >::switch_state_
private

The documentation for this class was generated from the following file: