1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use crate::prelude::*;
use super::maple_device_t;

#[repr(C)]
pub struct purupuru_effect_t {
    pub duration:   u8,
    pub effect2:    u8,
    pub effect1:    u8,
    pub special:    u8,
}

#[macro_export]
macro_rules! PURUPURU_EFFECT2_UINTENSITY {
    ($x:expr) => {
        $x << 4
    };
}
#[macro_export]
macro_rules! PURUPURU_EFFECT2_LINTENSITY {
    ($x:expr) => {
        $x
    };
}
pub const PURUPURU_EFFECT2_DECAY: u8        = 8 << 4;
pub const PURUPURU_EFFECT2_PULSE: u8        = 8;
#[macro_export]
macro_rules! PURUPURU_EFFECT1_INTENSITY {
    ($x:expr) => {
        $x << 4
    };
}
pub const PURUPURU_EFFECT1_PULSE: u8        = 8 << 4;
pub const PURUPURU_EFFECT1_POWERSAVE: u8    = 15;
pub const PURUPURU_SPECIAL_MOTOR1: u8       = 1 << 4;
pub const PURUPURU_SPECIAL_MOTOR2: u8       = 1 << 7;
pub const PURUPURU_SPECIAL_PULSE: u8        = 1;

extern "C" {
    pub fn purupuru_rumble(dev: *mut maple_device_t,
                           effect: *mut purupuru_effect_t) -> c_int;
    pub fn purupuru_rumble_raw(dev: *mut maple_device_t, effect: u32) -> c_int;
    pub fn purupuru_init();
    pub fn purupuru_shutdown();
}