summaryrefslogtreecommitdiffstats
path: root/config.h
blob: 063fc47a954a72e22072aec96f83de21596591f4 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/**
 * @file config.h
 * @brief Defines motor and digital port configurations.
 */

#ifndef CONFIG_H_
#define CONFIG_H_

/**
 * Creates a default entry in the digital port configuration.
 * @param pin the pin to configure
 * @return the entry for the configuration
 */
constexpr auto digiDefault(const auto& pin)
{
	return vexDigiCfg { pin, kVexSensorDigitalInput, kVexConfigInput, 0 };
}

/**
 * Creates a default entry in the motor port configuration.
 * @param port the port to configure
 * @param type the type of the motor
 * @return the entry for the configuration
 */
constexpr auto motorDefault(const auto& port, const tVexMotorType& type = kVexMotorUndefined)
{
	return vexMotorCfg { port, type, kVexMotorNormal, kVexSensorNone, 0 };
}

/** The left drive motor's port. */
constexpr auto mDriveLeft     = kVexMotor_5;

/** The right drive motor's port. */
constexpr auto mDriveRight    = kVexMotor_6;

/** The lower right lift motor's port. */
constexpr auto mLiftLowRight  = kVexMotor_7;

/** The upper right lift motor's port. */
constexpr auto mLiftHighRight = kVexMotor_8;

/** The lower left lift motor's port. */
constexpr auto mLiftLowLeft   = kVexMotor_3;

/** The upper left lift motor's port. */
constexpr auto mLiftHighLeft  = kVexMotor_4;

/** The claw motor's port. */
constexpr auto mClaw          = kVexMotor_1;

/** The IME channel for the lower left lift motor. */
constexpr auto iLiftLowLeft  = kImeChannel_1;
/** The IME channel for the lower right lift motor. */
constexpr auto iLiftLowRight = kImeChannel_2;

/**
 * Defines the motor port configuration for the cortex.
 */
constexpr vexMotorCfg mConfig[kVexMotorNum] = {
        motorDefault( mDriveLeft ),
        motorDefault( mDriveRight ),
        motorDefault( mClaw ),
        motorDefault( mLiftHighLeft,  kVexMotor393S ),
        motorDefault( mLiftHighRight, kVexMotor393S ),
        { mLiftLowLeft,  kVexMotor393S, kVexMotorNormal, kVexSensorIME, iLiftLowLeft },
        { mLiftLowRight, kVexMotor393S, kVexMotorNormal, kVexSensorIME, iLiftLowRight },
};

/**
 * Defines the digital port configuration for the cortex.
 */
constexpr vexDigiCfg dConfig[kVexDigital_Num] = {
        { kVexDigital_1,    kVexSensorQuadEncoder,   kVexConfigQuadEnc1,    kVexQuadEncoder_1 },
        { kVexDigital_2,    kVexSensorQuadEncoder,   kVexConfigQuadEnc2,    kVexQuadEncoder_1 },
        digiDefault(kVexDigital_3),
        digiDefault(kVexDigital_4),
        digiDefault(kVexDigital_5),
        digiDefault(kVexDigital_6),
        digiDefault(kVexDigital_7),
        digiDefault(kVexDigital_8),
        digiDefault(kVexDigital_9),
        digiDefault(kVexDigital_10),
        digiDefault(kVexDigital_11),
        digiDefault(kVexDigital_12),
};

#endif // CONFIG_H_