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
{
15
TWR_DICE_FACE_UNKNOWN
= 0,
16
18
TWR_DICE_FACE_1
= 1,
19
21
TWR_DICE_FACE_2
= 2,
22
24
TWR_DICE_FACE_3
= 3,
25
27
TWR_DICE_FACE_4
= 4,
28
30
TWR_DICE_FACE_5
= 5,
31
33
TWR_DICE_FACE_6
= 6
34
35
}
twr_dice_face_t
;
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
75
twr_dice_face_t
twr_dice_get_face
(
twr_dice_t
*
self
);
76
78
79
#endif
// _TWR_DICE_H
twr_dice_set_threshold
void twr_dice_set_threshold(twr_dice_t *self, float threshold)
Set threshold.
Definition:
twr_dice.c:26
twr_dice_face_t
twr_dice_face_t
Dice faces.
Definition:
twr_dice.h:13
twr_dice_init
void twr_dice_init(twr_dice_t *self, twr_dice_face_t start)
Initialize dice.
Definition:
twr_dice.c:17
twr_dice_feed_vectors
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_get_face
twr_dice_face_t twr_dice_get_face(twr_dice_t *self)
Get calculated dice face.
Definition:
twr_dice.c:82
twr_dice_t
struct twr_dice_t twr_dice_t
Dice instance.
Definition:
twr_dice.h:39
TWR_DICE_FACE_UNKNOWN
@ TWR_DICE_FACE_UNKNOWN
Unknown dice face.
Definition:
twr_dice.h:15
TWR_DICE_FACE_6
@ TWR_DICE_FACE_6
Dice face 6.
Definition:
twr_dice.h:33
TWR_DICE_FACE_1
@ TWR_DICE_FACE_1
Dice face 1.
Definition:
twr_dice.h:18
TWR_DICE_FACE_5
@ TWR_DICE_FACE_5
Dice face 5.
Definition:
twr_dice.h:30
TWR_DICE_FACE_4
@ TWR_DICE_FACE_4
Dice face 4.
Definition:
twr_dice.h:27
TWR_DICE_FACE_3
@ TWR_DICE_FACE_3
Dice face 3.
Definition:
twr_dice.h:24
TWR_DICE_FACE_2
@ TWR_DICE_FACE_2
Dice face 2.
Definition:
twr_dice.h:21
twr
inc
twr_dice.h
Generated by
1.9.1