Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_dice

Helper library to determine dice (cube) face position from vectors. More...

Typedefs

typedef struct bc_dice_t bc_dice_t
 Dice instance.
 

Enumerations

enum  bc_dice_face_t {
  BC_DICE_FACE_UNKNOWN = 0,
  BC_DICE_FACE_1 = 1,
  BC_DICE_FACE_2 = 2,
  BC_DICE_FACE_3 = 3,
  BC_DICE_FACE_4 = 4,
  BC_DICE_FACE_5 = 5,
  BC_DICE_FACE_6 = 6
}
 Dice faces. More...
 

Functions

void bc_dice_init (bc_dice_t *self, bc_dice_face_t start)
 Initialize dice. More...
 
void bc_dice_set_threshold (bc_dice_t *self, float threshold)
 Set threshold. More...
 
void bc_dice_feed_vectors (bc_dice_t *self, float x_axis, float y_axis, float z_axis)
 Feed dice with X/Y/Z axis vectors. More...
 
bc_dice_face_t bc_dice_get_face (bc_dice_t *self)
 Get calculated dice face. More...
 

Detailed Description

Helper library to determine dice (cube) face position from vectors.

Enumeration Type Documentation

Dice faces.

Enumerator
BC_DICE_FACE_UNKNOWN 

Unknown dice face.

BC_DICE_FACE_1 

Dice face 1.

BC_DICE_FACE_2 

Dice face 2.

BC_DICE_FACE_3 

Dice face 3.

BC_DICE_FACE_4 

Dice face 4.

BC_DICE_FACE_5 

Dice face 5.

BC_DICE_FACE_6 

Dice face 6.

Definition at line 12 of file bc_dice.h.

Function Documentation

void bc_dice_feed_vectors ( bc_dice_t self,
float  x_axis,
float  y_axis,
float  z_axis 
)

Feed dice with X/Y/Z axis vectors.

Parameters
[in]selfInstance
[in]x_axisVector of X axis
[in]y_axisVector of Y axis
[in]z_axisVector of Z axis

Definition at line 31 of file bc_dice.c.

bc_dice_face_t bc_dice_get_face ( bc_dice_t self)

Get calculated dice face.

Parameters
[in]selfInstance
Returns
Dice face

Definition at line 82 of file bc_dice.c.

void bc_dice_init ( bc_dice_t self,
bc_dice_face_t  start 
)

Initialize dice.

Parameters
[in]selfInstance
[in]startDice initial face

Definition at line 17 of file bc_dice.c.

void bc_dice_set_threshold ( bc_dice_t self,
float  threshold 
)

Set threshold.

Parameters
[in]selfInstance
[in]threshold

Definition at line 26 of file bc_dice.c.