Firmware SDK
twr_dice.h
1 #ifndef _TWR_DICE_H
2 #define _TWR_DICE_H
3 
4 #include <twr_common.h>
5 
9 
11 
12 typedef enum
13 {
16 
19 
22 
25 
28 
31 
33  TWR_DICE_FACE_6 = 6
34 
36 
38 
39 typedef struct twr_dice_t twr_dice_t;
40 
42 
43 struct twr_dice_t
44 {
45  twr_dice_face_t _face;
46  float _threshold;
47 };
48 
50 
54 
55 void twr_dice_init(twr_dice_t *self, twr_dice_face_t start);
56 
60 
61 void twr_dice_set_threshold(twr_dice_t *self, float threshold);
62 
68 
69 void twr_dice_feed_vectors(twr_dice_t *self, float x_axis, float y_axis, float z_axis);
70 
74 
76 
78 
79 #endif // _TWR_DICE_H
void twr_dice_set_threshold(twr_dice_t *self, float threshold)
Set threshold.
Definition: twr_dice.c:26
twr_dice_face_t
Dice faces.
Definition: twr_dice.h:13
void twr_dice_init(twr_dice_t *self, twr_dice_face_t start)
Initialize dice.
Definition: twr_dice.c:17
void twr_dice_feed_vectors(twr_dice_t *self, float x_axis, float y_axis, float z_axis)
Feed dice with X/Y/Z axis vectors.
Definition: twr_dice.c:31
twr_dice_face_t twr_dice_get_face(twr_dice_t *self)
Get calculated dice face.
Definition: twr_dice.c:82
struct twr_dice_t twr_dice_t
Dice instance.
Definition: twr_dice.h:39
@ TWR_DICE_FACE_UNKNOWN
Unknown dice face.
Definition: twr_dice.h:15
@ TWR_DICE_FACE_6
Dice face 6.
Definition: twr_dice.h:33
@ TWR_DICE_FACE_1
Dice face 1.
Definition: twr_dice.h:18
@ TWR_DICE_FACE_5
Dice face 5.
Definition: twr_dice.h:30
@ TWR_DICE_FACE_4
Dice face 4.
Definition: twr_dice.h:27
@ TWR_DICE_FACE_3
Dice face 3.
Definition: twr_dice.h:24
@ TWR_DICE_FACE_2
Dice face 2.
Definition: twr_dice.h:21