summaryrefslogtreecommitdiff
path: root/src/motor.cpp
blob: 84785a935b15e22be689b4301f3a378fd5a10a43 (plain)
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
45
46
#include "../include/motor.hpp"



Motor::Motor() {


}

bool Motor::init(void* data) {

    Vehicle *vehicle = (Vehicle *) data;
    double duty = 100 - ((MIN_ANGLE / 180) * vehicle->duty_span + DUTY_MIN);

    // Initialize stuff
    // .....
    // .....


    data = (void*) vehicle; // Is this necessary?
    return true;
}


bool Motor::writeData(void* data) {

    Vehicle *vehicle = (Vehicle *) data;
    double duty = 100 - ((vehicle->deployment_angle / 180) * vehicle->duty_span + DUTY_MIN);

    // Send the Data somewhere
    // ..... Pin
    // ..... Duty
    // ..... PWM frequency Hz
    // ..... Polarity
    

    if (1 == 2) {
        Logger::Get().logErr("Some type of Error");
        return false;
    }

    data = (void*) vehicle; // Is this necessary?
    return true;
}