id
int32 0
12.9k
| code
sequencelengths 2
264k
|
---|---|
7,400 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"AllocationException",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"CheckedAllocationException",
";",
"public",
"class",
"Solenoid",
"extends",
"SolenoidBase",
"{",
"private",
"int",
"m_channel",
";",
"private",
"synchronized",
"void",
"initSolenoid",
"(",
")",
"{",
"checkSolenoidModule",
"(",
"m_chassisSlot",
")",
";",
"checkSolenoidChannel",
"(",
"m_channel",
")",
";",
"try",
"{",
"m_allocated",
".",
"allocate",
"(",
"slotToIndex",
"(",
"m_chassisSlot",
")",
"*",
"kSolenoidChannels",
"+",
"m_channel",
"-",
"1",
")",
";",
"}",
"catch",
"(",
"CheckedAllocationException",
"e",
")",
"{",
"throw",
"new",
"AllocationException",
"(",
"\"\"",
"+",
"m_channel",
"+",
"\"",
"on",
"module",
"\"",
"+",
"m_chassisSlot",
"+",
"\"\"",
")",
";",
"}",
"}",
"public",
"Solenoid",
"(",
"final",
"int",
"channel",
")",
"{",
"super",
"(",
"getDefaultSolenoidModule",
"(",
")",
")",
";",
"m_channel",
"=",
"channel",
";",
"initSolenoid",
"(",
")",
";",
"}",
"public",
"Solenoid",
"(",
"final",
"int",
"slot",
",",
"final",
"int",
"channel",
")",
"{",
"super",
"(",
"slot",
")",
";",
"m_channel",
"=",
"channel",
";",
"initSolenoid",
"(",
")",
";",
"}",
"protected",
"synchronized",
"void",
"free",
"(",
")",
"{",
"m_allocated",
".",
"free",
"(",
"slotToIndex",
"(",
"m_chassisSlot",
")",
"*",
"kSolenoidChannels",
"+",
"m_channel",
"-",
"1",
")",
";",
"}",
"public",
"void",
"set",
"(",
"boolean",
"on",
")",
"{",
"byte",
"value",
"=",
"(",
"byte",
")",
"(",
"on",
"?",
"0xFF",
":",
"0x00",
")",
";",
"byte",
"mask",
"=",
"(",
"byte",
")",
"(",
"1",
"<<",
"(",
"m_channel",
"-",
"1",
")",
")",
";",
"set",
"(",
"value",
",",
"mask",
")",
";",
"}",
"public",
"boolean",
"get",
"(",
")",
"{",
"int",
"value",
"=",
"getAll",
"(",
")",
"&",
"(",
"1",
"<<",
"(",
"m_channel",
"-",
"1",
")",
")",
";",
"return",
"(",
"value",
"!=",
"0",
")",
";",
"}",
"}",
"</s>"
] |
7,401 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"import",
"com",
".",
"ni",
".",
"rio",
".",
"*",
";",
"public",
"class",
"tGlobal",
"extends",
"tSystem",
"{",
"public",
"tGlobal",
"(",
")",
"{",
"super",
"(",
")",
";",
"}",
"protected",
"void",
"finalize",
"(",
")",
"{",
"super",
".",
"finalize",
"(",
")",
";",
"}",
"public",
"static",
"final",
"int",
"kNumSystems",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kGlobal_Version_Address",
"=",
"0x8118",
";",
"public",
"static",
"int",
"readVersion",
"(",
")",
"{",
"return",
"(",
"int",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kGlobal_Version_Address",
",",
"status",
")",
")",
"&",
"0x0000FFFF",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kGlobal_FPGA_LED_Address",
"=",
"0x811C",
";",
"public",
"static",
"void",
"writeFPGA_LED",
"(",
"final",
"boolean",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kGlobal_FPGA_LED_Address",
",",
"(",
"value",
"?",
"1",
":",
"0",
")",
",",
"status",
")",
";",
"}",
"public",
"static",
"boolean",
"readFPGA_LED",
"(",
")",
"{",
"return",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kGlobal_FPGA_LED_Address",
",",
"status",
")",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kGlobal_LocalTime_Address",
"=",
"0x8110",
";",
"public",
"static",
"long",
"readLocalTime",
"(",
")",
"{",
"return",
"(",
"long",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kGlobal_LocalTime_Address",
",",
"status",
")",
")",
"&",
"0xFFFFFFFFl",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kGlobal_Revision_Address",
"=",
"0x8114",
";",
"public",
"static",
"long",
"readRevision",
"(",
")",
"{",
"return",
"(",
"long",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kGlobal_Revision_Address",
",",
"status",
")",
")",
"&",
"0xFFFFFFFFl",
")",
";",
"}",
"}",
"</s>"
] |
7,402 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"import",
"com",
".",
"ni",
".",
"rio",
".",
"*",
";",
"public",
"class",
"tAnalogTrigger",
"extends",
"tSystem",
"{",
"public",
"tAnalogTrigger",
"(",
"final",
"int",
"sys_index",
")",
"{",
"super",
"(",
")",
";",
"m_SystemIndex",
"=",
"sys_index",
";",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"m_SystemIndex",
">=",
"kNumSystems",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"}",
"protected",
"void",
"finalize",
"(",
")",
"{",
"super",
".",
"finalize",
"(",
")",
";",
"}",
"public",
"int",
"getSystemIndex",
"(",
")",
"{",
"return",
"m_SystemIndex",
";",
"}",
"public",
"static",
"final",
"int",
"kNumSystems",
"=",
"8",
";",
"public",
"final",
"int",
"m_SystemIndex",
";",
"private",
"static",
"final",
"int",
"kSourceSelect_Channel_BitfieldMask",
"=",
"0x00007000",
";",
"private",
"static",
"final",
"int",
"kSourceSelect_Channel_BitfieldOffset",
"=",
"12",
";",
"private",
"static",
"final",
"int",
"kSourceSelect_Module_BitfieldMask",
"=",
"0x00000800",
";",
"private",
"static",
"final",
"int",
"kSourceSelect_Module_BitfieldOffset",
"=",
"11",
";",
"private",
"static",
"final",
"int",
"kSourceSelect_Averaged_BitfieldMask",
"=",
"0x00000400",
";",
"private",
"static",
"final",
"int",
"kSourceSelect_Averaged_BitfieldOffset",
"=",
"10",
";",
"private",
"static",
"final",
"int",
"kSourceSelect_Filter_BitfieldMask",
"=",
"0x00000200",
";",
"private",
"static",
"final",
"int",
"kSourceSelect_Filter_BitfieldOffset",
"=",
"9",
";",
"private",
"static",
"final",
"int",
"kSourceSelect_FloatingRollover_BitfieldMask",
"=",
"0x00000100",
";",
"private",
"static",
"final",
"int",
"kSourceSelect_FloatingRollover_BitfieldOffset",
"=",
"8",
";",
"private",
"static",
"final",
"int",
"kSourceSelect_RolloverLimit_BitfieldMask",
"=",
"0x000000FF",
";",
"private",
"static",
"final",
"int",
"kSourceSelect_RolloverLimit_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kSourceSelect_RolloverLimit_FixedPointIntegerShift",
"=",
"4",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger0_SourceSelect_Address",
"=",
"0x83C8",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger1_SourceSelect_Address",
"=",
"0x83BC",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger2_SourceSelect_Address",
"=",
"0x83B0",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger3_SourceSelect_Address",
"=",
"0x83A4",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger4_SourceSelect_Address",
"=",
"0x8398",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger5_SourceSelect_Address",
"=",
"0x838C",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger6_SourceSelect_Address",
"=",
"0x8380",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger7_SourceSelect_Address",
"=",
"0x8374",
";",
"private",
"static",
"final",
"int",
"kSourceSelect_Addresses",
"[",
"]",
"=",
"{",
"kAnalogTrigger0_SourceSelect_Address",
",",
"kAnalogTrigger1_SourceSelect_Address",
",",
"kAnalogTrigger2_SourceSelect_Address",
",",
"kAnalogTrigger3_SourceSelect_Address",
",",
"kAnalogTrigger4_SourceSelect_Address",
",",
"kAnalogTrigger5_SourceSelect_Address",
",",
"kAnalogTrigger6_SourceSelect_Address",
",",
"kAnalogTrigger7_SourceSelect_Address",
",",
"}",
";",
"public",
"void",
"writeSourceSelect",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeSourceSelect_Channel",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kSourceSelect_Channel_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kSourceSelect_Channel_BitfieldOffset",
")",
"&",
"kSourceSelect_Channel_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeSourceSelect_Module",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kSourceSelect_Module_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kSourceSelect_Module_BitfieldOffset",
")",
"&",
"kSourceSelect_Module_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeSourceSelect_Averaged",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kSourceSelect_Averaged_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kSourceSelect_Averaged_BitfieldOffset",
")",
"&",
"kSourceSelect_Averaged_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeSourceSelect_Filter",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kSourceSelect_Filter_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kSourceSelect_Filter_BitfieldOffset",
")",
"&",
"kSourceSelect_Filter_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeSourceSelect_FloatingRollover",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kSourceSelect_FloatingRollover_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kSourceSelect_FloatingRollover_BitfieldOffset",
")",
"&",
"kSourceSelect_FloatingRollover_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeSourceSelect_RolloverLimit",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kSourceSelect_RolloverLimit_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
">>>",
"kSourceSelect_RolloverLimit_FixedPointIntegerShift",
")",
"<<",
"kSourceSelect_RolloverLimit_BitfieldOffset",
")",
"&",
"kSourceSelect_RolloverLimit_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"int",
"readSourceSelect",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"byte",
"readSourceSelect_Channel",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kSourceSelect_Channel_BitfieldMask",
")",
">>>",
"kSourceSelect_Channel_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000007",
")",
";",
"}",
"public",
"byte",
"readSourceSelect_Module",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kSourceSelect_Module_BitfieldMask",
")",
">>>",
"kSourceSelect_Module_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000001",
")",
";",
"}",
"public",
"boolean",
"readSourceSelect_Averaged",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kSourceSelect_Averaged_BitfieldMask",
")",
">>>",
"kSourceSelect_Averaged_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"boolean",
"readSourceSelect_Filter",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kSourceSelect_Filter_BitfieldMask",
")",
">>>",
"kSourceSelect_Filter_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"boolean",
"readSourceSelect_FloatingRollover",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kSourceSelect_FloatingRollover_BitfieldMask",
")",
">>>",
"kSourceSelect_FloatingRollover_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"short",
"readSourceSelect_RolloverLimit",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSourceSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kSourceSelect_RolloverLimit_BitfieldMask",
")",
">>>",
"kSourceSelect_RolloverLimit_BitfieldOffset",
")",
"<<",
"kSourceSelect_RolloverLimit_FixedPointIntegerShift",
";",
"bitfieldValue",
"<<=",
"20",
";",
"bitfieldValue",
">>=",
"20",
";",
"return",
"(",
"short",
")",
"(",
"bitfieldValue",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kAnalogTrigger0_UpperLimit_Address",
"=",
"0x83C4",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger1_UpperLimit_Address",
"=",
"0x83B8",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger2_UpperLimit_Address",
"=",
"0x83AC",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger3_UpperLimit_Address",
"=",
"0x83A0",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger4_UpperLimit_Address",
"=",
"0x8394",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger5_UpperLimit_Address",
"=",
"0x837C",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger6_UpperLimit_Address",
"=",
"0x8388",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger7_UpperLimit_Address",
"=",
"0x8370",
";",
"private",
"static",
"final",
"int",
"kUpperLimit_Addresses",
"[",
"]",
"=",
"{",
"kAnalogTrigger0_UpperLimit_Address",
",",
"kAnalogTrigger1_UpperLimit_Address",
",",
"kAnalogTrigger2_UpperLimit_Address",
",",
"kAnalogTrigger3_UpperLimit_Address",
",",
"kAnalogTrigger4_UpperLimit_Address",
",",
"kAnalogTrigger5_UpperLimit_Address",
",",
"kAnalogTrigger6_UpperLimit_Address",
",",
"kAnalogTrigger7_UpperLimit_Address",
",",
"}",
";",
"public",
"void",
"writeUpperLimit",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kUpperLimit_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"int",
"readUpperLimit",
"(",
")",
"{",
"return",
"(",
"int",
")",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kUpperLimit_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kAnalogTrigger0_LowerLimit_Address",
"=",
"0x83C0",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger1_LowerLimit_Address",
"=",
"0x83B4",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger2_LowerLimit_Address",
"=",
"0x83A8",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger3_LowerLimit_Address",
"=",
"0x839C",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger4_LowerLimit_Address",
"=",
"0x8390",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger5_LowerLimit_Address",
"=",
"0x8378",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger6_LowerLimit_Address",
"=",
"0x8384",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger7_LowerLimit_Address",
"=",
"0x836C",
";",
"private",
"static",
"final",
"int",
"kLowerLimit_Addresses",
"[",
"]",
"=",
"{",
"kAnalogTrigger0_LowerLimit_Address",
",",
"kAnalogTrigger1_LowerLimit_Address",
",",
"kAnalogTrigger2_LowerLimit_Address",
",",
"kAnalogTrigger3_LowerLimit_Address",
",",
"kAnalogTrigger4_LowerLimit_Address",
",",
"kAnalogTrigger5_LowerLimit_Address",
",",
"kAnalogTrigger6_LowerLimit_Address",
",",
"kAnalogTrigger7_LowerLimit_Address",
",",
"}",
";",
"public",
"void",
"writeLowerLimit",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kLowerLimit_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"int",
"readLowerLimit",
"(",
")",
"{",
"return",
"(",
"int",
")",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kLowerLimit_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
";",
"}",
"public",
"static",
"final",
"int",
"kOutput_NumElements",
"=",
"8",
";",
"public",
"static",
"final",
"int",
"kOutput_ElementSize",
"=",
"4",
";",
"public",
"static",
"final",
"int",
"kOutput_ElementMask",
"=",
"0xF",
";",
"private",
"static",
"final",
"int",
"kOutput_InHysteresis_BitfieldMask",
"=",
"0x00000008",
";",
"private",
"static",
"final",
"int",
"kOutput_InHysteresis_BitfieldOffset",
"=",
"3",
";",
"private",
"static",
"final",
"int",
"kOutput_OverLimit_BitfieldMask",
"=",
"0x00000004",
";",
"private",
"static",
"final",
"int",
"kOutput_OverLimit_BitfieldOffset",
"=",
"2",
";",
"private",
"static",
"final",
"int",
"kOutput_Rising_BitfieldMask",
"=",
"0x00000002",
";",
"private",
"static",
"final",
"int",
"kOutput_Rising_BitfieldOffset",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kOutput_Falling_BitfieldMask",
"=",
"0x00000001",
";",
"private",
"static",
"final",
"int",
"kOutput_Falling_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kAnalogTrigger_Output_Address",
"=",
"0x83CC",
";",
"public",
"static",
"int",
"readOutput",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kOutput_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kAnalogTrigger_Output_Address",
",",
"status",
")",
">>>",
"(",
"(",
"kOutput_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kOutput_ElementSize",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"static",
"boolean",
"readOutput_InHysteresis",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kOutput_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kAnalogTrigger_Output_Address",
",",
"status",
")",
">>>",
"(",
"(",
"kOutput_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kOutput_ElementSize",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kOutput_InHysteresis_BitfieldMask",
")",
">>>",
"kOutput_InHysteresis_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readOutput_OverLimit",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kOutput_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kAnalogTrigger_Output_Address",
",",
"status",
")",
">>>",
"(",
"(",
"kOutput_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kOutput_ElementSize",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kOutput_OverLimit_BitfieldMask",
")",
">>>",
"kOutput_OverLimit_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readOutput_Rising",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kOutput_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kAnalogTrigger_Output_Address",
",",
"status",
")",
">>>",
"(",
"(",
"kOutput_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kOutput_ElementSize",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kOutput_Rising_BitfieldMask",
")",
">>>",
"kOutput_Rising_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readOutput_Falling",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kOutput_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kAnalogTrigger_Output_Address",
",",
"status",
")",
">>>",
"(",
"(",
"kOutput_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kOutput_ElementSize",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kOutput_Falling_BitfieldMask",
")",
">>>",
"kOutput_Falling_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"}",
"</s>"
] |
7,403 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"import",
"com",
".",
"ni",
".",
"rio",
".",
"*",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"communication",
".",
"BumARioHandle",
";",
"public",
"abstract",
"class",
"tSystem",
"implements",
"ExpectedFPGASignature",
",",
"DMAChannelDescriptors",
"{",
"protected",
"static",
"int",
"m_DeviceHandle",
"=",
"0",
";",
"private",
"static",
"int",
"m_ReferenceCount",
"=",
"0",
";",
"public",
"static",
"NiRioStatus",
"status",
"=",
"new",
"NiRioStatus",
"(",
")",
";",
"private",
"static",
"final",
"String",
"kRIO_DEVICE_NAME",
"=",
"\"RIO0\"",
";",
"private",
"static",
"final",
"int",
"kFPGA_RESET_REGISTER",
"=",
"0x8102",
";",
"private",
"static",
"final",
"int",
"kFPGA_COMMAND_REGISTER",
"=",
"0x8104",
";",
"private",
"static",
"final",
"int",
"kFPGA_COMMAND_ENABLE_CLEAR",
"=",
"4",
";",
"private",
"static",
"final",
"int",
"kFPGA_COMMAND_ENABLE_IN",
"=",
"2",
";",
"private",
"static",
"final",
"int",
"kFPGA_INTERRUPT_BASE_ADDRESS",
"=",
"0x8000",
";",
"private",
"static",
"final",
"int",
"kFPGA_SIGNATURE_REGISTER",
"=",
"0x8108",
";",
"private",
"static",
"final",
"int",
"kMITE_IOPCR_REGISTER",
"=",
"0x470",
";",
"private",
"static",
"final",
"int",
"kMITE_IOPCR_32BIT",
"=",
"0xC00231",
";",
"protected",
"tSystem",
"(",
")",
"{",
"NiRioStatus",
"versionStatus",
"=",
"new",
"NiRioStatus",
"(",
")",
";",
"if",
"(",
"m_DeviceHandle",
"==",
"0",
")",
"{",
"m_DeviceHandle",
"=",
"BumARioHandle",
".",
"bum",
"(",
"status",
".",
"getPointer",
"(",
")",
")",
";",
"int",
"hwGUID",
"[",
"]",
"=",
"new",
"int",
"[",
"4",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";",
"i",
"++",
")",
"{",
"NiRioStatus",
"cleanStatus",
"=",
"new",
"NiRioStatus",
"(",
")",
";",
"hwGUID",
"[",
"i",
"]",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kFPGA_SIGNATURE_REGISTER",
",",
"cleanStatus",
")",
";",
"status",
".",
"setStatus",
"(",
"cleanStatus",
")",
";",
"if",
"(",
"hwGUID",
"[",
"i",
"]",
"!=",
"kExpectedFPGASignature",
"[",
"i",
"]",
")",
"{",
"versionStatus",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusVersionMismatch",
")",
";",
"}",
"}",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"printGUID",
"(",
"hwGUID",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"printGUID",
"(",
"kExpectedFPGASignature",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"status",
".",
"setStatus",
"(",
"versionStatus",
")",
";",
"}",
"private",
"static",
"void",
"printGUID",
"(",
"int",
"guid",
"[",
"]",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"0x\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";",
"i",
"++",
")",
"{",
"long",
"longVar",
"=",
"guid",
"[",
"i",
"]",
";",
"String",
"word",
"=",
"Long",
".",
"toString",
"(",
"longVar",
"&",
"0xFFFFFFFFL",
",",
"16",
")",
";",
"while",
"(",
"word",
".",
"length",
"(",
")",
"<",
"8",
")",
"{",
"word",
"=",
"\"0\"",
"+",
"word",
";",
"}",
"System",
".",
"out",
".",
"print",
"(",
"word",
")",
";",
"}",
"}",
"protected",
"void",
"finalize",
"(",
")",
"{",
"}",
"public",
"int",
"[",
"]",
"getFpgaGuid",
"(",
"NiRioStatus",
"status",
")",
"{",
"int",
"[",
"]",
"guid",
"=",
"{",
"0",
",",
"0",
",",
"0",
",",
"0",
"}",
";",
"if",
"(",
"m_DeviceHandle",
"==",
"0",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusInvalidHandle",
")",
";",
"return",
"guid",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";",
"i",
"++",
")",
"{",
"guid",
"[",
"i",
"]",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kFPGA_SIGNATURE_REGISTER",
",",
"status",
")",
";",
"}",
"return",
"guid",
";",
"}",
"public",
"void",
"Release",
"(",
")",
"{",
"}",
"}",
"</s>"
] |
7,404 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"import",
"com",
".",
"ni",
".",
"rio",
".",
"*",
";",
"public",
"class",
"tAlarm",
"extends",
"tSystem",
"{",
"public",
"tAlarm",
"(",
")",
"{",
"super",
"(",
")",
";",
"}",
"protected",
"void",
"finalize",
"(",
")",
"{",
"super",
".",
"finalize",
"(",
")",
";",
"}",
"public",
"static",
"final",
"int",
"kNumSystems",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kAlarm_TriggerTime_Address",
"=",
"0x8128",
";",
"public",
"static",
"void",
"writeTriggerTime",
"(",
"final",
"long",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kAlarm_TriggerTime_Address",
",",
"(",
"int",
")",
"(",
"value",
")",
",",
"status",
")",
";",
"}",
"public",
"static",
"long",
"readTriggerTime",
"(",
")",
"{",
"return",
"(",
"long",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kAlarm_TriggerTime_Address",
",",
"status",
")",
")",
"&",
"0xFFFFFFFFl",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kAlarm_Enable_Address",
"=",
"0x8124",
";",
"public",
"static",
"void",
"writeEnable",
"(",
"final",
"boolean",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kAlarm_Enable_Address",
",",
"(",
"value",
"?",
"1",
":",
"0",
")",
",",
"status",
")",
";",
"}",
"public",
"static",
"boolean",
"readEnable",
"(",
")",
"{",
"return",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kAlarm_Enable_Address",
",",
"status",
")",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"}",
"</s>"
] |
7,405 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"public",
"interface",
"DMAChannelDescriptors",
"{",
"public",
"static",
"final",
"int",
"kDMA_VERSION",
"=",
"1",
";",
"public",
"static",
"final",
"int",
"kNUM_DMA_CHANNELS",
"=",
"1",
";",
"static",
"class",
"tDMAChannelDescriptor",
"{",
"public",
"tDMAChannelDescriptor",
"(",
"int",
"c",
",",
"int",
"ba",
",",
"int",
"d",
",",
"int",
"w",
")",
"{",
"channel",
"=",
"c",
";",
"baseAddress",
"=",
"ba",
";",
"depth",
"=",
"d",
";",
"write",
"=",
"w",
";",
"}",
"public",
"final",
"int",
"channel",
";",
"public",
"final",
"int",
"baseAddress",
";",
"public",
"final",
"int",
"depth",
";",
"public",
"final",
"int",
"write",
";",
"}",
"static",
"final",
"tDMAChannelDescriptor",
"kDMAChannelDescriptors",
"[",
"]",
"=",
"{",
"new",
"tDMAChannelDescriptor",
"(",
"0",
",",
"0x00007F9C",
",",
"1024",
",",
"1",
")",
",",
"}",
";",
"}",
"</s>"
] |
7,406 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"public",
"interface",
"ExpectedFPGASignature",
"{",
"public",
"static",
"final",
"int",
"kExpectedFPGAVersion",
"=",
"2011",
";",
"public",
"static",
"final",
"int",
"kExpectedFPGARevision",
"=",
"0x00105003",
";",
"public",
"static",
"final",
"int",
"kExpectedFPGASignature",
"[",
"]",
"=",
"{",
"0x2EAA5E59",
",",
"0xCAF1A8A9",
",",
"0x66853A01",
",",
"0x1B61CC91",
",",
"}",
";",
"}",
"</s>"
] |
7,407 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"import",
"com",
".",
"ni",
".",
"rio",
".",
"*",
";",
"public",
"class",
"tAI",
"extends",
"tSystem",
"{",
"public",
"tAI",
"(",
"final",
"int",
"sys_index",
")",
"{",
"super",
"(",
")",
";",
"m_SystemIndex",
"=",
"sys_index",
";",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"m_SystemIndex",
">=",
"kNumSystems",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"}",
"protected",
"void",
"finalize",
"(",
")",
"{",
"super",
".",
"finalize",
"(",
")",
";",
"}",
"public",
"int",
"getSystemIndex",
"(",
")",
"{",
"return",
"m_SystemIndex",
";",
"}",
"public",
"static",
"final",
"int",
"kNumSystems",
"=",
"2",
";",
"public",
"final",
"int",
"m_SystemIndex",
";",
"private",
"static",
"final",
"int",
"kConfig_ScanSize_BitfieldMask",
"=",
"0x1C000000",
";",
"private",
"static",
"final",
"int",
"kConfig_ScanSize_BitfieldOffset",
"=",
"26",
";",
"private",
"static",
"final",
"int",
"kConfig_ConvertRate_BitfieldMask",
"=",
"0x03FFFFFF",
";",
"private",
"static",
"final",
"int",
"kConfig_ConvertRate_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kAI0_Config_Address",
"=",
"0x8414",
";",
"private",
"static",
"final",
"int",
"kAI1_Config_Address",
"=",
"0x8400",
";",
"private",
"static",
"final",
"int",
"kConfig_Addresses",
"[",
"]",
"=",
"{",
"kAI0_Config_Address",
",",
"kAI1_Config_Address",
",",
"}",
";",
"public",
"void",
"writeConfig",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_ScanSize",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_ScanSize_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_ScanSize_BitfieldOffset",
")",
"&",
"kConfig_ScanSize_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_ConvertRate",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_ConvertRate_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_ConvertRate_BitfieldOffset",
")",
"&",
"kConfig_ConvertRate_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"int",
"readConfig",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"byte",
"readConfig_ScanSize",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_ScanSize_BitfieldMask",
")",
">>>",
"kConfig_ScanSize_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000007",
")",
";",
"}",
"public",
"int",
"readConfig_ConvertRate",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_ConvertRate_BitfieldMask",
")",
">>>",
"kConfig_ConvertRate_BitfieldOffset",
")",
";",
"return",
"(",
"int",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x03FFFFFF",
")",
";",
"}",
"public",
"static",
"final",
"int",
"kScanList_NumElements",
"=",
"8",
";",
"public",
"static",
"final",
"int",
"kScanList_ElementSize",
"=",
"3",
";",
"public",
"static",
"final",
"int",
"kScanList_ElementMask",
"=",
"0x7",
";",
"private",
"static",
"final",
"int",
"kAI0_ScanList_Address",
"=",
"0x8410",
";",
"private",
"static",
"final",
"int",
"kAI1_ScanList_Address",
"=",
"0x83FC",
";",
"private",
"static",
"final",
"int",
"kScanList_Addresses",
"[",
"]",
"=",
"{",
"kAI0_ScanList_Address",
",",
"kAI1_ScanList_Address",
",",
"}",
";",
"public",
"void",
"writeScanList",
"(",
"final",
"int",
"bitfield_index",
",",
"final",
"int",
"value",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kScanList_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kScanList_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"(",
"kScanList_ElementMask",
"<<",
"(",
"(",
"kScanList_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kScanList_ElementSize",
")",
")",
";",
"regValue",
"|=",
"(",
"(",
"value",
"&",
"kScanList_ElementMask",
")",
"<<",
"(",
"(",
"kScanList_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kScanList_ElementSize",
")",
")",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kScanList_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"byte",
"readScanList",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kScanList_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"arrayElementValue",
"=",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kScanList_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
">>>",
"(",
"(",
"kScanList_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kScanList_ElementSize",
")",
")",
"&",
"kScanList_ElementMask",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"arrayElementValue",
")",
"&",
"0x00000007",
")",
";",
"}",
"public",
"static",
"final",
"int",
"kAverageBits_NumElements",
"=",
"8",
";",
"public",
"static",
"final",
"int",
"kAverageBits_ElementSize",
"=",
"4",
";",
"public",
"static",
"final",
"int",
"kAverageBits_ElementMask",
"=",
"0xF",
";",
"private",
"static",
"final",
"int",
"kAI0_AverageBits_Address",
"=",
"0x8408",
";",
"private",
"static",
"final",
"int",
"kAI1_AverageBits_Address",
"=",
"0x83F4",
";",
"private",
"static",
"final",
"int",
"kAverageBits_Addresses",
"[",
"]",
"=",
"{",
"kAI0_AverageBits_Address",
",",
"kAI1_AverageBits_Address",
",",
"}",
";",
"public",
"void",
"writeAverageBits",
"(",
"final",
"int",
"bitfield_index",
",",
"final",
"int",
"value",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kAverageBits_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kAverageBits_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"(",
"kAverageBits_ElementMask",
"<<",
"(",
"(",
"kAverageBits_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kAverageBits_ElementSize",
")",
")",
";",
"regValue",
"|=",
"(",
"(",
"value",
"&",
"kAverageBits_ElementMask",
")",
"<<",
"(",
"(",
"kAverageBits_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kAverageBits_ElementSize",
")",
")",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kAverageBits_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"byte",
"readAverageBits",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kAverageBits_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"arrayElementValue",
"=",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kAverageBits_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
">>>",
"(",
"(",
"kAverageBits_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kAverageBits_ElementSize",
")",
")",
"&",
"kAverageBits_ElementMask",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"arrayElementValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kAI0_LoopTiming_Address",
"=",
"0x8404",
";",
"private",
"static",
"final",
"int",
"kAI1_LoopTiming_Address",
"=",
"0x83F0",
";",
"private",
"static",
"final",
"int",
"kLoopTiming_Addresses",
"[",
"]",
"=",
"{",
"kAI0_LoopTiming_Address",
",",
"kAI1_LoopTiming_Address",
",",
"}",
";",
"public",
"long",
"readLoopTiming",
"(",
")",
"{",
"return",
"(",
"long",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kLoopTiming_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
"&",
"0xFFFFFFFFl",
")",
";",
"}",
"public",
"static",
"final",
"int",
"kOversampleBits_NumElements",
"=",
"8",
";",
"public",
"static",
"final",
"int",
"kOversampleBits_ElementSize",
"=",
"4",
";",
"public",
"static",
"final",
"int",
"kOversampleBits_ElementMask",
"=",
"0xF",
";",
"private",
"static",
"final",
"int",
"kAI0_OversampleBits_Address",
"=",
"0x840C",
";",
"private",
"static",
"final",
"int",
"kAI1_OversampleBits_Address",
"=",
"0x83F8",
";",
"private",
"static",
"final",
"int",
"kOversampleBits_Addresses",
"[",
"]",
"=",
"{",
"kAI0_OversampleBits_Address",
",",
"kAI1_OversampleBits_Address",
",",
"}",
";",
"public",
"void",
"writeOversampleBits",
"(",
"final",
"int",
"bitfield_index",
",",
"final",
"int",
"value",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kOversampleBits_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOversampleBits_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"(",
"kOversampleBits_ElementMask",
"<<",
"(",
"(",
"kOversampleBits_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kOversampleBits_ElementSize",
")",
")",
";",
"regValue",
"|=",
"(",
"(",
"value",
"&",
"kOversampleBits_ElementMask",
")",
"<<",
"(",
"(",
"kOversampleBits_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kOversampleBits_ElementSize",
")",
")",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kOversampleBits_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"byte",
"readOversampleBits",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kOversampleBits_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"arrayElementValue",
"=",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOversampleBits_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
">>>",
"(",
"(",
"kOversampleBits_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kOversampleBits_ElementSize",
")",
")",
"&",
"kOversampleBits_ElementMask",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"arrayElementValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kAI_Output_Address",
"=",
"0x8418",
";",
"public",
"static",
"int",
"readOutput",
"(",
")",
"{",
"return",
"(",
"int",
")",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kAI_Output_Address",
",",
"status",
")",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kReadSelect_Channel_BitfieldMask",
"=",
"0x0000001C",
";",
"private",
"static",
"final",
"int",
"kReadSelect_Channel_BitfieldOffset",
"=",
"2",
";",
"private",
"static",
"final",
"int",
"kReadSelect_Module_BitfieldMask",
"=",
"0x00000002",
";",
"private",
"static",
"final",
"int",
"kReadSelect_Module_BitfieldOffset",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kReadSelect_Averaged_BitfieldMask",
"=",
"0x00000001",
";",
"private",
"static",
"final",
"int",
"kReadSelect_Averaged_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kAI_ReadSelect_Address",
"=",
"0x8420",
";",
"public",
"static",
"void",
"writeReadSelect",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kAI_ReadSelect_Address",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeReadSelect_Channel",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kAI_ReadSelect_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kReadSelect_Channel_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kReadSelect_Channel_BitfieldOffset",
")",
"&",
"kReadSelect_Channel_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kAI_ReadSelect_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeReadSelect_Module",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kAI_ReadSelect_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kReadSelect_Module_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kReadSelect_Module_BitfieldOffset",
")",
"&",
"kReadSelect_Module_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kAI_ReadSelect_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeReadSelect_Averaged",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kAI_ReadSelect_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kReadSelect_Averaged_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kReadSelect_Averaged_BitfieldOffset",
")",
"&",
"kReadSelect_Averaged_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kAI_ReadSelect_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"int",
"readReadSelect",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kAI_ReadSelect_Address",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"static",
"byte",
"readReadSelect_Channel",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kAI_ReadSelect_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kReadSelect_Channel_BitfieldMask",
")",
">>>",
"kReadSelect_Channel_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000007",
")",
";",
"}",
"public",
"static",
"byte",
"readReadSelect_Module",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kAI_ReadSelect_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kReadSelect_Module_BitfieldMask",
")",
">>>",
"kReadSelect_Module_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000001",
")",
";",
"}",
"public",
"static",
"boolean",
"readReadSelect_Averaged",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kAI_ReadSelect_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kReadSelect_Averaged_BitfieldMask",
")",
">>>",
"kReadSelect_Averaged_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kAI_LatchOutput_Address",
"=",
"0x841C",
";",
"public",
"static",
"void",
"strobeLatchOutput",
"(",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kAI_LatchOutput_Address",
",",
"1",
",",
"status",
")",
";",
"}",
"}",
"</s>"
] |
7,408 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"import",
"com",
".",
"ni",
".",
"rio",
".",
"*",
";",
"public",
"class",
"tDIO",
"extends",
"tSystem",
"{",
"public",
"tDIO",
"(",
"final",
"int",
"sys_index",
")",
"{",
"super",
"(",
")",
";",
"m_SystemIndex",
"=",
"sys_index",
";",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"m_SystemIndex",
">=",
"kNumSystems",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"}",
"protected",
"void",
"finalize",
"(",
")",
"{",
"super",
".",
"finalize",
"(",
")",
";",
"}",
"public",
"int",
"getSystemIndex",
"(",
")",
"{",
"return",
"m_SystemIndex",
";",
"}",
"public",
"static",
"final",
"int",
"kNumSystems",
"=",
"2",
";",
"public",
"final",
"int",
"m_SystemIndex",
";",
"private",
"static",
"final",
"int",
"kDIO0_DO_Address",
"=",
"0x8360",
";",
"private",
"static",
"final",
"int",
"kDIO1_DO_Address",
"=",
"0x82F4",
";",
"private",
"static",
"final",
"int",
"kDO_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_DO_Address",
",",
"kDIO1_DO_Address",
",",
"}",
";",
"public",
"void",
"writeDO",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDO_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"int",
"readDO",
"(",
")",
"{",
"return",
"(",
"int",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDO_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
"&",
"0x0000FFFF",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kDIO0_I2CDataToSend_Address",
"=",
"0x8328",
";",
"private",
"static",
"final",
"int",
"kDIO1_I2CDataToSend_Address",
"=",
"0x82BC",
";",
"private",
"static",
"final",
"int",
"kI2CDataToSend_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_I2CDataToSend_Address",
",",
"kDIO1_I2CDataToSend_Address",
",",
"}",
";",
"public",
"void",
"writeI2CDataToSend",
"(",
"final",
"long",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kI2CDataToSend_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"(",
"int",
")",
"(",
"value",
")",
",",
"status",
")",
";",
"}",
"public",
"long",
"readI2CDataToSend",
"(",
")",
"{",
"return",
"(",
"long",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CDataToSend_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
"&",
"0xFFFFFFFFl",
")",
";",
"}",
"public",
"static",
"final",
"int",
"kFilterSelect_NumElements",
"=",
"16",
";",
"public",
"static",
"final",
"int",
"kFilterSelect_ElementSize",
"=",
"2",
";",
"public",
"static",
"final",
"int",
"kFilterSelect_ElementMask",
"=",
"0x3",
";",
"private",
"static",
"final",
"int",
"kDIO0_FilterSelect_Address",
"=",
"0x8300",
";",
"private",
"static",
"final",
"int",
"kDIO1_FilterSelect_Address",
"=",
"0x8294",
";",
"private",
"static",
"final",
"int",
"kFilterSelect_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_FilterSelect_Address",
",",
"kDIO1_FilterSelect_Address",
",",
"}",
";",
"public",
"void",
"writeFilterSelect",
"(",
"final",
"int",
"bitfield_index",
",",
"final",
"int",
"value",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kFilterSelect_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kFilterSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"(",
"kFilterSelect_ElementMask",
"<<",
"(",
"(",
"kFilterSelect_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kFilterSelect_ElementSize",
")",
")",
";",
"regValue",
"|=",
"(",
"(",
"value",
"&",
"kFilterSelect_ElementMask",
")",
"<<",
"(",
"(",
"kFilterSelect_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kFilterSelect_ElementSize",
")",
")",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kFilterSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"byte",
"readFilterSelect",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kFilterSelect_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"arrayElementValue",
"=",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kFilterSelect_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
">>>",
"(",
"(",
"kFilterSelect_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kFilterSelect_ElementSize",
")",
")",
"&",
"kFilterSelect_ElementMask",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"arrayElementValue",
")",
"&",
"0x00000003",
")",
";",
"}",
"public",
"static",
"final",
"int",
"kFilterPeriod_NumElements",
"=",
"3",
";",
"public",
"static",
"final",
"int",
"kFilterPeriod_ElementSize",
"=",
"8",
";",
"public",
"static",
"final",
"int",
"kFilterPeriod_ElementMask",
"=",
"0xFF",
";",
"private",
"static",
"final",
"int",
"kDIO0_FilterPeriod_Address",
"=",
"0x8304",
";",
"private",
"static",
"final",
"int",
"kDIO1_FilterPeriod_Address",
"=",
"0x8298",
";",
"private",
"static",
"final",
"int",
"kFilterPeriod_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_FilterPeriod_Address",
",",
"kDIO1_FilterPeriod_Address",
",",
"}",
";",
"public",
"void",
"writeFilterPeriod",
"(",
"final",
"int",
"bitfield_index",
",",
"final",
"int",
"value",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kFilterPeriod_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kFilterPeriod_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"(",
"kFilterPeriod_ElementMask",
"<<",
"(",
"(",
"kFilterPeriod_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kFilterPeriod_ElementSize",
")",
")",
";",
"regValue",
"|=",
"(",
"(",
"value",
"&",
"kFilterPeriod_ElementMask",
")",
"<<",
"(",
"(",
"kFilterPeriod_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kFilterPeriod_ElementSize",
")",
")",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kFilterPeriod_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"short",
"readFilterPeriod",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kFilterPeriod_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"arrayElementValue",
"=",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kFilterPeriod_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
">>>",
"(",
"(",
"kFilterPeriod_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kFilterPeriod_ElementSize",
")",
")",
"&",
"kFilterPeriod_ElementMask",
";",
"return",
"(",
"short",
")",
"(",
"(",
"arrayElementValue",
")",
"&",
"0x000000FF",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kDIO0_OutputEnable_Address",
"=",
"0x8358",
";",
"private",
"static",
"final",
"int",
"kDIO1_OutputEnable_Address",
"=",
"0x82EC",
";",
"private",
"static",
"final",
"int",
"kOutputEnable_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_OutputEnable_Address",
",",
"kDIO1_OutputEnable_Address",
",",
"}",
";",
"public",
"void",
"writeOutputEnable",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kOutputEnable_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"int",
"readOutputEnable",
"(",
")",
"{",
"return",
"(",
"int",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOutputEnable_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
"&",
"0x0000FFFF",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kDIO0_DI_Address",
"=",
"0x835C",
";",
"private",
"static",
"final",
"int",
"kDIO1_DI_Address",
"=",
"0x82F0",
";",
"private",
"static",
"final",
"int",
"kDI_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_DI_Address",
",",
"kDIO1_DI_Address",
",",
"}",
";",
"public",
"int",
"readDI",
"(",
")",
"{",
"return",
"(",
"int",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDI_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
"&",
"0x0000FFFF",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kDIO0_I2CDataReceived_Address",
"=",
"0x831C",
";",
"private",
"static",
"final",
"int",
"kDIO1_I2CDataReceived_Address",
"=",
"0x82B0",
";",
"private",
"static",
"final",
"int",
"kI2CDataReceived_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_I2CDataReceived_Address",
",",
"kDIO1_I2CDataReceived_Address",
",",
"}",
";",
"public",
"long",
"readI2CDataReceived",
"(",
")",
"{",
"return",
"(",
"long",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CDataReceived_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
"&",
"0xFFFFFFFFl",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kI2CStatus_Transaction_BitfieldMask",
"=",
"0x04000000",
";",
"private",
"static",
"final",
"int",
"kI2CStatus_Transaction_BitfieldOffset",
"=",
"26",
";",
"private",
"static",
"final",
"int",
"kI2CStatus_Done_BitfieldMask",
"=",
"0x02000000",
";",
"private",
"static",
"final",
"int",
"kI2CStatus_Done_BitfieldOffset",
"=",
"25",
";",
"private",
"static",
"final",
"int",
"kI2CStatus_Aborted_BitfieldMask",
"=",
"0x01000000",
";",
"private",
"static",
"final",
"int",
"kI2CStatus_Aborted_BitfieldOffset",
"=",
"24",
";",
"private",
"static",
"final",
"int",
"kI2CStatus_DataReceivedHigh_BitfieldMask",
"=",
"0x00FFFFFF",
";",
"private",
"static",
"final",
"int",
"kI2CStatus_DataReceivedHigh_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kDIO0_I2CStatus_Address",
"=",
"0x8318",
";",
"private",
"static",
"final",
"int",
"kDIO1_I2CStatus_Address",
"=",
"0x82AC",
";",
"private",
"static",
"final",
"int",
"kI2CStatus_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_I2CStatus_Address",
",",
"kDIO1_I2CStatus_Address",
",",
"}",
";",
"public",
"int",
"readI2CStatus",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CStatus_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"byte",
"readI2CStatus_Transaction",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CStatus_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kI2CStatus_Transaction_BitfieldMask",
")",
">>>",
"kI2CStatus_Transaction_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000001",
")",
";",
"}",
"public",
"boolean",
"readI2CStatus_Done",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CStatus_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kI2CStatus_Done_BitfieldMask",
")",
">>>",
"kI2CStatus_Done_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"boolean",
"readI2CStatus_Aborted",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CStatus_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kI2CStatus_Aborted_BitfieldMask",
")",
">>>",
"kI2CStatus_Aborted_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"int",
"readI2CStatus_DataReceivedHigh",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CStatus_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kI2CStatus_DataReceivedHigh_BitfieldMask",
")",
">>>",
"kI2CStatus_DataReceivedHigh_BitfieldOffset",
")",
";",
"return",
"(",
"int",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00FFFFFF",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kSlowValue_RelayFwd_BitfieldMask",
"=",
"0x000FF000",
";",
"private",
"static",
"final",
"int",
"kSlowValue_RelayFwd_BitfieldOffset",
"=",
"12",
";",
"private",
"static",
"final",
"int",
"kSlowValue_RelayRev_BitfieldMask",
"=",
"0x00000FF0",
";",
"private",
"static",
"final",
"int",
"kSlowValue_RelayRev_BitfieldOffset",
"=",
"4",
";",
"private",
"static",
"final",
"int",
"kSlowValue_I2CHeader_BitfieldMask",
"=",
"0x0000000F",
";",
"private",
"static",
"final",
"int",
"kSlowValue_I2CHeader_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kDIO0_SlowValue_Address",
"=",
"0x8314",
";",
"private",
"static",
"final",
"int",
"kDIO1_SlowValue_Address",
"=",
"0x82A8",
";",
"private",
"static",
"final",
"int",
"kSlowValue_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_SlowValue_Address",
",",
"kDIO1_SlowValue_Address",
",",
"}",
";",
"public",
"void",
"writeSlowValue",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSlowValue_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeSlowValue_RelayFwd",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSlowValue_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kSlowValue_RelayFwd_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kSlowValue_RelayFwd_BitfieldOffset",
")",
"&",
"kSlowValue_RelayFwd_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSlowValue_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeSlowValue_RelayRev",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSlowValue_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kSlowValue_RelayRev_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kSlowValue_RelayRev_BitfieldOffset",
")",
"&",
"kSlowValue_RelayRev_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSlowValue_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeSlowValue_I2CHeader",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSlowValue_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kSlowValue_I2CHeader_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kSlowValue_I2CHeader_BitfieldOffset",
")",
"&",
"kSlowValue_I2CHeader_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSlowValue_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"int",
"readSlowValue",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSlowValue_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"short",
"readSlowValue_RelayFwd",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSlowValue_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kSlowValue_RelayFwd_BitfieldMask",
")",
">>>",
"kSlowValue_RelayFwd_BitfieldOffset",
")",
";",
"return",
"(",
"short",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x000000FF",
")",
";",
"}",
"public",
"short",
"readSlowValue_RelayRev",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSlowValue_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kSlowValue_RelayRev_BitfieldMask",
")",
">>>",
"kSlowValue_RelayRev_BitfieldOffset",
")",
";",
"return",
"(",
"short",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x000000FF",
")",
";",
"}",
"public",
"byte",
"readSlowValue_I2CHeader",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSlowValue_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kSlowValue_I2CHeader_BitfieldMask",
")",
">>>",
"kSlowValue_I2CHeader_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"public",
"static",
"final",
"int",
"kPWMPeriodScale_NumElements",
"=",
"10",
";",
"public",
"static",
"final",
"int",
"kPWMPeriodScale_ElementSize",
"=",
"2",
";",
"public",
"static",
"final",
"int",
"kPWMPeriodScale_ElementMask",
"=",
"0x3",
";",
"private",
"static",
"final",
"int",
"kDIO0_PWMPeriodScale_Address",
"=",
"0x832C",
";",
"private",
"static",
"final",
"int",
"kDIO1_PWMPeriodScale_Address",
"=",
"0x82C0",
";",
"private",
"static",
"final",
"int",
"kPWMPeriodScale_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_PWMPeriodScale_Address",
",",
"kDIO1_PWMPeriodScale_Address",
",",
"}",
";",
"public",
"void",
"writePWMPeriodScale",
"(",
"final",
"int",
"bitfield_index",
",",
"final",
"int",
"value",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kPWMPeriodScale_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kPWMPeriodScale_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"(",
"kPWMPeriodScale_ElementMask",
"<<",
"(",
"(",
"kPWMPeriodScale_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kPWMPeriodScale_ElementSize",
")",
")",
";",
"regValue",
"|=",
"(",
"(",
"value",
"&",
"kPWMPeriodScale_ElementMask",
")",
"<<",
"(",
"(",
"kPWMPeriodScale_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kPWMPeriodScale_ElementSize",
")",
")",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kPWMPeriodScale_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"byte",
"readPWMPeriodScale",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kPWMPeriodScale_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"arrayElementValue",
"=",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kPWMPeriodScale_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
">>>",
"(",
"(",
"kPWMPeriodScale_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kPWMPeriodScale_ElementSize",
")",
")",
"&",
"kPWMPeriodScale_ElementMask",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"arrayElementValue",
")",
"&",
"0x00000003",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kDIO0_Pulse_Address",
"=",
"0x830C",
";",
"private",
"static",
"final",
"int",
"kDIO1_Pulse_Address",
"=",
"0x82A0",
";",
"private",
"static",
"final",
"int",
"kPulse_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_Pulse_Address",
",",
"kDIO1_Pulse_Address",
",",
"}",
";",
"public",
"void",
"writePulse",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kPulse_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"int",
"readPulse",
"(",
")",
"{",
"return",
"(",
"int",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kPulse_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
"&",
"0x0000FFFF",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kDIO0_I2CStart_Address",
"=",
"0x8320",
";",
"private",
"static",
"final",
"int",
"kDIO1_I2CStart_Address",
"=",
"0x82B4",
";",
"private",
"static",
"final",
"int",
"kI2CStart_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_I2CStart_Address",
",",
"kDIO1_I2CStart_Address",
",",
"}",
";",
"public",
"void",
"strobeI2CStart",
"(",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kI2CStart_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"1",
",",
"status",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kDIO0_BFL_Address",
"=",
"0x8310",
";",
"private",
"static",
"final",
"int",
"kDIO1_BFL_Address",
"=",
"0x82A4",
";",
"private",
"static",
"final",
"int",
"kBFL_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_BFL_Address",
",",
"kDIO1_BFL_Address",
",",
"}",
";",
"public",
"void",
"writeBFL",
"(",
"final",
"boolean",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kBFL_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"(",
"value",
"?",
"1",
":",
"0",
")",
",",
"status",
")",
";",
"}",
"public",
"boolean",
"readBFL",
"(",
")",
"{",
"return",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kBFL_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"final",
"int",
"kDO_PWMDutyCycle_NumElements",
"=",
"4",
";",
"public",
"static",
"final",
"int",
"kDO_PWMDutyCycle_ElementSize",
"=",
"8",
";",
"public",
"static",
"final",
"int",
"kDO_PWMDutyCycle_ElementMask",
"=",
"0xFF",
";",
"private",
"static",
"final",
"int",
"kDIO0_DO_PWMDutyCycle_Address",
"=",
"0x82FC",
";",
"private",
"static",
"final",
"int",
"kDIO1_DO_PWMDutyCycle_Address",
"=",
"0x8290",
";",
"private",
"static",
"final",
"int",
"kDO_PWMDutyCycle_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_DO_PWMDutyCycle_Address",
",",
"kDIO1_DO_PWMDutyCycle_Address",
",",
"}",
";",
"public",
"void",
"writeDO_PWMDutyCycle",
"(",
"final",
"int",
"bitfield_index",
",",
"final",
"int",
"value",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kDO_PWMDutyCycle_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMDutyCycle_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"(",
"kDO_PWMDutyCycle_ElementMask",
"<<",
"(",
"(",
"kDO_PWMDutyCycle_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kDO_PWMDutyCycle_ElementSize",
")",
")",
";",
"regValue",
"|=",
"(",
"(",
"value",
"&",
"kDO_PWMDutyCycle_ElementMask",
")",
"<<",
"(",
"(",
"kDO_PWMDutyCycle_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kDO_PWMDutyCycle_ElementSize",
")",
")",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMDutyCycle_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"short",
"readDO_PWMDutyCycle",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kDO_PWMDutyCycle_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"arrayElementValue",
"=",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMDutyCycle_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
">>>",
"(",
"(",
"kDO_PWMDutyCycle_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kDO_PWMDutyCycle_ElementSize",
")",
")",
"&",
"kDO_PWMDutyCycle_ElementMask",
";",
"return",
"(",
"short",
")",
"(",
"(",
"arrayElementValue",
")",
"&",
"0x000000FF",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kDIO0_PulseLength_Address",
"=",
"0x8308",
";",
"private",
"static",
"final",
"int",
"kDIO1_PulseLength_Address",
"=",
"0x829C",
";",
"private",
"static",
"final",
"int",
"kPulseLength_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_PulseLength_Address",
",",
"kDIO1_PulseLength_Address",
",",
"}",
";",
"public",
"void",
"writePulseLength",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kPulseLength_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"short",
"readPulseLength",
"(",
")",
"{",
"return",
"(",
"short",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kPulseLength_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
"&",
"0x000000FF",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kDO_PWMConfig_PeriodPower_BitfieldMask",
"=",
"0x000F0000",
";",
"private",
"static",
"final",
"int",
"kDO_PWMConfig_PeriodPower_BitfieldOffset",
"=",
"16",
";",
"private",
"static",
"final",
"int",
"kDO_PWMConfig_OutputSelect_0_BitfieldMask",
"=",
"0x0000F000",
";",
"private",
"static",
"final",
"int",
"kDO_PWMConfig_OutputSelect_0_BitfieldOffset",
"=",
"12",
";",
"private",
"static",
"final",
"int",
"kDO_PWMConfig_OutputSelect_1_BitfieldMask",
"=",
"0x00000F00",
";",
"private",
"static",
"final",
"int",
"kDO_PWMConfig_OutputSelect_1_BitfieldOffset",
"=",
"8",
";",
"private",
"static",
"final",
"int",
"kDO_PWMConfig_OutputSelect_2_BitfieldMask",
"=",
"0x000000F0",
";",
"private",
"static",
"final",
"int",
"kDO_PWMConfig_OutputSelect_2_BitfieldOffset",
"=",
"4",
";",
"private",
"static",
"final",
"int",
"kDO_PWMConfig_OutputSelect_3_BitfieldMask",
"=",
"0x0000000F",
";",
"private",
"static",
"final",
"int",
"kDO_PWMConfig_OutputSelect_3_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kDIO0_DO_PWMConfig_Address",
"=",
"0x82F8",
";",
"private",
"static",
"final",
"int",
"kDIO1_DO_PWMConfig_Address",
"=",
"0x828C",
";",
"private",
"static",
"final",
"int",
"kDO_PWMConfig_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_DO_PWMConfig_Address",
",",
"kDIO1_DO_PWMConfig_Address",
",",
"}",
";",
"public",
"void",
"writeDO_PWMConfig",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeDO_PWMConfig_PeriodPower",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kDO_PWMConfig_PeriodPower_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kDO_PWMConfig_PeriodPower_BitfieldOffset",
")",
"&",
"kDO_PWMConfig_PeriodPower_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeDO_PWMConfig_OutputSelect_0",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kDO_PWMConfig_OutputSelect_0_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kDO_PWMConfig_OutputSelect_0_BitfieldOffset",
")",
"&",
"kDO_PWMConfig_OutputSelect_0_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeDO_PWMConfig_OutputSelect_1",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kDO_PWMConfig_OutputSelect_1_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kDO_PWMConfig_OutputSelect_1_BitfieldOffset",
")",
"&",
"kDO_PWMConfig_OutputSelect_1_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeDO_PWMConfig_OutputSelect_2",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kDO_PWMConfig_OutputSelect_2_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kDO_PWMConfig_OutputSelect_2_BitfieldOffset",
")",
"&",
"kDO_PWMConfig_OutputSelect_2_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeDO_PWMConfig_OutputSelect_3",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kDO_PWMConfig_OutputSelect_3_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kDO_PWMConfig_OutputSelect_3_BitfieldOffset",
")",
"&",
"kDO_PWMConfig_OutputSelect_3_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"int",
"readDO_PWMConfig",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"byte",
"readDO_PWMConfig_PeriodPower",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kDO_PWMConfig_PeriodPower_BitfieldMask",
")",
">>>",
"kDO_PWMConfig_PeriodPower_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"public",
"byte",
"readDO_PWMConfig_OutputSelect_0",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kDO_PWMConfig_OutputSelect_0_BitfieldMask",
")",
">>>",
"kDO_PWMConfig_OutputSelect_0_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"public",
"byte",
"readDO_PWMConfig_OutputSelect_1",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kDO_PWMConfig_OutputSelect_1_BitfieldMask",
")",
">>>",
"kDO_PWMConfig_OutputSelect_1_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"public",
"byte",
"readDO_PWMConfig_OutputSelect_2",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kDO_PWMConfig_OutputSelect_2_BitfieldMask",
")",
">>>",
"kDO_PWMConfig_OutputSelect_2_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"public",
"byte",
"readDO_PWMConfig_OutputSelect_3",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDO_PWMConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kDO_PWMConfig_OutputSelect_3_BitfieldMask",
")",
">>>",
"kDO_PWMConfig_OutputSelect_3_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kI2CConfig_Address_BitfieldMask",
"=",
"0x7F800000",
";",
"private",
"static",
"final",
"int",
"kI2CConfig_Address_BitfieldOffset",
"=",
"23",
";",
"private",
"static",
"final",
"int",
"kI2CConfig_BytesToRead_BitfieldMask",
"=",
"0x00700000",
";",
"private",
"static",
"final",
"int",
"kI2CConfig_BytesToRead_BitfieldOffset",
"=",
"20",
";",
"private",
"static",
"final",
"int",
"kI2CConfig_BytesToWrite_BitfieldMask",
"=",
"0x000E0000",
";",
"private",
"static",
"final",
"int",
"kI2CConfig_BytesToWrite_BitfieldOffset",
"=",
"17",
";",
"private",
"static",
"final",
"int",
"kI2CConfig_DataToSendHigh_BitfieldMask",
"=",
"0x0001FFFE",
";",
"private",
"static",
"final",
"int",
"kI2CConfig_DataToSendHigh_BitfieldOffset",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kI2CConfig_BitwiseHandshake_BitfieldMask",
"=",
"0x00000001",
";",
"private",
"static",
"final",
"int",
"kI2CConfig_BitwiseHandshake_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kDIO0_I2CConfig_Address",
"=",
"0x8324",
";",
"private",
"static",
"final",
"int",
"kDIO1_I2CConfig_Address",
"=",
"0x82B8",
";",
"private",
"static",
"final",
"int",
"kI2CConfig_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_I2CConfig_Address",
",",
"kDIO1_I2CConfig_Address",
",",
"}",
";",
"public",
"void",
"writeI2CConfig",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kI2CConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeI2CConfig_Address",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kI2CConfig_Address_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kI2CConfig_Address_BitfieldOffset",
")",
"&",
"kI2CConfig_Address_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kI2CConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeI2CConfig_BytesToRead",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kI2CConfig_BytesToRead_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kI2CConfig_BytesToRead_BitfieldOffset",
")",
"&",
"kI2CConfig_BytesToRead_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kI2CConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeI2CConfig_BytesToWrite",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kI2CConfig_BytesToWrite_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kI2CConfig_BytesToWrite_BitfieldOffset",
")",
"&",
"kI2CConfig_BytesToWrite_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kI2CConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeI2CConfig_DataToSendHigh",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kI2CConfig_DataToSendHigh_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kI2CConfig_DataToSendHigh_BitfieldOffset",
")",
"&",
"kI2CConfig_DataToSendHigh_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kI2CConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeI2CConfig_BitwiseHandshake",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kI2CConfig_BitwiseHandshake_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kI2CConfig_BitwiseHandshake_BitfieldOffset",
")",
"&",
"kI2CConfig_BitwiseHandshake_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kI2CConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"int",
"readI2CConfig",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"short",
"readI2CConfig_Address",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kI2CConfig_Address_BitfieldMask",
")",
">>>",
"kI2CConfig_Address_BitfieldOffset",
")",
";",
"return",
"(",
"short",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x000000FF",
")",
";",
"}",
"public",
"byte",
"readI2CConfig_BytesToRead",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kI2CConfig_BytesToRead_BitfieldMask",
")",
">>>",
"kI2CConfig_BytesToRead_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000007",
")",
";",
"}",
"public",
"byte",
"readI2CConfig_BytesToWrite",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kI2CConfig_BytesToWrite_BitfieldMask",
")",
">>>",
"kI2CConfig_BytesToWrite_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000007",
")",
";",
"}",
"public",
"int",
"readI2CConfig_DataToSendHigh",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kI2CConfig_DataToSendHigh_BitfieldMask",
")",
">>>",
"kI2CConfig_DataToSendHigh_BitfieldOffset",
")",
";",
"return",
"(",
"int",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000FFFF",
")",
";",
"}",
"public",
"boolean",
"readI2CConfig_BitwiseHandshake",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kI2CConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kI2CConfig_BitwiseHandshake_BitfieldMask",
")",
">>>",
"kI2CConfig_BitwiseHandshake_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kDIO_LoopTiming_Address",
"=",
"0x8368",
";",
"public",
"static",
"int",
"readLoopTiming",
"(",
")",
"{",
"return",
"(",
"int",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDIO_LoopTiming_Address",
",",
"status",
")",
")",
"&",
"0x0000FFFF",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kPWMConfig_Period_BitfieldMask",
"=",
"0xFFFF0000",
";",
"private",
"static",
"final",
"int",
"kPWMConfig_Period_BitfieldOffset",
"=",
"16",
";",
"private",
"static",
"final",
"int",
"kPWMConfig_MinHigh_BitfieldMask",
"=",
"0x0000FFFF",
";",
"private",
"static",
"final",
"int",
"kPWMConfig_MinHigh_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kDIO_PWMConfig_Address",
"=",
"0x8364",
";",
"public",
"static",
"void",
"writePWMConfig",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDIO_PWMConfig_Address",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writePWMConfig_Period",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDIO_PWMConfig_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kPWMConfig_Period_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kPWMConfig_Period_BitfieldOffset",
")",
"&",
"kPWMConfig_Period_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDIO_PWMConfig_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writePWMConfig_MinHigh",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDIO_PWMConfig_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kPWMConfig_MinHigh_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kPWMConfig_MinHigh_BitfieldOffset",
")",
"&",
"kPWMConfig_MinHigh_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDIO_PWMConfig_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"int",
"readPWMConfig",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDIO_PWMConfig_Address",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"static",
"int",
"readPWMConfig_Period",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDIO_PWMConfig_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kPWMConfig_Period_BitfieldMask",
")",
">>>",
"kPWMConfig_Period_BitfieldOffset",
")",
";",
"return",
"(",
"int",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000FFFF",
")",
";",
"}",
"public",
"static",
"int",
"readPWMConfig_MinHigh",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDIO_PWMConfig_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kPWMConfig_MinHigh_BitfieldMask",
")",
">>>",
"kPWMConfig_MinHigh_BitfieldOffset",
")",
";",
"return",
"(",
"int",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000FFFF",
")",
";",
"}",
"public",
"static",
"final",
"int",
"kPWMValue_NumRegisters",
"=",
"10",
";",
"private",
"static",
"final",
"int",
"kDIO0_PWMValue0_Address",
"=",
"0x8354",
";",
"private",
"static",
"final",
"int",
"kDIO0_PWMValue1_Address",
"=",
"0x8350",
";",
"private",
"static",
"final",
"int",
"kDIO0_PWMValue2_Address",
"=",
"0x834C",
";",
"private",
"static",
"final",
"int",
"kDIO0_PWMValue3_Address",
"=",
"0x8348",
";",
"private",
"static",
"final",
"int",
"kDIO0_PWMValue4_Address",
"=",
"0x8344",
";",
"private",
"static",
"final",
"int",
"kDIO0_PWMValue5_Address",
"=",
"0x8340",
";",
"private",
"static",
"final",
"int",
"kDIO0_PWMValue6_Address",
"=",
"0x833C",
";",
"private",
"static",
"final",
"int",
"kDIO0_PWMValue7_Address",
"=",
"0x8338",
";",
"private",
"static",
"final",
"int",
"kDIO0_PWMValue8_Address",
"=",
"0x8334",
";",
"private",
"static",
"final",
"int",
"kDIO0_PWMValue9_Address",
"=",
"0x8330",
";",
"private",
"static",
"final",
"int",
"kDIO1_PWMValue0_Address",
"=",
"0x82E8",
";",
"private",
"static",
"final",
"int",
"kDIO1_PWMValue1_Address",
"=",
"0x82E4",
";",
"private",
"static",
"final",
"int",
"kDIO1_PWMValue2_Address",
"=",
"0x82E0",
";",
"private",
"static",
"final",
"int",
"kDIO1_PWMValue3_Address",
"=",
"0x82DC",
";",
"private",
"static",
"final",
"int",
"kDIO1_PWMValue4_Address",
"=",
"0x82D8",
";",
"private",
"static",
"final",
"int",
"kDIO1_PWMValue5_Address",
"=",
"0x82D4",
";",
"private",
"static",
"final",
"int",
"kDIO1_PWMValue6_Address",
"=",
"0x82D0",
";",
"private",
"static",
"final",
"int",
"kDIO1_PWMValue7_Address",
"=",
"0x82CC",
";",
"private",
"static",
"final",
"int",
"kDIO1_PWMValue8_Address",
"=",
"0x82C8",
";",
"private",
"static",
"final",
"int",
"kDIO1_PWMValue9_Address",
"=",
"0x82C4",
";",
"private",
"static",
"final",
"int",
"kPWMValue_Addresses",
"[",
"]",
"=",
"{",
"kDIO0_PWMValue0_Address",
",",
"kDIO0_PWMValue1_Address",
",",
"kDIO0_PWMValue2_Address",
",",
"kDIO0_PWMValue3_Address",
",",
"kDIO0_PWMValue4_Address",
",",
"kDIO0_PWMValue5_Address",
",",
"kDIO0_PWMValue6_Address",
",",
"kDIO0_PWMValue7_Address",
",",
"kDIO0_PWMValue8_Address",
",",
"kDIO0_PWMValue9_Address",
",",
"kDIO1_PWMValue0_Address",
",",
"kDIO1_PWMValue1_Address",
",",
"kDIO1_PWMValue2_Address",
",",
"kDIO1_PWMValue3_Address",
",",
"kDIO1_PWMValue4_Address",
",",
"kDIO1_PWMValue5_Address",
",",
"kDIO1_PWMValue6_Address",
",",
"kDIO1_PWMValue7_Address",
",",
"kDIO1_PWMValue8_Address",
",",
"kDIO1_PWMValue9_Address",
",",
"}",
";",
"public",
"void",
"writePWMValue",
"(",
"final",
"int",
"reg_index",
",",
"final",
"int",
"value",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"reg_index",
">=",
"kPWMValue_NumRegisters",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kPWMValue_Addresses",
"[",
"m_SystemIndex",
"*",
"kPWMValue_NumRegisters",
"+",
"reg_index",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"short",
"readPWMValue",
"(",
"final",
"int",
"reg_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"reg_index",
">=",
"kPWMValue_NumRegisters",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"return",
"(",
"short",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kPWMValue_Addresses",
"[",
"m_SystemIndex",
"*",
"kPWMValue_NumRegisters",
"+",
"reg_index",
"]",
",",
"status",
")",
")",
"&",
"0x000000FF",
")",
";",
"}",
"}",
"</s>"
] |
7,409 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"import",
"com",
".",
"ni",
".",
"rio",
".",
"*",
";",
"public",
"class",
"tWatchdog",
"extends",
"tSystem",
"{",
"public",
"tWatchdog",
"(",
")",
"{",
"super",
"(",
")",
";",
"}",
"protected",
"void",
"finalize",
"(",
")",
"{",
"super",
".",
"finalize",
"(",
")",
";",
"}",
"public",
"static",
"final",
"int",
"kNumSystems",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kStatus_SystemActive_BitfieldMask",
"=",
"0x80000000",
";",
"private",
"static",
"final",
"int",
"kStatus_SystemActive_BitfieldOffset",
"=",
"31",
";",
"private",
"static",
"final",
"int",
"kStatus_Alive_BitfieldMask",
"=",
"0x40000000",
";",
"private",
"static",
"final",
"int",
"kStatus_Alive_BitfieldOffset",
"=",
"30",
";",
"private",
"static",
"final",
"int",
"kStatus_SysDisableCount_BitfieldMask",
"=",
"0x3FFF8000",
";",
"private",
"static",
"final",
"int",
"kStatus_SysDisableCount_BitfieldOffset",
"=",
"15",
";",
"private",
"static",
"final",
"int",
"kStatus_DisableCount_BitfieldMask",
"=",
"0x00007FFF",
";",
"private",
"static",
"final",
"int",
"kStatus_DisableCount_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kWatchdog_Status_Address",
"=",
"0x8448",
";",
"public",
"static",
"int",
"readStatus",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kWatchdog_Status_Address",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"static",
"boolean",
"readStatus_SystemActive",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kWatchdog_Status_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kStatus_SystemActive_BitfieldMask",
")",
">>>",
"kStatus_SystemActive_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readStatus_Alive",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kWatchdog_Status_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kStatus_Alive_BitfieldMask",
")",
">>>",
"kStatus_Alive_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"short",
"readStatus_SysDisableCount",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kWatchdog_Status_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kStatus_SysDisableCount_BitfieldMask",
")",
">>>",
"kStatus_SysDisableCount_BitfieldOffset",
")",
";",
"return",
"(",
"short",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00007FFF",
")",
";",
"}",
"public",
"static",
"short",
"readStatus_DisableCount",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kWatchdog_Status_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kStatus_DisableCount_BitfieldMask",
")",
">>>",
"kStatus_DisableCount_BitfieldOffset",
")",
";",
"return",
"(",
"short",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00007FFF",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kWatchdog_Feed_Address",
"=",
"0x8444",
";",
"public",
"static",
"void",
"strobeFeed",
"(",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kWatchdog_Feed_Address",
",",
"1",
",",
"status",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kWatchdog_Kill_Address",
"=",
"0x8440",
";",
"public",
"static",
"void",
"strobeKill",
"(",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kWatchdog_Kill_Address",
",",
"1",
",",
"status",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kWatchdog_Immortal_Address",
"=",
"0x8434",
";",
"public",
"static",
"void",
"writeImmortal",
"(",
"final",
"boolean",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kWatchdog_Immortal_Address",
",",
"(",
"value",
"?",
"1",
":",
"0",
")",
",",
"status",
")",
";",
"}",
"public",
"static",
"boolean",
"readImmortal",
"(",
")",
"{",
"return",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kWatchdog_Immortal_Address",
",",
"status",
")",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kWatchdog_Expiration_Address",
"=",
"0x8438",
";",
"public",
"static",
"void",
"writeExpiration",
"(",
"final",
"long",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kWatchdog_Expiration_Address",
",",
"(",
"int",
")",
"(",
"value",
")",
",",
"status",
")",
";",
"}",
"public",
"static",
"long",
"readExpiration",
"(",
")",
"{",
"return",
"(",
"long",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kWatchdog_Expiration_Address",
",",
"status",
")",
")",
"&",
"0xFFFFFFFFl",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kWatchdog_Timer_Address",
"=",
"0x843C",
";",
"public",
"static",
"long",
"readTimer",
"(",
")",
"{",
"return",
"(",
"long",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kWatchdog_Timer_Address",
",",
"status",
")",
")",
"&",
"0xFFFFFFFFl",
")",
";",
"}",
"}",
"</s>"
] |
7,410 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"import",
"com",
".",
"ni",
".",
"rio",
".",
"*",
";",
"public",
"class",
"tAccumulator",
"extends",
"tSystem",
"{",
"public",
"tAccumulator",
"(",
"final",
"int",
"sys_index",
")",
"{",
"super",
"(",
")",
";",
"m_SystemIndex",
"=",
"sys_index",
";",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"m_SystemIndex",
">=",
"kNumSystems",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"}",
"protected",
"void",
"finalize",
"(",
")",
"{",
"super",
".",
"finalize",
"(",
")",
";",
"}",
"public",
"int",
"getSystemIndex",
"(",
")",
"{",
"return",
"m_SystemIndex",
";",
"}",
"public",
"static",
"final",
"int",
"kNumSystems",
"=",
"2",
";",
"public",
"final",
"int",
"m_SystemIndex",
";",
"public",
"static",
"class",
"tOutput",
"{",
"public",
"tOutput",
"(",
"int",
"regValue1",
",",
"int",
"regValue2",
",",
"int",
"regValue3",
")",
"{",
"Value",
"=",
"(",
"(",
"(",
"long",
")",
"regValue1",
")",
"<<",
"32",
")",
"|",
"regValue2",
";",
"Count",
"=",
"regValue3",
";",
"}",
"public",
"final",
"long",
"Value",
";",
"public",
"final",
"int",
"Count",
";",
"}",
"private",
"static",
"final",
"int",
"kOutput_Value_BitfieldMask",
"=",
"0x00000000",
";",
"private",
"static",
"final",
"int",
"kOutput_Value_BitfieldOffset",
"=",
"32",
";",
"private",
"static",
"final",
"int",
"kOutput_Count_BitfieldMask",
"=",
"0xFFFFFFFF",
";",
"private",
"static",
"final",
"int",
"kOutput_Count_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kAccumulator0_Output_Address",
"=",
"0x83E4",
";",
"private",
"static",
"final",
"int",
"kAccumulator1_Output_Address",
"=",
"0x83D4",
";",
"private",
"static",
"final",
"int",
"kOutput_Addresses",
"[",
"]",
"=",
"{",
"kAccumulator0_Output_Address",
",",
"kAccumulator1_Output_Address",
",",
"}",
";",
"public",
"tOutput",
"readOutput",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"regValue2",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"regValue3",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"return",
"new",
"tOutput",
"(",
"regValue",
",",
"regValue2",
",",
"regValue3",
")",
";",
"}",
"public",
"long",
"readOutput_Value",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"regValue2",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"regValue3",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"tOutput",
"val",
"=",
"new",
"tOutput",
"(",
"regValue",
",",
"regValue2",
",",
"regValue3",
")",
";",
"return",
"val",
".",
"Value",
";",
"}",
"public",
"long",
"readOutput_Count",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"regValue2",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"regValue3",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"tOutput",
"val",
"=",
"new",
"tOutput",
"(",
"regValue",
",",
"regValue2",
",",
"regValue3",
")",
";",
"return",
"val",
".",
"Count",
";",
"}",
"private",
"static",
"final",
"int",
"kAccumulator0_Center_Address",
"=",
"0x83EC",
";",
"private",
"static",
"final",
"int",
"kAccumulator1_Center_Address",
"=",
"0x83DC",
";",
"private",
"static",
"final",
"int",
"kCenter_Addresses",
"[",
"]",
"=",
"{",
"kAccumulator0_Center_Address",
",",
"kAccumulator1_Center_Address",
",",
"}",
";",
"public",
"void",
"writeCenter",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kCenter_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"int",
"readCenter",
"(",
")",
"{",
"return",
"(",
"int",
")",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kCenter_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kAccumulator0_Reset_Address",
"=",
"0x83E8",
";",
"private",
"static",
"final",
"int",
"kAccumulator1_Reset_Address",
"=",
"0x83D8",
";",
"private",
"static",
"final",
"int",
"kReset_Addresses",
"[",
"]",
"=",
"{",
"kAccumulator0_Reset_Address",
",",
"kAccumulator1_Reset_Address",
",",
"}",
";",
"public",
"void",
"strobeReset",
"(",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kReset_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"1",
",",
"status",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kAccumulator0_Deadband_Address",
"=",
"0x83E0",
";",
"private",
"static",
"final",
"int",
"kAccumulator1_Deadband_Address",
"=",
"0x83D0",
";",
"private",
"static",
"final",
"int",
"kDeadband_Addresses",
"[",
"]",
"=",
"{",
"kAccumulator0_Deadband_Address",
",",
"kAccumulator1_Deadband_Address",
",",
"}",
";",
"public",
"void",
"writeDeadband",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDeadband_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"int",
"readDeadband",
"(",
")",
"{",
"return",
"(",
"int",
")",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDeadband_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
";",
"}",
"}",
"</s>"
] |
7,411 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"import",
"com",
".",
"ni",
".",
"rio",
".",
"*",
";",
"public",
"class",
"tEncoder",
"extends",
"tSystem",
"{",
"public",
"tEncoder",
"(",
"final",
"int",
"sys_index",
")",
"{",
"super",
"(",
")",
";",
"m_SystemIndex",
"=",
"sys_index",
";",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"m_SystemIndex",
">=",
"kNumSystems",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"}",
"protected",
"void",
"finalize",
"(",
")",
"{",
"super",
".",
"finalize",
"(",
")",
";",
"}",
"public",
"int",
"getSystemIndex",
"(",
")",
"{",
"return",
"m_SystemIndex",
";",
"}",
"public",
"static",
"final",
"int",
"kNumSystems",
"=",
"4",
";",
"public",
"final",
"int",
"m_SystemIndex",
";",
"private",
"static",
"final",
"int",
"kOutput_Direction_BitfieldMask",
"=",
"0x80000000",
";",
"private",
"static",
"final",
"int",
"kOutput_Direction_BitfieldOffset",
"=",
"31",
";",
"private",
"static",
"final",
"int",
"kOutput_Value_BitfieldMask",
"=",
"0x7FFFFFFF",
";",
"private",
"static",
"final",
"int",
"kOutput_Value_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kEncoder0_Output_Address",
"=",
"0x81E0",
";",
"private",
"static",
"final",
"int",
"kEncoder1_Output_Address",
"=",
"0x81CC",
";",
"private",
"static",
"final",
"int",
"kEncoder2_Output_Address",
"=",
"0x81B8",
";",
"private",
"static",
"final",
"int",
"kEncoder3_Output_Address",
"=",
"0x81A4",
";",
"private",
"static",
"final",
"int",
"kOutput_Addresses",
"[",
"]",
"=",
"{",
"kEncoder0_Output_Address",
",",
"kEncoder1_Output_Address",
",",
"kEncoder2_Output_Address",
",",
"kEncoder3_Output_Address",
",",
"}",
";",
"public",
"int",
"readOutput",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"boolean",
"readOutput_Direction",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kOutput_Direction_BitfieldMask",
")",
">>>",
"kOutput_Direction_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"int",
"readOutput_Value",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kOutput_Value_BitfieldMask",
")",
">>>",
"kOutput_Value_BitfieldOffset",
")",
";",
"bitfieldValue",
"<<=",
"1",
";",
"bitfieldValue",
">>=",
"1",
";",
"return",
"(",
"int",
")",
"(",
"bitfieldValue",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kConfig_ASource_Channel_BitfieldMask",
"=",
"0x001E0000",
";",
"private",
"static",
"final",
"int",
"kConfig_ASource_Channel_BitfieldOffset",
"=",
"17",
";",
"private",
"static",
"final",
"int",
"kConfig_ASource_Module_BitfieldMask",
"=",
"0x00010000",
";",
"private",
"static",
"final",
"int",
"kConfig_ASource_Module_BitfieldOffset",
"=",
"16",
";",
"private",
"static",
"final",
"int",
"kConfig_ASource_AnalogTrigger_BitfieldMask",
"=",
"0x00008000",
";",
"private",
"static",
"final",
"int",
"kConfig_ASource_AnalogTrigger_BitfieldOffset",
"=",
"15",
";",
"private",
"static",
"final",
"int",
"kConfig_BSource_Channel_BitfieldMask",
"=",
"0x00007800",
";",
"private",
"static",
"final",
"int",
"kConfig_BSource_Channel_BitfieldOffset",
"=",
"11",
";",
"private",
"static",
"final",
"int",
"kConfig_BSource_Module_BitfieldMask",
"=",
"0x00000400",
";",
"private",
"static",
"final",
"int",
"kConfig_BSource_Module_BitfieldOffset",
"=",
"10",
";",
"private",
"static",
"final",
"int",
"kConfig_BSource_AnalogTrigger_BitfieldMask",
"=",
"0x00000200",
";",
"private",
"static",
"final",
"int",
"kConfig_BSource_AnalogTrigger_BitfieldOffset",
"=",
"9",
";",
"private",
"static",
"final",
"int",
"kConfig_IndexSource_Channel_BitfieldMask",
"=",
"0x000001E0",
";",
"private",
"static",
"final",
"int",
"kConfig_IndexSource_Channel_BitfieldOffset",
"=",
"5",
";",
"private",
"static",
"final",
"int",
"kConfig_IndexSource_Module_BitfieldMask",
"=",
"0x00000010",
";",
"private",
"static",
"final",
"int",
"kConfig_IndexSource_Module_BitfieldOffset",
"=",
"4",
";",
"private",
"static",
"final",
"int",
"kConfig_IndexSource_AnalogTrigger_BitfieldMask",
"=",
"0x00000008",
";",
"private",
"static",
"final",
"int",
"kConfig_IndexSource_AnalogTrigger_BitfieldOffset",
"=",
"3",
";",
"private",
"static",
"final",
"int",
"kConfig_IndexActiveHigh_BitfieldMask",
"=",
"0x00000004",
";",
"private",
"static",
"final",
"int",
"kConfig_IndexActiveHigh_BitfieldOffset",
"=",
"2",
";",
"private",
"static",
"final",
"int",
"kConfig_Reverse_BitfieldMask",
"=",
"0x00000002",
";",
"private",
"static",
"final",
"int",
"kConfig_Reverse_BitfieldOffset",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_BitfieldMask",
"=",
"0x00000001",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kEncoder0_Config_Address",
"=",
"0x81E8",
";",
"private",
"static",
"final",
"int",
"kEncoder1_Config_Address",
"=",
"0x81D4",
";",
"private",
"static",
"final",
"int",
"kEncoder2_Config_Address",
"=",
"0x81C0",
";",
"private",
"static",
"final",
"int",
"kEncoder3_Config_Address",
"=",
"0x81AC",
";",
"private",
"static",
"final",
"int",
"kConfig_Addresses",
"[",
"]",
"=",
"{",
"kEncoder0_Config_Address",
",",
"kEncoder1_Config_Address",
",",
"kEncoder2_Config_Address",
",",
"kEncoder3_Config_Address",
",",
"}",
";",
"public",
"void",
"writeConfig",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_ASource_Channel",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_ASource_Channel_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_ASource_Channel_BitfieldOffset",
")",
"&",
"kConfig_ASource_Channel_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_ASource_Module",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_ASource_Module_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_ASource_Module_BitfieldOffset",
")",
"&",
"kConfig_ASource_Module_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_ASource_AnalogTrigger",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_ASource_AnalogTrigger_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_ASource_AnalogTrigger_BitfieldOffset",
")",
"&",
"kConfig_ASource_AnalogTrigger_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_BSource_Channel",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_BSource_Channel_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_BSource_Channel_BitfieldOffset",
")",
"&",
"kConfig_BSource_Channel_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_BSource_Module",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_BSource_Module_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_BSource_Module_BitfieldOffset",
")",
"&",
"kConfig_BSource_Module_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_BSource_AnalogTrigger",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_BSource_AnalogTrigger_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_BSource_AnalogTrigger_BitfieldOffset",
")",
"&",
"kConfig_BSource_AnalogTrigger_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_IndexSource_Channel",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_IndexSource_Channel_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_IndexSource_Channel_BitfieldOffset",
")",
"&",
"kConfig_IndexSource_Channel_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_IndexSource_Module",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_IndexSource_Module_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_IndexSource_Module_BitfieldOffset",
")",
"&",
"kConfig_IndexSource_Module_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_IndexSource_AnalogTrigger",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_IndexSource_AnalogTrigger_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_IndexSource_AnalogTrigger_BitfieldOffset",
")",
"&",
"kConfig_IndexSource_AnalogTrigger_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_IndexActiveHigh",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_IndexActiveHigh_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_IndexActiveHigh_BitfieldOffset",
")",
"&",
"kConfig_IndexActiveHigh_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_Reverse",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Reverse_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Reverse_BitfieldOffset",
")",
"&",
"kConfig_Reverse_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_Enable",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_BitfieldOffset",
")",
"&",
"kConfig_Enable_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"int",
"readConfig",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"byte",
"readConfig_ASource_Channel",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_ASource_Channel_BitfieldMask",
")",
">>>",
"kConfig_ASource_Channel_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"public",
"byte",
"readConfig_ASource_Module",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_ASource_Module_BitfieldMask",
")",
">>>",
"kConfig_ASource_Module_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000001",
")",
";",
"}",
"public",
"boolean",
"readConfig_ASource_AnalogTrigger",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_ASource_AnalogTrigger_BitfieldMask",
")",
">>>",
"kConfig_ASource_AnalogTrigger_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"byte",
"readConfig_BSource_Channel",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_BSource_Channel_BitfieldMask",
")",
">>>",
"kConfig_BSource_Channel_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"public",
"byte",
"readConfig_BSource_Module",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_BSource_Module_BitfieldMask",
")",
">>>",
"kConfig_BSource_Module_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000001",
")",
";",
"}",
"public",
"boolean",
"readConfig_BSource_AnalogTrigger",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_BSource_AnalogTrigger_BitfieldMask",
")",
">>>",
"kConfig_BSource_AnalogTrigger_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"byte",
"readConfig_IndexSource_Channel",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_IndexSource_Channel_BitfieldMask",
")",
">>>",
"kConfig_IndexSource_Channel_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"public",
"byte",
"readConfig_IndexSource_Module",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_IndexSource_Module_BitfieldMask",
")",
">>>",
"kConfig_IndexSource_Module_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000001",
")",
";",
"}",
"public",
"boolean",
"readConfig_IndexSource_AnalogTrigger",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_IndexSource_AnalogTrigger_BitfieldMask",
")",
">>>",
"kConfig_IndexSource_AnalogTrigger_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"boolean",
"readConfig_IndexActiveHigh",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_IndexActiveHigh_BitfieldMask",
")",
">>>",
"kConfig_IndexActiveHigh_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"boolean",
"readConfig_Reverse",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Reverse_BitfieldMask",
")",
">>>",
"kConfig_Reverse_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"boolean",
"readConfig_Enable",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_BitfieldMask",
")",
">>>",
"kConfig_Enable_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kEncoder0_Reset_Address",
"=",
"0x81E4",
";",
"private",
"static",
"final",
"int",
"kEncoder1_Reset_Address",
"=",
"0x81D0",
";",
"private",
"static",
"final",
"int",
"kEncoder2_Reset_Address",
"=",
"0x81BC",
";",
"private",
"static",
"final",
"int",
"kEncoder3_Reset_Address",
"=",
"0x81A8",
";",
"private",
"static",
"final",
"int",
"kReset_Addresses",
"[",
"]",
"=",
"{",
"kEncoder0_Reset_Address",
",",
"kEncoder1_Reset_Address",
",",
"kEncoder2_Reset_Address",
",",
"kEncoder3_Reset_Address",
",",
"}",
";",
"public",
"void",
"strobeReset",
"(",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kReset_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"1",
",",
"status",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kTimerOutput_Period_BitfieldMask",
"=",
"0xFFFFFE00",
";",
"private",
"static",
"final",
"int",
"kTimerOutput_Period_BitfieldOffset",
"=",
"9",
";",
"private",
"static",
"final",
"int",
"kTimerOutput_Period_FixedPointIntegerShift",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kTimerOutput_Count_BitfieldMask",
"=",
"0x000001FE",
";",
"private",
"static",
"final",
"int",
"kTimerOutput_Count_BitfieldOffset",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kTimerOutput_Stalled_BitfieldMask",
"=",
"0x00000001",
";",
"private",
"static",
"final",
"int",
"kTimerOutput_Stalled_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kEncoder0_TimerOutput_Address",
"=",
"0x81D8",
";",
"private",
"static",
"final",
"int",
"kEncoder1_TimerOutput_Address",
"=",
"0x81C4",
";",
"private",
"static",
"final",
"int",
"kEncoder2_TimerOutput_Address",
"=",
"0x81B0",
";",
"private",
"static",
"final",
"int",
"kEncoder3_TimerOutput_Address",
"=",
"0x819C",
";",
"private",
"static",
"final",
"int",
"kTimerOutput_Addresses",
"[",
"]",
"=",
"{",
"kEncoder0_TimerOutput_Address",
",",
"kEncoder1_TimerOutput_Address",
",",
"kEncoder2_TimerOutput_Address",
",",
"kEncoder3_TimerOutput_Address",
",",
"}",
";",
"public",
"int",
"readTimerOutput",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"int",
"readTimerOutput_Period",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kTimerOutput_Period_BitfieldMask",
")",
">>>",
"kTimerOutput_Period_BitfieldOffset",
")",
"<<",
"kTimerOutput_Period_FixedPointIntegerShift",
";",
"return",
"(",
"int",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00FFFFFF",
")",
";",
"}",
"public",
"byte",
"readTimerOutput_Count",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kTimerOutput_Count_BitfieldMask",
")",
">>>",
"kTimerOutput_Count_BitfieldOffset",
")",
";",
"bitfieldValue",
"<<=",
"24",
";",
"bitfieldValue",
">>=",
"24",
";",
"return",
"(",
"byte",
")",
"(",
"bitfieldValue",
")",
";",
"}",
"public",
"boolean",
"readTimerOutput_Stalled",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kTimerOutput_Stalled_BitfieldMask",
")",
">>>",
"kTimerOutput_Stalled_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kTimerConfig_StallPeriod_BitfieldMask",
"=",
"0xFFFFFF00",
";",
"private",
"static",
"final",
"int",
"kTimerConfig_StallPeriod_BitfieldOffset",
"=",
"8",
";",
"private",
"static",
"final",
"int",
"kTimerConfig_StallPeriod_FixedPointIntegerShift",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kTimerConfig_AverageSize_BitfieldMask",
"=",
"0x000000FE",
";",
"private",
"static",
"final",
"int",
"kTimerConfig_AverageSize_BitfieldOffset",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kTimerConfig_UpdateWhenEmpty_BitfieldMask",
"=",
"0x00000001",
";",
"private",
"static",
"final",
"int",
"kTimerConfig_UpdateWhenEmpty_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kEncoder0_TimerConfig_Address",
"=",
"0x81DC",
";",
"private",
"static",
"final",
"int",
"kEncoder1_TimerConfig_Address",
"=",
"0x81C8",
";",
"private",
"static",
"final",
"int",
"kEncoder2_TimerConfig_Address",
"=",
"0x81B4",
";",
"private",
"static",
"final",
"int",
"kEncoder3_TimerConfig_Address",
"=",
"0x81A0",
";",
"private",
"static",
"final",
"int",
"kTimerConfig_Addresses",
"[",
"]",
"=",
"{",
"kEncoder0_TimerConfig_Address",
",",
"kEncoder1_TimerConfig_Address",
",",
"kEncoder2_TimerConfig_Address",
",",
"kEncoder3_TimerConfig_Address",
",",
"}",
";",
"public",
"void",
"writeTimerConfig",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeTimerConfig_StallPeriod",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kTimerConfig_StallPeriod_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
">>>",
"kTimerConfig_StallPeriod_FixedPointIntegerShift",
")",
"<<",
"kTimerConfig_StallPeriod_BitfieldOffset",
")",
"&",
"kTimerConfig_StallPeriod_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeTimerConfig_AverageSize",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kTimerConfig_AverageSize_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kTimerConfig_AverageSize_BitfieldOffset",
")",
"&",
"kTimerConfig_AverageSize_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeTimerConfig_UpdateWhenEmpty",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kTimerConfig_UpdateWhenEmpty_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kTimerConfig_UpdateWhenEmpty_BitfieldOffset",
")",
"&",
"kTimerConfig_UpdateWhenEmpty_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"int",
"readTimerConfig",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"int",
"readTimerConfig_StallPeriod",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kTimerConfig_StallPeriod_BitfieldMask",
")",
">>>",
"kTimerConfig_StallPeriod_BitfieldOffset",
")",
"<<",
"kTimerConfig_StallPeriod_FixedPointIntegerShift",
";",
"return",
"(",
"int",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x01FFFFFF",
")",
";",
"}",
"public",
"byte",
"readTimerConfig_AverageSize",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kTimerConfig_AverageSize_BitfieldMask",
")",
">>>",
"kTimerConfig_AverageSize_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000007F",
")",
";",
"}",
"public",
"boolean",
"readTimerConfig_UpdateWhenEmpty",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kTimerConfig_UpdateWhenEmpty_BitfieldMask",
")",
">>>",
"kTimerConfig_UpdateWhenEmpty_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"}",
"</s>"
] |
7,412 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"import",
"com",
".",
"ni",
".",
"rio",
".",
"*",
";",
"public",
"class",
"tSPI",
"extends",
"tSystem",
"{",
"public",
"tSPI",
"(",
")",
"{",
"super",
"(",
")",
";",
"}",
"protected",
"void",
"finalize",
"(",
")",
"{",
"super",
".",
"finalize",
"(",
")",
";",
"}",
"public",
"static",
"final",
"int",
"kNumSystems",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kStatus_ReceivedDataOverflow_BitfieldMask",
"=",
"0x00000002",
";",
"private",
"static",
"final",
"int",
"kStatus_ReceivedDataOverflow_BitfieldOffset",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kStatus_Idle_BitfieldMask",
"=",
"0x00000001",
";",
"private",
"static",
"final",
"int",
"kStatus_Idle_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kSPI_Status_Address",
"=",
"0x812C",
";",
"public",
"static",
"int",
"readStatus",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Status_Address",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"static",
"boolean",
"readStatus_ReceivedDataOverflow",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Status_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kStatus_ReceivedDataOverflow_BitfieldMask",
")",
">>>",
"kStatus_ReceivedDataOverflow_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readStatus_Idle",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Status_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kStatus_Idle_BitfieldMask",
")",
">>>",
"kStatus_Idle_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kSPI_ReadReceivedData_Address",
"=",
"0x813C",
";",
"public",
"static",
"void",
"strobeReadReceivedData",
"(",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_ReadReceivedData_Address",
",",
"1",
",",
"status",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kConfig_BusBitWidth_BitfieldMask",
"=",
"0x007F8000",
";",
"private",
"static",
"final",
"int",
"kConfig_BusBitWidth_BitfieldOffset",
"=",
"15",
";",
"private",
"static",
"final",
"int",
"kConfig_ClockHalfPeriodDelay_BitfieldMask",
"=",
"0x00007F80",
";",
"private",
"static",
"final",
"int",
"kConfig_ClockHalfPeriodDelay_BitfieldOffset",
"=",
"7",
";",
"private",
"static",
"final",
"int",
"kConfig_MSBfirst_BitfieldMask",
"=",
"0x00000040",
";",
"private",
"static",
"final",
"int",
"kConfig_MSBfirst_BitfieldOffset",
"=",
"6",
";",
"private",
"static",
"final",
"int",
"kConfig_DataOnFalling_BitfieldMask",
"=",
"0x00000020",
";",
"private",
"static",
"final",
"int",
"kConfig_DataOnFalling_BitfieldOffset",
"=",
"5",
";",
"private",
"static",
"final",
"int",
"kConfig_LatchFirst_BitfieldMask",
"=",
"0x00000010",
";",
"private",
"static",
"final",
"int",
"kConfig_LatchFirst_BitfieldOffset",
"=",
"4",
";",
"private",
"static",
"final",
"int",
"kConfig_LatchLast_BitfieldMask",
"=",
"0x00000008",
";",
"private",
"static",
"final",
"int",
"kConfig_LatchLast_BitfieldOffset",
"=",
"3",
";",
"private",
"static",
"final",
"int",
"kConfig_FramePolarity_BitfieldMask",
"=",
"0x00000004",
";",
"private",
"static",
"final",
"int",
"kConfig_FramePolarity_BitfieldOffset",
"=",
"2",
";",
"private",
"static",
"final",
"int",
"kConfig_WriteOnly_BitfieldMask",
"=",
"0x00000002",
";",
"private",
"static",
"final",
"int",
"kConfig_WriteOnly_BitfieldOffset",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kConfig_ClockPolarity_BitfieldMask",
"=",
"0x00000001",
";",
"private",
"static",
"final",
"int",
"kConfig_ClockPolarity_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kSPI_Config_Address",
"=",
"0x8154",
";",
"public",
"static",
"void",
"writeConfig",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_BusBitWidth",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_BusBitWidth_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_BusBitWidth_BitfieldOffset",
")",
"&",
"kConfig_BusBitWidth_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_ClockHalfPeriodDelay",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_ClockHalfPeriodDelay_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_ClockHalfPeriodDelay_BitfieldOffset",
")",
"&",
"kConfig_ClockHalfPeriodDelay_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_MSBfirst",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_MSBfirst_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_MSBfirst_BitfieldOffset",
")",
"&",
"kConfig_MSBfirst_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_DataOnFalling",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_DataOnFalling_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_DataOnFalling_BitfieldOffset",
")",
"&",
"kConfig_DataOnFalling_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_LatchFirst",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_LatchFirst_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_LatchFirst_BitfieldOffset",
")",
"&",
"kConfig_LatchFirst_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_LatchLast",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_LatchLast_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_LatchLast_BitfieldOffset",
")",
"&",
"kConfig_LatchLast_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_FramePolarity",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_FramePolarity_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_FramePolarity_BitfieldOffset",
")",
"&",
"kConfig_FramePolarity_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_WriteOnly",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_WriteOnly_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_WriteOnly_BitfieldOffset",
")",
"&",
"kConfig_WriteOnly_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_ClockPolarity",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_ClockPolarity_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_ClockPolarity_BitfieldOffset",
")",
"&",
"kConfig_ClockPolarity_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"int",
"readConfig",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"static",
"short",
"readConfig_BusBitWidth",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_BusBitWidth_BitfieldMask",
")",
">>>",
"kConfig_BusBitWidth_BitfieldOffset",
")",
";",
"return",
"(",
"short",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x000000FF",
")",
";",
"}",
"public",
"static",
"short",
"readConfig_ClockHalfPeriodDelay",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_ClockHalfPeriodDelay_BitfieldMask",
")",
">>>",
"kConfig_ClockHalfPeriodDelay_BitfieldOffset",
")",
";",
"return",
"(",
"short",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x000000FF",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_MSBfirst",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_MSBfirst_BitfieldMask",
")",
">>>",
"kConfig_MSBfirst_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_DataOnFalling",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_DataOnFalling_BitfieldMask",
")",
">>>",
"kConfig_DataOnFalling_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_LatchFirst",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_LatchFirst_BitfieldMask",
")",
">>>",
"kConfig_LatchFirst_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_LatchLast",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_LatchLast_BitfieldMask",
")",
">>>",
"kConfig_LatchLast_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_FramePolarity",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_FramePolarity_BitfieldMask",
")",
">>>",
"kConfig_FramePolarity_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_WriteOnly",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_WriteOnly_BitfieldMask",
")",
">>>",
"kConfig_WriteOnly_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_ClockPolarity",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_ClockPolarity_BitfieldMask",
")",
">>>",
"kConfig_ClockPolarity_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kSPI_Reset_Address",
"=",
"0x814C",
";",
"public",
"static",
"void",
"strobeReset",
"(",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Reset_Address",
",",
"1",
",",
"status",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kSPI_DataToLoad_Address",
"=",
"0x8144",
";",
"public",
"static",
"void",
"writeDataToLoad",
"(",
"final",
"long",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_DataToLoad_Address",
",",
"(",
"int",
")",
"(",
"value",
")",
",",
"status",
")",
";",
"}",
"public",
"static",
"long",
"readDataToLoad",
"(",
")",
"{",
"return",
"(",
"long",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_DataToLoad_Address",
",",
"status",
")",
")",
"&",
"0xFFFFFFFFl",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kSPI_ReceivedData_Address",
"=",
"0x8138",
";",
"public",
"static",
"long",
"readReceivedData",
"(",
")",
"{",
"return",
"(",
"long",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_ReceivedData_Address",
",",
"status",
")",
")",
"&",
"0xFFFFFFFFl",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kChannels_SCLK_Channel_BitfieldMask",
"=",
"0x000F0000",
";",
"private",
"static",
"final",
"int",
"kChannels_SCLK_Channel_BitfieldOffset",
"=",
"16",
";",
"private",
"static",
"final",
"int",
"kChannels_SCLK_Module_BitfieldMask",
"=",
"0x00008000",
";",
"private",
"static",
"final",
"int",
"kChannels_SCLK_Module_BitfieldOffset",
"=",
"15",
";",
"private",
"static",
"final",
"int",
"kChannels_MOSI_Channel_BitfieldMask",
"=",
"0x00007800",
";",
"private",
"static",
"final",
"int",
"kChannels_MOSI_Channel_BitfieldOffset",
"=",
"11",
";",
"private",
"static",
"final",
"int",
"kChannels_MOSI_Module_BitfieldMask",
"=",
"0x00000400",
";",
"private",
"static",
"final",
"int",
"kChannels_MOSI_Module_BitfieldOffset",
"=",
"10",
";",
"private",
"static",
"final",
"int",
"kChannels_MISO_Channel_BitfieldMask",
"=",
"0x000003C0",
";",
"private",
"static",
"final",
"int",
"kChannels_MISO_Channel_BitfieldOffset",
"=",
"6",
";",
"private",
"static",
"final",
"int",
"kChannels_MISO_Module_BitfieldMask",
"=",
"0x00000020",
";",
"private",
"static",
"final",
"int",
"kChannels_MISO_Module_BitfieldOffset",
"=",
"5",
";",
"private",
"static",
"final",
"int",
"kChannels_SS_Channel_BitfieldMask",
"=",
"0x0000001E",
";",
"private",
"static",
"final",
"int",
"kChannels_SS_Channel_BitfieldOffset",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kChannels_SS_Module_BitfieldMask",
"=",
"0x00000001",
";",
"private",
"static",
"final",
"int",
"kChannels_SS_Module_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kSPI_Channels_Address",
"=",
"0x8150",
";",
"public",
"static",
"void",
"writeChannels",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeChannels_SCLK_Channel",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kChannels_SCLK_Channel_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kChannels_SCLK_Channel_BitfieldOffset",
")",
"&",
"kChannels_SCLK_Channel_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeChannels_SCLK_Module",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kChannels_SCLK_Module_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kChannels_SCLK_Module_BitfieldOffset",
")",
"&",
"kChannels_SCLK_Module_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeChannels_MOSI_Channel",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kChannels_MOSI_Channel_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kChannels_MOSI_Channel_BitfieldOffset",
")",
"&",
"kChannels_MOSI_Channel_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeChannels_MOSI_Module",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kChannels_MOSI_Module_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kChannels_MOSI_Module_BitfieldOffset",
")",
"&",
"kChannels_MOSI_Module_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeChannels_MISO_Channel",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kChannels_MISO_Channel_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kChannels_MISO_Channel_BitfieldOffset",
")",
"&",
"kChannels_MISO_Channel_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeChannels_MISO_Module",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kChannels_MISO_Module_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kChannels_MISO_Module_BitfieldOffset",
")",
"&",
"kChannels_MISO_Module_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeChannels_SS_Channel",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kChannels_SS_Channel_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kChannels_SS_Channel_BitfieldOffset",
")",
"&",
"kChannels_SS_Channel_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeChannels_SS_Module",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kChannels_SS_Module_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kChannels_SS_Module_BitfieldOffset",
")",
"&",
"kChannels_SS_Module_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"int",
"readChannels",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"static",
"byte",
"readChannels_SCLK_Channel",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kChannels_SCLK_Channel_BitfieldMask",
")",
">>>",
"kChannels_SCLK_Channel_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"public",
"static",
"byte",
"readChannels_SCLK_Module",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kChannels_SCLK_Module_BitfieldMask",
")",
">>>",
"kChannels_SCLK_Module_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000001",
")",
";",
"}",
"public",
"static",
"byte",
"readChannels_MOSI_Channel",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kChannels_MOSI_Channel_BitfieldMask",
")",
">>>",
"kChannels_MOSI_Channel_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"public",
"static",
"byte",
"readChannels_MOSI_Module",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kChannels_MOSI_Module_BitfieldMask",
")",
">>>",
"kChannels_MOSI_Module_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000001",
")",
";",
"}",
"public",
"static",
"byte",
"readChannels_MISO_Channel",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kChannels_MISO_Channel_BitfieldMask",
")",
">>>",
"kChannels_MISO_Channel_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"public",
"static",
"byte",
"readChannels_MISO_Module",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kChannels_MISO_Module_BitfieldMask",
")",
">>>",
"kChannels_MISO_Module_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000001",
")",
";",
"}",
"public",
"static",
"byte",
"readChannels_SS_Channel",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kChannels_SS_Channel_BitfieldMask",
")",
">>>",
"kChannels_SS_Channel_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"public",
"static",
"byte",
"readChannels_SS_Module",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_Channels_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kChannels_SS_Module_BitfieldMask",
")",
">>>",
"kChannels_SS_Module_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000001",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kSPI_Load_Address",
"=",
"0x8148",
";",
"public",
"static",
"void",
"strobeLoad",
"(",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_Load_Address",
",",
"1",
",",
"status",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kSPI_ReceivedElements_Address",
"=",
"0x8134",
";",
"public",
"static",
"short",
"readReceivedElements",
"(",
")",
"{",
"return",
"(",
"short",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_ReceivedElements_Address",
",",
"status",
")",
")",
"&",
"0x000001FF",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kSPI_ClearReceivedData_Address",
"=",
"0x8130",
";",
"public",
"static",
"void",
"strobeClearReceivedData",
"(",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSPI_ClearReceivedData_Address",
",",
"1",
",",
"status",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kSPI_AvailableToLoad_Address",
"=",
"0x8140",
";",
"public",
"static",
"short",
"readAvailableToLoad",
"(",
")",
"{",
"return",
"(",
"short",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSPI_AvailableToLoad_Address",
",",
"status",
")",
")",
"&",
"0x000001FF",
")",
";",
"}",
"}",
"</s>"
] |
7,413 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"import",
"com",
".",
"ni",
".",
"rio",
".",
"*",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"*",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"ptr",
".",
"IntByReference",
";",
"public",
"class",
"tDMAManager",
"extends",
"tSystem",
"{",
"boolean",
"m_started",
";",
"int",
"m_dmaChannel",
";",
"int",
"m_hostBufferSize",
";",
"DMAChannelDescriptors",
".",
"tDMAChannelDescriptor",
"m_dmaChannelDescriptor",
";",
"public",
"tDMAManager",
"(",
"int",
"dmaChannel",
",",
"int",
"hostBufferSize",
")",
"{",
"super",
"(",
")",
";",
"if",
"(",
"status",
".",
"isFatal",
"(",
")",
")",
"return",
";",
"m_started",
"=",
"false",
";",
"m_dmaChannel",
"=",
"dmaChannel",
";",
"m_hostBufferSize",
"=",
"hostBufferSize",
";",
"boolean",
"found",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"kNUM_DMA_CHANNELS",
";",
"i",
"++",
")",
"{",
"if",
"(",
"kDMAChannelDescriptors",
"[",
"i",
"]",
".",
"channel",
"==",
"m_dmaChannel",
")",
"{",
"m_dmaChannelDescriptor",
"=",
"kDMAChannelDescriptors",
"[",
"i",
"]",
";",
"found",
"=",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"found",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"return",
";",
"}",
"NiRioSrv",
".",
"fifoConfig",
"(",
"m_DeviceHandle",
",",
"m_dmaChannel",
",",
"m_hostBufferSize",
",",
"status",
")",
";",
"}",
"protected",
"void",
"finalize",
"(",
")",
"{",
"stop",
"(",
")",
";",
"super",
".",
"finalize",
"(",
")",
";",
"}",
"public",
"void",
"start",
"(",
")",
"{",
"NiRioSrv",
".",
"fifoStart",
"(",
"m_DeviceHandle",
",",
"m_dmaChannel",
",",
"status",
")",
";",
"m_started",
"=",
"true",
";",
"}",
"public",
"void",
"stop",
"(",
")",
"{",
"NiRioSrv",
".",
"fifoStop",
"(",
"m_DeviceHandle",
",",
"m_dmaChannel",
",",
"status",
")",
";",
"m_started",
"=",
"false",
";",
"}",
"public",
"int",
"[",
"]",
"read",
"(",
"int",
"num",
",",
"int",
"timeout",
")",
"{",
"if",
"(",
"m_dmaChannelDescriptor",
".",
"write",
"!=",
"1",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusInvalidFunction",
")",
";",
"return",
"new",
"int",
"[",
"0",
"]",
";",
"}",
"Pointer",
"pBuffer",
"=",
"new",
"Pointer",
"(",
"num",
"*",
"4",
")",
";",
"IntByReference",
"read",
"=",
"new",
"IntByReference",
"(",
"0",
")",
";",
"IntByReference",
"remaining",
"=",
"new",
"IntByReference",
"(",
"0",
")",
";",
"NiRioSrv",
".",
"fifoRead",
"(",
"m_DeviceHandle",
",",
"m_dmaChannel",
",",
"pBuffer",
",",
"num",
",",
"timeout",
",",
"read",
",",
"remaining",
",",
"status",
")",
";",
"int",
"[",
"]",
"data",
"=",
"new",
"int",
"[",
"num",
"]",
";",
"pBuffer",
".",
"getInts",
"(",
"0",
",",
"data",
",",
"0",
",",
"num",
")",
";",
"pBuffer",
".",
"free",
"(",
")",
";",
"m_started",
"=",
"true",
";",
"return",
"data",
";",
"}",
"}",
"</s>"
] |
7,414 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"import",
"com",
".",
"ni",
".",
"rio",
".",
"*",
";",
"public",
"class",
"tDMA",
"extends",
"tSystem",
"{",
"public",
"tDMA",
"(",
")",
"{",
"super",
"(",
")",
";",
"}",
"protected",
"void",
"finalize",
"(",
")",
"{",
"super",
".",
"finalize",
"(",
")",
";",
"}",
"public",
"static",
"final",
"int",
"kNumSystems",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kDMA_Rate_Address",
"=",
"0x815C",
";",
"public",
"static",
"void",
"writeRate",
"(",
"final",
"long",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Rate_Address",
",",
"(",
"int",
")",
"(",
"value",
")",
",",
"status",
")",
";",
"}",
"public",
"static",
"long",
"readRate",
"(",
")",
"{",
"return",
"(",
"long",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Rate_Address",
",",
"status",
")",
")",
"&",
"0xFFFFFFFFl",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kConfig_Pause_BitfieldMask",
"=",
"0x00080000",
";",
"private",
"static",
"final",
"int",
"kConfig_Pause_BitfieldOffset",
"=",
"19",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AI0_Low_BitfieldMask",
"=",
"0x00040000",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AI0_Low_BitfieldOffset",
"=",
"18",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AI0_High_BitfieldMask",
"=",
"0x00020000",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AI0_High_BitfieldOffset",
"=",
"17",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AIAveraged0_Low_BitfieldMask",
"=",
"0x00010000",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AIAveraged0_Low_BitfieldOffset",
"=",
"16",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AIAveraged0_High_BitfieldMask",
"=",
"0x00008000",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AIAveraged0_High_BitfieldOffset",
"=",
"15",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AI1_Low_BitfieldMask",
"=",
"0x00004000",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AI1_Low_BitfieldOffset",
"=",
"14",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AI1_High_BitfieldMask",
"=",
"0x00002000",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AI1_High_BitfieldOffset",
"=",
"13",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AIAveraged1_Low_BitfieldMask",
"=",
"0x00001000",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AIAveraged1_Low_BitfieldOffset",
"=",
"12",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AIAveraged1_High_BitfieldMask",
"=",
"0x00000800",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AIAveraged1_High_BitfieldOffset",
"=",
"11",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_Accumulator0_BitfieldMask",
"=",
"0x00000400",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_Accumulator0_BitfieldOffset",
"=",
"10",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_Accumulator1_BitfieldMask",
"=",
"0x00000200",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_Accumulator1_BitfieldOffset",
"=",
"9",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_DI_BitfieldMask",
"=",
"0x00000100",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_DI_BitfieldOffset",
"=",
"8",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AnalogTriggers_BitfieldMask",
"=",
"0x00000080",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_AnalogTriggers_BitfieldOffset",
"=",
"7",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_Counters_Low_BitfieldMask",
"=",
"0x00000040",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_Counters_Low_BitfieldOffset",
"=",
"6",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_Counters_High_BitfieldMask",
"=",
"0x00000020",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_Counters_High_BitfieldOffset",
"=",
"5",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_CounterTimers_Low_BitfieldMask",
"=",
"0x00000010",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_CounterTimers_Low_BitfieldOffset",
"=",
"4",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_CounterTimers_High_BitfieldMask",
"=",
"0x00000008",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_CounterTimers_High_BitfieldOffset",
"=",
"3",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_Encoders_BitfieldMask",
"=",
"0x00000004",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_Encoders_BitfieldOffset",
"=",
"2",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_EncoderTimers_BitfieldMask",
"=",
"0x00000002",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_EncoderTimers_BitfieldOffset",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kConfig_ExternalClock_BitfieldMask",
"=",
"0x00000001",
";",
"private",
"static",
"final",
"int",
"kConfig_ExternalClock_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kDMA_Config_Address",
"=",
"0x8158",
";",
"public",
"static",
"void",
"writeConfig",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Pause",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Pause_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Pause_BitfieldOffset",
")",
"&",
"kConfig_Pause_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_AI0_Low",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_AI0_Low_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_AI0_Low_BitfieldOffset",
")",
"&",
"kConfig_Enable_AI0_Low_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_AI0_High",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_AI0_High_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_AI0_High_BitfieldOffset",
")",
"&",
"kConfig_Enable_AI0_High_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_AIAveraged0_Low",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_AIAveraged0_Low_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_AIAveraged0_Low_BitfieldOffset",
")",
"&",
"kConfig_Enable_AIAveraged0_Low_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_AIAveraged0_High",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_AIAveraged0_High_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_AIAveraged0_High_BitfieldOffset",
")",
"&",
"kConfig_Enable_AIAveraged0_High_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_AI1_Low",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_AI1_Low_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_AI1_Low_BitfieldOffset",
")",
"&",
"kConfig_Enable_AI1_Low_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_AI1_High",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_AI1_High_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_AI1_High_BitfieldOffset",
")",
"&",
"kConfig_Enable_AI1_High_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_AIAveraged1_Low",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_AIAveraged1_Low_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_AIAveraged1_Low_BitfieldOffset",
")",
"&",
"kConfig_Enable_AIAveraged1_Low_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_AIAveraged1_High",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_AIAveraged1_High_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_AIAveraged1_High_BitfieldOffset",
")",
"&",
"kConfig_Enable_AIAveraged1_High_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_Accumulator0",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_Accumulator0_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_Accumulator0_BitfieldOffset",
")",
"&",
"kConfig_Enable_Accumulator0_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_Accumulator1",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_Accumulator1_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_Accumulator1_BitfieldOffset",
")",
"&",
"kConfig_Enable_Accumulator1_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_DI",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_DI_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_DI_BitfieldOffset",
")",
"&",
"kConfig_Enable_DI_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_AnalogTriggers",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_AnalogTriggers_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_AnalogTriggers_BitfieldOffset",
")",
"&",
"kConfig_Enable_AnalogTriggers_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_Counters_Low",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_Counters_Low_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_Counters_Low_BitfieldOffset",
")",
"&",
"kConfig_Enable_Counters_Low_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_Counters_High",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_Counters_High_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_Counters_High_BitfieldOffset",
")",
"&",
"kConfig_Enable_Counters_High_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_CounterTimers_Low",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_CounterTimers_Low_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_CounterTimers_Low_BitfieldOffset",
")",
"&",
"kConfig_Enable_CounterTimers_Low_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_CounterTimers_High",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_CounterTimers_High_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_CounterTimers_High_BitfieldOffset",
")",
"&",
"kConfig_Enable_CounterTimers_High_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_Encoders",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_Encoders_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_Encoders_BitfieldOffset",
")",
"&",
"kConfig_Enable_Encoders_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_Enable_EncoderTimers",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_EncoderTimers_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_EncoderTimers_BitfieldOffset",
")",
"&",
"kConfig_Enable_EncoderTimers_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeConfig_ExternalClock",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_ExternalClock_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_ExternalClock_BitfieldOffset",
")",
"&",
"kConfig_ExternalClock_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"int",
"readConfig",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Pause",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Pause_BitfieldMask",
")",
">>>",
"kConfig_Pause_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_AI0_Low",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_AI0_Low_BitfieldMask",
")",
">>>",
"kConfig_Enable_AI0_Low_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_AI0_High",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_AI0_High_BitfieldMask",
")",
">>>",
"kConfig_Enable_AI0_High_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_AIAveraged0_Low",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_AIAveraged0_Low_BitfieldMask",
")",
">>>",
"kConfig_Enable_AIAveraged0_Low_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_AIAveraged0_High",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_AIAveraged0_High_BitfieldMask",
")",
">>>",
"kConfig_Enable_AIAveraged0_High_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_AI1_Low",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_AI1_Low_BitfieldMask",
")",
">>>",
"kConfig_Enable_AI1_Low_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_AI1_High",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_AI1_High_BitfieldMask",
")",
">>>",
"kConfig_Enable_AI1_High_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_AIAveraged1_Low",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_AIAveraged1_Low_BitfieldMask",
")",
">>>",
"kConfig_Enable_AIAveraged1_Low_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_AIAveraged1_High",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_AIAveraged1_High_BitfieldMask",
")",
">>>",
"kConfig_Enable_AIAveraged1_High_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_Accumulator0",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_Accumulator0_BitfieldMask",
")",
">>>",
"kConfig_Enable_Accumulator0_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_Accumulator1",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_Accumulator1_BitfieldMask",
")",
">>>",
"kConfig_Enable_Accumulator1_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_DI",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_DI_BitfieldMask",
")",
">>>",
"kConfig_Enable_DI_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_AnalogTriggers",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_AnalogTriggers_BitfieldMask",
")",
">>>",
"kConfig_Enable_AnalogTriggers_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_Counters_Low",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_Counters_Low_BitfieldMask",
")",
">>>",
"kConfig_Enable_Counters_Low_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_Counters_High",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_Counters_High_BitfieldMask",
")",
">>>",
"kConfig_Enable_Counters_High_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_CounterTimers_Low",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_CounterTimers_Low_BitfieldMask",
")",
">>>",
"kConfig_Enable_CounterTimers_Low_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_CounterTimers_High",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_CounterTimers_High_BitfieldMask",
")",
">>>",
"kConfig_Enable_CounterTimers_High_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_Encoders",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_Encoders_BitfieldMask",
")",
">>>",
"kConfig_Enable_Encoders_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_Enable_EncoderTimers",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_EncoderTimers_BitfieldMask",
")",
">>>",
"kConfig_Enable_EncoderTimers_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readConfig_ExternalClock",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_Config_Address",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_ExternalClock_BitfieldMask",
")",
">>>",
"kConfig_ExternalClock_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"final",
"int",
"kExternalTriggers_NumElements",
"=",
"4",
";",
"public",
"static",
"final",
"int",
"kExternalTriggers_ElementSize",
"=",
"8",
";",
"public",
"static",
"final",
"int",
"kExternalTriggers_ElementMask",
"=",
"0xFF",
";",
"private",
"static",
"final",
"int",
"kExternalTriggers_ExternalClockSource_Channel_BitfieldMask",
"=",
"0x000000F0",
";",
"private",
"static",
"final",
"int",
"kExternalTriggers_ExternalClockSource_Channel_BitfieldOffset",
"=",
"4",
";",
"private",
"static",
"final",
"int",
"kExternalTriggers_ExternalClockSource_Module_BitfieldMask",
"=",
"0x00000008",
";",
"private",
"static",
"final",
"int",
"kExternalTriggers_ExternalClockSource_Module_BitfieldOffset",
"=",
"3",
";",
"private",
"static",
"final",
"int",
"kExternalTriggers_ExternalClockSource_AnalogTrigger_BitfieldMask",
"=",
"0x00000004",
";",
"private",
"static",
"final",
"int",
"kExternalTriggers_ExternalClockSource_AnalogTrigger_BitfieldOffset",
"=",
"2",
";",
"private",
"static",
"final",
"int",
"kExternalTriggers_RisingEdge_BitfieldMask",
"=",
"0x00000002",
";",
"private",
"static",
"final",
"int",
"kExternalTriggers_RisingEdge_BitfieldOffset",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kExternalTriggers_FallingEdge_BitfieldMask",
"=",
"0x00000001",
";",
"private",
"static",
"final",
"int",
"kExternalTriggers_FallingEdge_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kDMA_ExternalTriggers_Address",
"=",
"0x8120",
";",
"public",
"static",
"void",
"writeExternalTriggers",
"(",
"final",
"int",
"bitfield_index",
",",
"final",
"int",
"value",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kExternalTriggers_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_ExternalTriggers_Address",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeExternalTriggers_ExternalClockSource_Channel",
"(",
"final",
"int",
"bitfield_index",
",",
"final",
"int",
"value",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kExternalTriggers_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_ExternalTriggers_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kExternalTriggers_ExternalClockSource_Channel_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kExternalTriggers_ExternalClockSource_Channel_BitfieldOffset",
")",
"&",
"kExternalTriggers_ExternalClockSource_Channel_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_ExternalTriggers_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeExternalTriggers_ExternalClockSource_Module",
"(",
"final",
"int",
"bitfield_index",
",",
"final",
"int",
"value",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kExternalTriggers_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_ExternalTriggers_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kExternalTriggers_ExternalClockSource_Module_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kExternalTriggers_ExternalClockSource_Module_BitfieldOffset",
")",
"&",
"kExternalTriggers_ExternalClockSource_Module_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_ExternalTriggers_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeExternalTriggers_ExternalClockSource_AnalogTrigger",
"(",
"final",
"int",
"bitfield_index",
",",
"final",
"boolean",
"value",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kExternalTriggers_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_ExternalTriggers_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kExternalTriggers_ExternalClockSource_AnalogTrigger_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kExternalTriggers_ExternalClockSource_AnalogTrigger_BitfieldOffset",
")",
"&",
"kExternalTriggers_ExternalClockSource_AnalogTrigger_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_ExternalTriggers_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeExternalTriggers_RisingEdge",
"(",
"final",
"int",
"bitfield_index",
",",
"final",
"boolean",
"value",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kExternalTriggers_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_ExternalTriggers_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kExternalTriggers_RisingEdge_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kExternalTriggers_RisingEdge_BitfieldOffset",
")",
"&",
"kExternalTriggers_RisingEdge_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_ExternalTriggers_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"void",
"writeExternalTriggers_FallingEdge",
"(",
"final",
"int",
"bitfield_index",
",",
"final",
"boolean",
"value",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kExternalTriggers_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_ExternalTriggers_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kExternalTriggers_FallingEdge_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kExternalTriggers_FallingEdge_BitfieldOffset",
")",
"&",
"kExternalTriggers_FallingEdge_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kDMA_ExternalTriggers_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"int",
"readExternalTriggers",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kExternalTriggers_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_ExternalTriggers_Address",
",",
"status",
")",
">>>",
"(",
"(",
"kExternalTriggers_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kExternalTriggers_ElementSize",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"static",
"byte",
"readExternalTriggers_ExternalClockSource_Channel",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kExternalTriggers_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_ExternalTriggers_Address",
",",
"status",
")",
">>>",
"(",
"(",
"kExternalTriggers_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kExternalTriggers_ElementSize",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kExternalTriggers_ExternalClockSource_Channel_BitfieldMask",
")",
">>>",
"kExternalTriggers_ExternalClockSource_Channel_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"public",
"static",
"byte",
"readExternalTriggers_ExternalClockSource_Module",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kExternalTriggers_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_ExternalTriggers_Address",
",",
"status",
")",
">>>",
"(",
"(",
"kExternalTriggers_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kExternalTriggers_ElementSize",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kExternalTriggers_ExternalClockSource_Module_BitfieldMask",
")",
">>>",
"kExternalTriggers_ExternalClockSource_Module_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000001",
")",
";",
"}",
"public",
"static",
"boolean",
"readExternalTriggers_ExternalClockSource_AnalogTrigger",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kExternalTriggers_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_ExternalTriggers_Address",
",",
"status",
")",
">>>",
"(",
"(",
"kExternalTriggers_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kExternalTriggers_ElementSize",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kExternalTriggers_ExternalClockSource_AnalogTrigger_BitfieldMask",
")",
">>>",
"kExternalTriggers_ExternalClockSource_AnalogTrigger_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readExternalTriggers_RisingEdge",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kExternalTriggers_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_ExternalTriggers_Address",
",",
"status",
")",
">>>",
"(",
"(",
"kExternalTriggers_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kExternalTriggers_ElementSize",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kExternalTriggers_RisingEdge_BitfieldMask",
")",
">>>",
"kExternalTriggers_RisingEdge_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"static",
"boolean",
"readExternalTriggers_FallingEdge",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kExternalTriggers_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kDMA_ExternalTriggers_Address",
",",
"status",
")",
">>>",
"(",
"(",
"kExternalTriggers_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kExternalTriggers_ElementSize",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kExternalTriggers_FallingEdge_BitfieldMask",
")",
">>>",
"kExternalTriggers_FallingEdge_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"}",
"</s>"
] |
7,415 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"import",
"com",
".",
"ni",
".",
"rio",
".",
"*",
";",
"public",
"class",
"tInterrupt",
"extends",
"tSystem",
"{",
"public",
"tInterrupt",
"(",
"final",
"int",
"sys_index",
")",
"{",
"super",
"(",
")",
";",
"m_SystemIndex",
"=",
"sys_index",
";",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"m_SystemIndex",
">=",
"kNumSystems",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"}",
"protected",
"void",
"finalize",
"(",
")",
"{",
"super",
".",
"finalize",
"(",
")",
";",
"}",
"public",
"int",
"getSystemIndex",
"(",
")",
"{",
"return",
"m_SystemIndex",
";",
"}",
"public",
"static",
"final",
"int",
"kNumSystems",
"=",
"8",
";",
"public",
"final",
"int",
"m_SystemIndex",
";",
"private",
"static",
"final",
"int",
"kInterrupt0_TimeStamp_Address",
"=",
"0x8198",
";",
"private",
"static",
"final",
"int",
"kInterrupt1_TimeStamp_Address",
"=",
"0x8190",
";",
"private",
"static",
"final",
"int",
"kInterrupt2_TimeStamp_Address",
"=",
"0x8188",
";",
"private",
"static",
"final",
"int",
"kInterrupt3_TimeStamp_Address",
"=",
"0x8180",
";",
"private",
"static",
"final",
"int",
"kInterrupt4_TimeStamp_Address",
"=",
"0x8178",
";",
"private",
"static",
"final",
"int",
"kInterrupt5_TimeStamp_Address",
"=",
"0x8170",
";",
"private",
"static",
"final",
"int",
"kInterrupt6_TimeStamp_Address",
"=",
"0x8168",
";",
"private",
"static",
"final",
"int",
"kInterrupt7_TimeStamp_Address",
"=",
"0x8160",
";",
"private",
"static",
"final",
"int",
"kTimeStamp_Addresses",
"[",
"]",
"=",
"{",
"kInterrupt0_TimeStamp_Address",
",",
"kInterrupt1_TimeStamp_Address",
",",
"kInterrupt2_TimeStamp_Address",
",",
"kInterrupt3_TimeStamp_Address",
",",
"kInterrupt4_TimeStamp_Address",
",",
"kInterrupt5_TimeStamp_Address",
",",
"kInterrupt6_TimeStamp_Address",
",",
"kInterrupt7_TimeStamp_Address",
",",
"}",
";",
"public",
"long",
"readTimeStamp",
"(",
")",
"{",
"return",
"(",
"long",
")",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimeStamp_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
")",
"&",
"0xFFFFFFFFl",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kConfig_Source_Channel_BitfieldMask",
"=",
"0x000001E0",
";",
"private",
"static",
"final",
"int",
"kConfig_Source_Channel_BitfieldOffset",
"=",
"5",
";",
"private",
"static",
"final",
"int",
"kConfig_Source_Module_BitfieldMask",
"=",
"0x00000010",
";",
"private",
"static",
"final",
"int",
"kConfig_Source_Module_BitfieldOffset",
"=",
"4",
";",
"private",
"static",
"final",
"int",
"kConfig_Source_AnalogTrigger_BitfieldMask",
"=",
"0x00000008",
";",
"private",
"static",
"final",
"int",
"kConfig_Source_AnalogTrigger_BitfieldOffset",
"=",
"3",
";",
"private",
"static",
"final",
"int",
"kConfig_RisingEdge_BitfieldMask",
"=",
"0x00000004",
";",
"private",
"static",
"final",
"int",
"kConfig_RisingEdge_BitfieldOffset",
"=",
"2",
";",
"private",
"static",
"final",
"int",
"kConfig_FallingEdge_BitfieldMask",
"=",
"0x00000002",
";",
"private",
"static",
"final",
"int",
"kConfig_FallingEdge_BitfieldOffset",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kConfig_WaitForAck_BitfieldMask",
"=",
"0x00000001",
";",
"private",
"static",
"final",
"int",
"kConfig_WaitForAck_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kInterrupt0_Config_Address",
"=",
"0x810C",
";",
"private",
"static",
"final",
"int",
"kInterrupt1_Config_Address",
"=",
"0x8194",
";",
"private",
"static",
"final",
"int",
"kInterrupt2_Config_Address",
"=",
"0x818C",
";",
"private",
"static",
"final",
"int",
"kInterrupt3_Config_Address",
"=",
"0x8184",
";",
"private",
"static",
"final",
"int",
"kInterrupt4_Config_Address",
"=",
"0x817C",
";",
"private",
"static",
"final",
"int",
"kInterrupt5_Config_Address",
"=",
"0x8174",
";",
"private",
"static",
"final",
"int",
"kInterrupt6_Config_Address",
"=",
"0x816C",
";",
"private",
"static",
"final",
"int",
"kInterrupt7_Config_Address",
"=",
"0x8164",
";",
"private",
"static",
"final",
"int",
"kConfig_Addresses",
"[",
"]",
"=",
"{",
"kInterrupt0_Config_Address",
",",
"kInterrupt1_Config_Address",
",",
"kInterrupt2_Config_Address",
",",
"kInterrupt3_Config_Address",
",",
"kInterrupt4_Config_Address",
",",
"kInterrupt5_Config_Address",
",",
"kInterrupt6_Config_Address",
",",
"kInterrupt7_Config_Address",
",",
"}",
";",
"public",
"void",
"writeConfig",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_Source_Channel",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Source_Channel_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_Source_Channel_BitfieldOffset",
")",
"&",
"kConfig_Source_Channel_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_Source_Module",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Source_Module_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_Source_Module_BitfieldOffset",
")",
"&",
"kConfig_Source_Module_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_Source_AnalogTrigger",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Source_AnalogTrigger_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Source_AnalogTrigger_BitfieldOffset",
")",
"&",
"kConfig_Source_AnalogTrigger_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_RisingEdge",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_RisingEdge_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_RisingEdge_BitfieldOffset",
")",
"&",
"kConfig_RisingEdge_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_FallingEdge",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_FallingEdge_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_FallingEdge_BitfieldOffset",
")",
"&",
"kConfig_FallingEdge_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_WaitForAck",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_WaitForAck_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_WaitForAck_BitfieldOffset",
")",
"&",
"kConfig_WaitForAck_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"int",
"readConfig",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"byte",
"readConfig_Source_Channel",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Source_Channel_BitfieldMask",
")",
">>>",
"kConfig_Source_Channel_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"public",
"byte",
"readConfig_Source_Module",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Source_Module_BitfieldMask",
")",
">>>",
"kConfig_Source_Module_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000001",
")",
";",
"}",
"public",
"boolean",
"readConfig_Source_AnalogTrigger",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Source_AnalogTrigger_BitfieldMask",
")",
">>>",
"kConfig_Source_AnalogTrigger_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"boolean",
"readConfig_RisingEdge",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_RisingEdge_BitfieldMask",
")",
">>>",
"kConfig_RisingEdge_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"boolean",
"readConfig_FallingEdge",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_FallingEdge_BitfieldMask",
")",
">>>",
"kConfig_FallingEdge_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"boolean",
"readConfig_WaitForAck",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_WaitForAck_BitfieldMask",
")",
">>>",
"kConfig_WaitForAck_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"}",
"</s>"
] |
7,416 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"import",
"com",
".",
"ni",
".",
"rio",
".",
"*",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"ptr",
".",
"IntByReference",
";",
"public",
"class",
"tInterruptManager",
"extends",
"tSystem",
"{",
"private",
"static",
"final",
"int",
"kFPGA_INTERRUPT_BASE_ADDRESS",
"=",
"0x8000",
";",
"private",
"static",
"final",
"int",
"kFPGA_INTERRUPT_ACKNOWLEDGE_ADDRESS",
"=",
"(",
"kFPGA_INTERRUPT_BASE_ADDRESS",
"+",
"0xC",
")",
";",
"private",
"int",
"m_interruptMask",
";",
"private",
"IntByReference",
"m_rioContext",
";",
"private",
"boolean",
"m_watcher",
";",
"private",
"boolean",
"m_enabled",
";",
"private",
"static",
"int",
"m_globalInterruptMask",
"=",
"0",
";",
"public",
"tInterruptManager",
"(",
"int",
"interruptMask",
",",
"boolean",
"watcher",
")",
"{",
"super",
"(",
")",
";",
"if",
"(",
"status",
".",
"isFatal",
"(",
")",
")",
"return",
";",
"m_interruptMask",
"=",
"interruptMask",
";",
"m_rioContext",
"=",
"new",
"IntByReference",
"(",
"0",
")",
";",
"m_watcher",
"=",
"watcher",
";",
"m_enabled",
"=",
"false",
";",
"NiRioSrv",
".",
"irqReserve",
"(",
"m_DeviceHandle",
",",
"m_rioContext",
",",
"status",
")",
";",
"}",
"protected",
"void",
"finalize",
"(",
")",
"{",
"NiRioStatus",
"tempStatus",
"=",
"new",
"NiRioStatus",
"(",
")",
";",
"NiRioSrv",
".",
"irqUnreserve",
"(",
"m_DeviceHandle",
",",
"m_rioContext",
",",
"tempStatus",
")",
";",
"super",
".",
"finalize",
"(",
")",
";",
"}",
"public",
"int",
"watch",
"(",
"int",
"timeoutInMs",
")",
"{",
"if",
"(",
"!",
"m_watcher",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusIrrelevantAttribute",
")",
";",
"return",
"0",
";",
"}",
"reserve",
"(",
")",
";",
"if",
"(",
"status",
".",
"isFatal",
"(",
")",
")",
"return",
"0",
";",
"acknowledge",
"(",
")",
";",
"int",
"intsAsserted",
"=",
"NiRioSrv",
".",
"irqWait",
"(",
"m_DeviceHandle",
",",
"m_rioContext",
",",
"m_interruptMask",
",",
"timeoutInMs",
",",
"status",
")",
";",
"acknowledge",
"(",
")",
";",
"unreserve",
"(",
")",
";",
"return",
"intsAsserted",
";",
"}",
"protected",
"void",
"acknowledge",
"(",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kFPGA_INTERRUPT_ACKNOWLEDGE_ADDRESS",
",",
"m_interruptMask",
",",
"status",
")",
";",
"}",
"protected",
"void",
"reserve",
"(",
")",
"{",
"if",
"(",
"(",
"m_globalInterruptMask",
"&",
"m_interruptMask",
")",
"!=",
"0",
"||",
"m_enabled",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusEventEnabled",
")",
";",
"}",
"else",
"{",
"m_globalInterruptMask",
"|=",
"m_interruptMask",
";",
"m_enabled",
"=",
"true",
";",
"}",
"}",
"protected",
"void",
"unreserve",
"(",
")",
"{",
"if",
"(",
"!",
"m_enabled",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusEventNotEnabled",
")",
";",
"}",
"else",
"{",
"m_enabled",
"=",
"false",
";",
"m_globalInterruptMask",
"&=",
"~",
"m_interruptMask",
";",
"}",
"}",
"}",
"</s>"
] |
7,417 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"import",
"com",
".",
"ni",
".",
"rio",
".",
"*",
";",
"public",
"class",
"tSolenoid",
"extends",
"tSystem",
"{",
"public",
"tSolenoid",
"(",
")",
"{",
"super",
"(",
")",
";",
"}",
"protected",
"void",
"finalize",
"(",
")",
"{",
"super",
".",
"finalize",
"(",
")",
";",
"}",
"public",
"static",
"final",
"int",
"kNumSystems",
"=",
"1",
";",
"public",
"static",
"final",
"int",
"kDO7_0_NumElements",
"=",
"2",
";",
"public",
"static",
"final",
"int",
"kDO7_0_ElementSize",
"=",
"8",
";",
"public",
"static",
"final",
"int",
"kDO7_0_ElementMask",
"=",
"0xFF",
";",
"private",
"static",
"final",
"int",
"kSolenoid_DO7_0_Address",
"=",
"0x8424",
";",
"public",
"static",
"void",
"writeDO7_0",
"(",
"final",
"int",
"bitfield_index",
",",
"final",
"int",
"value",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kDO7_0_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSolenoid_DO7_0_Address",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"(",
"kDO7_0_ElementMask",
"<<",
"(",
"(",
"kDO7_0_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kDO7_0_ElementSize",
")",
")",
";",
"regValue",
"|=",
"(",
"(",
"value",
"&",
"kDO7_0_ElementMask",
")",
"<<",
"(",
"(",
"kDO7_0_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kDO7_0_ElementSize",
")",
")",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kSolenoid_DO7_0_Address",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"static",
"short",
"readDO7_0",
"(",
"final",
"int",
"bitfield_index",
")",
"{",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"bitfield_index",
">=",
"kDO7_0_NumElements",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"int",
"arrayElementValue",
"=",
"(",
"(",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kSolenoid_DO7_0_Address",
",",
"status",
")",
")",
">>>",
"(",
"(",
"kDO7_0_NumElements",
"-",
"1",
"-",
"bitfield_index",
")",
"*",
"kDO7_0_ElementSize",
")",
")",
"&",
"kDO7_0_ElementMask",
";",
"return",
"(",
"short",
")",
"(",
"(",
"arrayElementValue",
")",
"&",
"0x000000FF",
")",
";",
"}",
"}",
"</s>"
] |
7,418 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
";",
"import",
"com",
".",
"ni",
".",
"rio",
".",
"*",
";",
"public",
"class",
"tCounter",
"extends",
"tSystem",
"{",
"public",
"tCounter",
"(",
"final",
"int",
"sys_index",
")",
"{",
"super",
"(",
")",
";",
"m_SystemIndex",
"=",
"sys_index",
";",
"if",
"(",
"status",
".",
"isNotFatal",
"(",
")",
"&&",
"m_SystemIndex",
">=",
"kNumSystems",
")",
"{",
"status",
".",
"setStatus",
"(",
"NiRioStatus",
".",
"kRIOStatusBadSelector",
")",
";",
"}",
"}",
"protected",
"void",
"finalize",
"(",
")",
"{",
"super",
".",
"finalize",
"(",
")",
";",
"}",
"public",
"int",
"getSystemIndex",
"(",
")",
"{",
"return",
"m_SystemIndex",
";",
"}",
"public",
"static",
"final",
"int",
"kNumSystems",
"=",
"8",
";",
"public",
"final",
"int",
"m_SystemIndex",
";",
"private",
"static",
"final",
"int",
"kOutput_Direction_BitfieldMask",
"=",
"0x80000000",
";",
"private",
"static",
"final",
"int",
"kOutput_Direction_BitfieldOffset",
"=",
"31",
";",
"private",
"static",
"final",
"int",
"kOutput_Value_BitfieldMask",
"=",
"0x7FFFFFFF",
";",
"private",
"static",
"final",
"int",
"kOutput_Value_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kCounter0_Output_Address",
"=",
"0x8280",
";",
"private",
"static",
"final",
"int",
"kCounter1_Output_Address",
"=",
"0x826C",
";",
"private",
"static",
"final",
"int",
"kCounter2_Output_Address",
"=",
"0x8258",
";",
"private",
"static",
"final",
"int",
"kCounter3_Output_Address",
"=",
"0x8244",
";",
"private",
"static",
"final",
"int",
"kCounter4_Output_Address",
"=",
"0x8230",
";",
"private",
"static",
"final",
"int",
"kCounter5_Output_Address",
"=",
"0x821C",
";",
"private",
"static",
"final",
"int",
"kCounter6_Output_Address",
"=",
"0x8208",
";",
"private",
"static",
"final",
"int",
"kCounter7_Output_Address",
"=",
"0x81F4",
";",
"private",
"static",
"final",
"int",
"kOutput_Addresses",
"[",
"]",
"=",
"{",
"kCounter0_Output_Address",
",",
"kCounter1_Output_Address",
",",
"kCounter2_Output_Address",
",",
"kCounter3_Output_Address",
",",
"kCounter4_Output_Address",
",",
"kCounter5_Output_Address",
",",
"kCounter6_Output_Address",
",",
"kCounter7_Output_Address",
",",
"}",
";",
"public",
"int",
"readOutput",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"boolean",
"readOutput_Direction",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kOutput_Direction_BitfieldMask",
")",
">>>",
"kOutput_Direction_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"int",
"readOutput_Value",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kOutput_Value_BitfieldMask",
")",
">>>",
"kOutput_Value_BitfieldOffset",
")",
";",
"bitfieldValue",
"<<=",
"1",
";",
"bitfieldValue",
">>=",
"1",
";",
"return",
"(",
"int",
")",
"(",
"bitfieldValue",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kConfig_UpSource_Channel_BitfieldMask",
"=",
"0xF0000000",
";",
"private",
"static",
"final",
"int",
"kConfig_UpSource_Channel_BitfieldOffset",
"=",
"28",
";",
"private",
"static",
"final",
"int",
"kConfig_UpSource_Module_BitfieldMask",
"=",
"0x08000000",
";",
"private",
"static",
"final",
"int",
"kConfig_UpSource_Module_BitfieldOffset",
"=",
"27",
";",
"private",
"static",
"final",
"int",
"kConfig_UpSource_AnalogTrigger_BitfieldMask",
"=",
"0x04000000",
";",
"private",
"static",
"final",
"int",
"kConfig_UpSource_AnalogTrigger_BitfieldOffset",
"=",
"26",
";",
"private",
"static",
"final",
"int",
"kConfig_DownSource_Channel_BitfieldMask",
"=",
"0x03C00000",
";",
"private",
"static",
"final",
"int",
"kConfig_DownSource_Channel_BitfieldOffset",
"=",
"22",
";",
"private",
"static",
"final",
"int",
"kConfig_DownSource_Module_BitfieldMask",
"=",
"0x00200000",
";",
"private",
"static",
"final",
"int",
"kConfig_DownSource_Module_BitfieldOffset",
"=",
"21",
";",
"private",
"static",
"final",
"int",
"kConfig_DownSource_AnalogTrigger_BitfieldMask",
"=",
"0x00100000",
";",
"private",
"static",
"final",
"int",
"kConfig_DownSource_AnalogTrigger_BitfieldOffset",
"=",
"20",
";",
"private",
"static",
"final",
"int",
"kConfig_IndexSource_Channel_BitfieldMask",
"=",
"0x000F0000",
";",
"private",
"static",
"final",
"int",
"kConfig_IndexSource_Channel_BitfieldOffset",
"=",
"16",
";",
"private",
"static",
"final",
"int",
"kConfig_IndexSource_Module_BitfieldMask",
"=",
"0x00008000",
";",
"private",
"static",
"final",
"int",
"kConfig_IndexSource_Module_BitfieldOffset",
"=",
"15",
";",
"private",
"static",
"final",
"int",
"kConfig_IndexSource_AnalogTrigger_BitfieldMask",
"=",
"0x00004000",
";",
"private",
"static",
"final",
"int",
"kConfig_IndexSource_AnalogTrigger_BitfieldOffset",
"=",
"14",
";",
"private",
"static",
"final",
"int",
"kConfig_IndexActiveHigh_BitfieldMask",
"=",
"0x00002000",
";",
"private",
"static",
"final",
"int",
"kConfig_IndexActiveHigh_BitfieldOffset",
"=",
"13",
";",
"private",
"static",
"final",
"int",
"kConfig_UpRisingEdge_BitfieldMask",
"=",
"0x00001000",
";",
"private",
"static",
"final",
"int",
"kConfig_UpRisingEdge_BitfieldOffset",
"=",
"12",
";",
"private",
"static",
"final",
"int",
"kConfig_UpFallingEdge_BitfieldMask",
"=",
"0x00000800",
";",
"private",
"static",
"final",
"int",
"kConfig_UpFallingEdge_BitfieldOffset",
"=",
"11",
";",
"private",
"static",
"final",
"int",
"kConfig_DownRisingEdge_BitfieldMask",
"=",
"0x00000400",
";",
"private",
"static",
"final",
"int",
"kConfig_DownRisingEdge_BitfieldOffset",
"=",
"10",
";",
"private",
"static",
"final",
"int",
"kConfig_DownFallingEdge_BitfieldMask",
"=",
"0x00000200",
";",
"private",
"static",
"final",
"int",
"kConfig_DownFallingEdge_BitfieldOffset",
"=",
"9",
";",
"private",
"static",
"final",
"int",
"kConfig_Mode_BitfieldMask",
"=",
"0x00000180",
";",
"private",
"static",
"final",
"int",
"kConfig_Mode_BitfieldOffset",
"=",
"7",
";",
"private",
"static",
"final",
"int",
"kConfig_PulseLengthThreshold_BitfieldMask",
"=",
"0x0000007E",
";",
"private",
"static",
"final",
"int",
"kConfig_PulseLengthThreshold_BitfieldOffset",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kConfig_PulseLengthThreshold_FixedPointIntegerShift",
"=",
"8",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_BitfieldMask",
"=",
"0x00000001",
";",
"private",
"static",
"final",
"int",
"kConfig_Enable_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kCounter0_Config_Address",
"=",
"0x8288",
";",
"private",
"static",
"final",
"int",
"kCounter1_Config_Address",
"=",
"0x8274",
";",
"private",
"static",
"final",
"int",
"kCounter2_Config_Address",
"=",
"0x8260",
";",
"private",
"static",
"final",
"int",
"kCounter3_Config_Address",
"=",
"0x824C",
";",
"private",
"static",
"final",
"int",
"kCounter4_Config_Address",
"=",
"0x8238",
";",
"private",
"static",
"final",
"int",
"kCounter5_Config_Address",
"=",
"0x8224",
";",
"private",
"static",
"final",
"int",
"kCounter6_Config_Address",
"=",
"0x8210",
";",
"private",
"static",
"final",
"int",
"kCounter7_Config_Address",
"=",
"0x81FC",
";",
"private",
"static",
"final",
"int",
"kConfig_Addresses",
"[",
"]",
"=",
"{",
"kCounter0_Config_Address",
",",
"kCounter1_Config_Address",
",",
"kCounter2_Config_Address",
",",
"kCounter3_Config_Address",
",",
"kCounter4_Config_Address",
",",
"kCounter5_Config_Address",
",",
"kCounter6_Config_Address",
",",
"kCounter7_Config_Address",
",",
"}",
";",
"public",
"void",
"writeConfig",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_UpSource_Channel",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_UpSource_Channel_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_UpSource_Channel_BitfieldOffset",
")",
"&",
"kConfig_UpSource_Channel_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_UpSource_Module",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_UpSource_Module_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_UpSource_Module_BitfieldOffset",
")",
"&",
"kConfig_UpSource_Module_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_UpSource_AnalogTrigger",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_UpSource_AnalogTrigger_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_UpSource_AnalogTrigger_BitfieldOffset",
")",
"&",
"kConfig_UpSource_AnalogTrigger_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_DownSource_Channel",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_DownSource_Channel_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_DownSource_Channel_BitfieldOffset",
")",
"&",
"kConfig_DownSource_Channel_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_DownSource_Module",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_DownSource_Module_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_DownSource_Module_BitfieldOffset",
")",
"&",
"kConfig_DownSource_Module_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_DownSource_AnalogTrigger",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_DownSource_AnalogTrigger_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_DownSource_AnalogTrigger_BitfieldOffset",
")",
"&",
"kConfig_DownSource_AnalogTrigger_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_IndexSource_Channel",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_IndexSource_Channel_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_IndexSource_Channel_BitfieldOffset",
")",
"&",
"kConfig_IndexSource_Channel_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_IndexSource_Module",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_IndexSource_Module_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_IndexSource_Module_BitfieldOffset",
")",
"&",
"kConfig_IndexSource_Module_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_IndexSource_AnalogTrigger",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_IndexSource_AnalogTrigger_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_IndexSource_AnalogTrigger_BitfieldOffset",
")",
"&",
"kConfig_IndexSource_AnalogTrigger_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_IndexActiveHigh",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_IndexActiveHigh_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_IndexActiveHigh_BitfieldOffset",
")",
"&",
"kConfig_IndexActiveHigh_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_UpRisingEdge",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_UpRisingEdge_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_UpRisingEdge_BitfieldOffset",
")",
"&",
"kConfig_UpRisingEdge_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_UpFallingEdge",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_UpFallingEdge_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_UpFallingEdge_BitfieldOffset",
")",
"&",
"kConfig_UpFallingEdge_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_DownRisingEdge",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_DownRisingEdge_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_DownRisingEdge_BitfieldOffset",
")",
"&",
"kConfig_DownRisingEdge_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_DownFallingEdge",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_DownFallingEdge_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_DownFallingEdge_BitfieldOffset",
")",
"&",
"kConfig_DownFallingEdge_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_Mode",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Mode_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kConfig_Mode_BitfieldOffset",
")",
"&",
"kConfig_Mode_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_PulseLengthThreshold",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_PulseLengthThreshold_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
">>>",
"kConfig_PulseLengthThreshold_FixedPointIntegerShift",
")",
"<<",
"kConfig_PulseLengthThreshold_BitfieldOffset",
")",
"&",
"kConfig_PulseLengthThreshold_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeConfig_Enable",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kConfig_Enable_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kConfig_Enable_BitfieldOffset",
")",
"&",
"kConfig_Enable_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"int",
"readConfig",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"byte",
"readConfig_UpSource_Channel",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_UpSource_Channel_BitfieldMask",
")",
">>>",
"kConfig_UpSource_Channel_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"public",
"byte",
"readConfig_UpSource_Module",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_UpSource_Module_BitfieldMask",
")",
">>>",
"kConfig_UpSource_Module_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000001",
")",
";",
"}",
"public",
"boolean",
"readConfig_UpSource_AnalogTrigger",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_UpSource_AnalogTrigger_BitfieldMask",
")",
">>>",
"kConfig_UpSource_AnalogTrigger_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"byte",
"readConfig_DownSource_Channel",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_DownSource_Channel_BitfieldMask",
")",
">>>",
"kConfig_DownSource_Channel_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"public",
"byte",
"readConfig_DownSource_Module",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_DownSource_Module_BitfieldMask",
")",
">>>",
"kConfig_DownSource_Module_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000001",
")",
";",
"}",
"public",
"boolean",
"readConfig_DownSource_AnalogTrigger",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_DownSource_AnalogTrigger_BitfieldMask",
")",
">>>",
"kConfig_DownSource_AnalogTrigger_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"byte",
"readConfig_IndexSource_Channel",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_IndexSource_Channel_BitfieldMask",
")",
">>>",
"kConfig_IndexSource_Channel_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000000F",
")",
";",
"}",
"public",
"byte",
"readConfig_IndexSource_Module",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_IndexSource_Module_BitfieldMask",
")",
">>>",
"kConfig_IndexSource_Module_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000001",
")",
";",
"}",
"public",
"boolean",
"readConfig_IndexSource_AnalogTrigger",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_IndexSource_AnalogTrigger_BitfieldMask",
")",
">>>",
"kConfig_IndexSource_AnalogTrigger_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"boolean",
"readConfig_IndexActiveHigh",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_IndexActiveHigh_BitfieldMask",
")",
">>>",
"kConfig_IndexActiveHigh_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"boolean",
"readConfig_UpRisingEdge",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_UpRisingEdge_BitfieldMask",
")",
">>>",
"kConfig_UpRisingEdge_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"boolean",
"readConfig_UpFallingEdge",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_UpFallingEdge_BitfieldMask",
")",
">>>",
"kConfig_UpFallingEdge_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"boolean",
"readConfig_DownRisingEdge",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_DownRisingEdge_BitfieldMask",
")",
">>>",
"kConfig_DownRisingEdge_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"boolean",
"readConfig_DownFallingEdge",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_DownFallingEdge_BitfieldMask",
")",
">>>",
"kConfig_DownFallingEdge_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"public",
"byte",
"readConfig_Mode",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Mode_BitfieldMask",
")",
">>>",
"kConfig_Mode_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00000003",
")",
";",
"}",
"public",
"short",
"readConfig_PulseLengthThreshold",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_PulseLengthThreshold_BitfieldMask",
")",
">>>",
"kConfig_PulseLengthThreshold_BitfieldOffset",
")",
"<<",
"kConfig_PulseLengthThreshold_FixedPointIntegerShift",
";",
"return",
"(",
"short",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00003FFF",
")",
";",
"}",
"public",
"boolean",
"readConfig_Enable",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kConfig_Enable_BitfieldMask",
")",
">>>",
"kConfig_Enable_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kCounter0_Reset_Address",
"=",
"0x8284",
";",
"private",
"static",
"final",
"int",
"kCounter1_Reset_Address",
"=",
"0x8270",
";",
"private",
"static",
"final",
"int",
"kCounter2_Reset_Address",
"=",
"0x825C",
";",
"private",
"static",
"final",
"int",
"kCounter3_Reset_Address",
"=",
"0x8248",
";",
"private",
"static",
"final",
"int",
"kCounter4_Reset_Address",
"=",
"0x8234",
";",
"private",
"static",
"final",
"int",
"kCounter5_Reset_Address",
"=",
"0x8220",
";",
"private",
"static",
"final",
"int",
"kCounter6_Reset_Address",
"=",
"0x820C",
";",
"private",
"static",
"final",
"int",
"kCounter7_Reset_Address",
"=",
"0x81F8",
";",
"private",
"static",
"final",
"int",
"kReset_Addresses",
"[",
"]",
"=",
"{",
"kCounter0_Reset_Address",
",",
"kCounter1_Reset_Address",
",",
"kCounter2_Reset_Address",
",",
"kCounter3_Reset_Address",
",",
"kCounter4_Reset_Address",
",",
"kCounter5_Reset_Address",
",",
"kCounter6_Reset_Address",
",",
"kCounter7_Reset_Address",
",",
"}",
";",
"public",
"void",
"strobeReset",
"(",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kReset_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"1",
",",
"status",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kTimerOutput_Period_BitfieldMask",
"=",
"0xFFFFFE00",
";",
"private",
"static",
"final",
"int",
"kTimerOutput_Period_BitfieldOffset",
"=",
"9",
";",
"private",
"static",
"final",
"int",
"kTimerOutput_Period_FixedPointIntegerShift",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kTimerOutput_Count_BitfieldMask",
"=",
"0x000001FE",
";",
"private",
"static",
"final",
"int",
"kTimerOutput_Count_BitfieldOffset",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kTimerOutput_Stalled_BitfieldMask",
"=",
"0x00000001",
";",
"private",
"static",
"final",
"int",
"kTimerOutput_Stalled_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kCounter0_TimerOutput_Address",
"=",
"0x8278",
";",
"private",
"static",
"final",
"int",
"kCounter1_TimerOutput_Address",
"=",
"0x8264",
";",
"private",
"static",
"final",
"int",
"kCounter2_TimerOutput_Address",
"=",
"0x8250",
";",
"private",
"static",
"final",
"int",
"kCounter3_TimerOutput_Address",
"=",
"0x823C",
";",
"private",
"static",
"final",
"int",
"kCounter4_TimerOutput_Address",
"=",
"0x8228",
";",
"private",
"static",
"final",
"int",
"kCounter5_TimerOutput_Address",
"=",
"0x8214",
";",
"private",
"static",
"final",
"int",
"kCounter6_TimerOutput_Address",
"=",
"0x8200",
";",
"private",
"static",
"final",
"int",
"kCounter7_TimerOutput_Address",
"=",
"0x81EC",
";",
"private",
"static",
"final",
"int",
"kTimerOutput_Addresses",
"[",
"]",
"=",
"{",
"kCounter0_TimerOutput_Address",
",",
"kCounter1_TimerOutput_Address",
",",
"kCounter2_TimerOutput_Address",
",",
"kCounter3_TimerOutput_Address",
",",
"kCounter4_TimerOutput_Address",
",",
"kCounter5_TimerOutput_Address",
",",
"kCounter6_TimerOutput_Address",
",",
"kCounter7_TimerOutput_Address",
",",
"}",
";",
"public",
"int",
"readTimerOutput",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"int",
"readTimerOutput_Period",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kTimerOutput_Period_BitfieldMask",
")",
">>>",
"kTimerOutput_Period_BitfieldOffset",
")",
"<<",
"kTimerOutput_Period_FixedPointIntegerShift",
";",
"return",
"(",
"int",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x00FFFFFF",
")",
";",
"}",
"public",
"byte",
"readTimerOutput_Count",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kTimerOutput_Count_BitfieldMask",
")",
">>>",
"kTimerOutput_Count_BitfieldOffset",
")",
";",
"bitfieldValue",
"<<=",
"24",
";",
"bitfieldValue",
">>=",
"24",
";",
"return",
"(",
"byte",
")",
"(",
"bitfieldValue",
")",
";",
"}",
"public",
"boolean",
"readTimerOutput_Stalled",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerOutput_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kTimerOutput_Stalled_BitfieldMask",
")",
">>>",
"kTimerOutput_Stalled_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kTimerConfig_StallPeriod_BitfieldMask",
"=",
"0xFFFFFF00",
";",
"private",
"static",
"final",
"int",
"kTimerConfig_StallPeriod_BitfieldOffset",
"=",
"8",
";",
"private",
"static",
"final",
"int",
"kTimerConfig_StallPeriod_FixedPointIntegerShift",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kTimerConfig_AverageSize_BitfieldMask",
"=",
"0x000000FE",
";",
"private",
"static",
"final",
"int",
"kTimerConfig_AverageSize_BitfieldOffset",
"=",
"1",
";",
"private",
"static",
"final",
"int",
"kTimerConfig_UpdateWhenEmpty_BitfieldMask",
"=",
"0x00000001",
";",
"private",
"static",
"final",
"int",
"kTimerConfig_UpdateWhenEmpty_BitfieldOffset",
"=",
"0",
";",
"private",
"static",
"final",
"int",
"kCounter0_TimerConfig_Address",
"=",
"0x827C",
";",
"private",
"static",
"final",
"int",
"kCounter1_TimerConfig_Address",
"=",
"0x8268",
";",
"private",
"static",
"final",
"int",
"kCounter2_TimerConfig_Address",
"=",
"0x8254",
";",
"private",
"static",
"final",
"int",
"kCounter3_TimerConfig_Address",
"=",
"0x8240",
";",
"private",
"static",
"final",
"int",
"kCounter4_TimerConfig_Address",
"=",
"0x822C",
";",
"private",
"static",
"final",
"int",
"kCounter5_TimerConfig_Address",
"=",
"0x8218",
";",
"private",
"static",
"final",
"int",
"kCounter6_TimerConfig_Address",
"=",
"0x8204",
";",
"private",
"static",
"final",
"int",
"kCounter7_TimerConfig_Address",
"=",
"0x81F0",
";",
"private",
"static",
"final",
"int",
"kTimerConfig_Addresses",
"[",
"]",
"=",
"{",
"kCounter0_TimerConfig_Address",
",",
"kCounter1_TimerConfig_Address",
",",
"kCounter2_TimerConfig_Address",
",",
"kCounter3_TimerConfig_Address",
",",
"kCounter4_TimerConfig_Address",
",",
"kCounter5_TimerConfig_Address",
",",
"kCounter6_TimerConfig_Address",
",",
"kCounter7_TimerConfig_Address",
",",
"}",
";",
"public",
"void",
"writeTimerConfig",
"(",
"final",
"int",
"value",
")",
"{",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"value",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeTimerConfig_StallPeriod",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kTimerConfig_StallPeriod_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
">>>",
"kTimerConfig_StallPeriod_FixedPointIntegerShift",
")",
"<<",
"kTimerConfig_StallPeriod_BitfieldOffset",
")",
"&",
"kTimerConfig_StallPeriod_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeTimerConfig_AverageSize",
"(",
"final",
"int",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kTimerConfig_AverageSize_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"value",
")",
"<<",
"kTimerConfig_AverageSize_BitfieldOffset",
")",
"&",
"kTimerConfig_AverageSize_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"void",
"writeTimerConfig_UpdateWhenEmpty",
"(",
"final",
"boolean",
"value",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"regValue",
"&=",
"~",
"kTimerConfig_UpdateWhenEmpty_BitfieldMask",
";",
"regValue",
"|=",
"(",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
"<<",
"kTimerConfig_UpdateWhenEmpty_BitfieldOffset",
")",
"&",
"kTimerConfig_UpdateWhenEmpty_BitfieldMask",
";",
"NiRioSrv",
".",
"poke32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"regValue",
",",
"status",
")",
";",
"}",
"public",
"int",
"readTimerConfig",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"return",
"(",
"int",
")",
"(",
"regValue",
")",
";",
"}",
"public",
"int",
"readTimerConfig_StallPeriod",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kTimerConfig_StallPeriod_BitfieldMask",
")",
">>>",
"kTimerConfig_StallPeriod_BitfieldOffset",
")",
"<<",
"kTimerConfig_StallPeriod_FixedPointIntegerShift",
";",
"return",
"(",
"int",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x01FFFFFF",
")",
";",
"}",
"public",
"byte",
"readTimerConfig_AverageSize",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kTimerConfig_AverageSize_BitfieldMask",
")",
">>>",
"kTimerConfig_AverageSize_BitfieldOffset",
")",
";",
"return",
"(",
"byte",
")",
"(",
"(",
"bitfieldValue",
")",
"&",
"0x0000007F",
")",
";",
"}",
"public",
"boolean",
"readTimerConfig_UpdateWhenEmpty",
"(",
")",
"{",
"int",
"regValue",
"=",
"NiRioSrv",
".",
"peek32",
"(",
"m_DeviceHandle",
",",
"kTimerConfig_Addresses",
"[",
"m_SystemIndex",
"]",
",",
"status",
")",
";",
"int",
"bitfieldValue",
"=",
"(",
"(",
"regValue",
"&",
"kTimerConfig_UpdateWhenEmpty_BitfieldMask",
")",
">>>",
"kTimerConfig_UpdateWhenEmpty_BitfieldOffset",
")",
";",
"return",
"(",
"(",
"bitfieldValue",
")",
"!=",
"0",
"?",
"true",
":",
"false",
")",
";",
"}",
"}",
"</s>"
] |
7,419 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"com",
".",
"sun",
".",
"squawk",
".",
"Isolate",
";",
"import",
"com",
".",
"sun",
".",
"squawk",
".",
"VM",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
".",
"tGlobal",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"IUtility",
";",
"public",
"class",
"Utility",
"implements",
"IUtility",
"{",
"static",
"{",
"new",
"tGlobal",
"(",
")",
";",
"}",
"private",
"Utility",
"(",
")",
"{",
"}",
"int",
"getFPGAVersion",
"(",
")",
"{",
"return",
"tGlobal",
".",
"readVersion",
"(",
")",
";",
"}",
"long",
"getFPGARevision",
"(",
")",
"{",
"return",
"tGlobal",
".",
"readRevision",
"(",
")",
";",
"}",
"public",
"static",
"long",
"getFPGATime",
"(",
")",
"{",
"return",
"tGlobal",
".",
"readLocalTime",
"(",
")",
";",
"}",
"public",
"static",
"void",
"sendErrorStreamToDriverStation",
"(",
"boolean",
"enabled",
")",
"{",
"final",
"String",
"url",
"=",
"\"\"",
";",
"Isolate",
"isolate",
"=",
"VM",
".",
"getCurrentIsolate",
"(",
")",
";",
"if",
"(",
"enabled",
")",
"{",
"isolate",
".",
"addErr",
"(",
"url",
")",
";",
"}",
"else",
"{",
"isolate",
".",
"removeErr",
"(",
"url",
")",
";",
"}",
"}",
"}",
"</s>"
] |
7,420 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"public",
"class",
"ADXL345_I2C",
"extends",
"SensorBase",
"{",
"private",
"static",
"final",
"byte",
"kAddress",
"=",
"0x3A",
";",
"private",
"static",
"final",
"byte",
"kPowerCtlRegister",
"=",
"0x2D",
";",
"private",
"static",
"final",
"byte",
"kDataFormatRegister",
"=",
"0x31",
";",
"private",
"static",
"final",
"byte",
"kDataRegister",
"=",
"0x32",
";",
"private",
"static",
"final",
"double",
"kGsPerLSB",
"=",
"0.004",
";",
"private",
"static",
"final",
"byte",
"kPowerCtl_Link",
"=",
"0x20",
",",
"kPowerCtl_AutoSleep",
"=",
"0x10",
",",
"kPowerCtl_Measure",
"=",
"0x08",
",",
"kPowerCtl_Sleep",
"=",
"0x04",
";",
"private",
"static",
"final",
"byte",
"kDataFormat_SelfTest",
"=",
"(",
"byte",
")",
"0x80",
",",
"kDataFormat_SPI",
"=",
"0x40",
",",
"kDataFormat_IntInvert",
"=",
"0x20",
",",
"kDataFormat_FullRes",
"=",
"0x08",
",",
"kDataFormat_Justify",
"=",
"0x04",
";",
"public",
"static",
"class",
"DataFormat_Range",
"{",
"public",
"final",
"byte",
"value",
";",
"static",
"final",
"byte",
"k2G_val",
"=",
"0x00",
";",
"static",
"final",
"byte",
"k4G_val",
"=",
"0x01",
";",
"static",
"final",
"byte",
"k8G_val",
"=",
"0x02",
";",
"static",
"final",
"byte",
"k16G_val",
"=",
"0x03",
";",
"public",
"static",
"final",
"DataFormat_Range",
"k2G",
"=",
"new",
"DataFormat_Range",
"(",
"k2G_val",
")",
";",
"public",
"static",
"final",
"DataFormat_Range",
"k4G",
"=",
"new",
"DataFormat_Range",
"(",
"k4G_val",
")",
";",
"public",
"static",
"final",
"DataFormat_Range",
"k8G",
"=",
"new",
"DataFormat_Range",
"(",
"k8G_val",
")",
";",
"public",
"static",
"final",
"DataFormat_Range",
"k16G",
"=",
"new",
"DataFormat_Range",
"(",
"k16G_val",
")",
";",
"private",
"DataFormat_Range",
"(",
"byte",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"static",
"class",
"Axes",
"{",
"public",
"final",
"byte",
"value",
";",
"static",
"final",
"byte",
"kX_val",
"=",
"0x00",
";",
"static",
"final",
"byte",
"kY_val",
"=",
"0x02",
";",
"static",
"final",
"byte",
"kZ_val",
"=",
"0x04",
";",
"public",
"static",
"final",
"Axes",
"kX",
"=",
"new",
"Axes",
"(",
"kX_val",
")",
";",
"public",
"static",
"final",
"Axes",
"kY",
"=",
"new",
"Axes",
"(",
"kY_val",
")",
";",
"public",
"static",
"final",
"Axes",
"kZ",
"=",
"new",
"Axes",
"(",
"kZ_val",
")",
";",
"private",
"Axes",
"(",
"byte",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"static",
"class",
"AllAxes",
"{",
"public",
"double",
"XAxis",
";",
"public",
"double",
"YAxis",
";",
"public",
"double",
"ZAxis",
";",
"}",
"private",
"I2C",
"m_i2c",
";",
"public",
"ADXL345_I2C",
"(",
"int",
"slot",
",",
"DataFormat_Range",
"range",
")",
"{",
"DigitalModule",
"module",
"=",
"DigitalModule",
".",
"getInstance",
"(",
"slot",
")",
";",
"m_i2c",
"=",
"module",
".",
"getI2C",
"(",
"kAddress",
")",
";",
"m_i2c",
".",
"write",
"(",
"kPowerCtlRegister",
",",
"kPowerCtl_Measure",
")",
";",
"m_i2c",
".",
"write",
"(",
"kDataFormatRegister",
",",
"kDataFormat_FullRes",
"|",
"range",
".",
"value",
")",
";",
"}",
"public",
"double",
"getAcceleration",
"(",
"Axes",
"axis",
")",
"{",
"byte",
"[",
"]",
"rawAccel",
"=",
"new",
"byte",
"[",
"2",
"]",
";",
"m_i2c",
".",
"read",
"(",
"kDataRegister",
"+",
"axis",
".",
"value",
",",
"rawAccel",
".",
"length",
",",
"rawAccel",
")",
";",
"return",
"accelFromBytes",
"(",
"rawAccel",
"[",
"0",
"]",
",",
"rawAccel",
"[",
"1",
"]",
")",
";",
"}",
"private",
"double",
"accelFromBytes",
"(",
"byte",
"first",
",",
"byte",
"second",
")",
"{",
"short",
"tempLow",
"=",
"(",
"short",
")",
"(",
"first",
"&",
"0xff",
")",
";",
"short",
"tempHigh",
"=",
"(",
"short",
")",
"(",
"(",
"second",
"<<",
"8",
")",
"&",
"0xff00",
")",
";",
"return",
"(",
"tempLow",
"|",
"tempHigh",
")",
"*",
"kGsPerLSB",
";",
"}",
"public",
"AllAxes",
"getAccelerations",
"(",
")",
"{",
"AllAxes",
"data",
"=",
"new",
"AllAxes",
"(",
")",
";",
"byte",
"[",
"]",
"rawData",
"=",
"new",
"byte",
"[",
"6",
"]",
";",
"m_i2c",
".",
"read",
"(",
"kDataRegister",
",",
"rawData",
".",
"length",
",",
"rawData",
")",
";",
"data",
".",
"XAxis",
"=",
"accelFromBytes",
"(",
"rawData",
"[",
"0",
"]",
",",
"rawData",
"[",
"1",
"]",
")",
";",
"data",
".",
"YAxis",
"=",
"accelFromBytes",
"(",
"rawData",
"[",
"2",
"]",
",",
"rawData",
"[",
"3",
"]",
")",
";",
"data",
".",
"ZAxis",
"=",
"accelFromBytes",
"(",
"rawData",
"[",
"4",
"]",
",",
"rawData",
"[",
"5",
"]",
")",
";",
"return",
"data",
";",
"}",
"}",
"</s>"
] |
7,421 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"public",
"class",
"MotorSafetyHelper",
"{",
"double",
"m_expiration",
";",
"boolean",
"m_enabled",
";",
"double",
"m_stopTime",
";",
"MotorSafety",
"m_safeObject",
";",
"MotorSafetyHelper",
"m_nextHelper",
";",
"static",
"MotorSafetyHelper",
"m_headHelper",
"=",
"null",
";",
"public",
"MotorSafetyHelper",
"(",
"MotorSafety",
"safeObject",
")",
"{",
"m_safeObject",
"=",
"safeObject",
";",
"m_enabled",
"=",
"false",
";",
"m_expiration",
"=",
"MotorSafety",
".",
"DEFAULT_SAFETY_EXPIRATION",
";",
"m_stopTime",
"=",
"Timer",
".",
"getFPGATimestamp",
"(",
")",
";",
"m_nextHelper",
"=",
"m_headHelper",
";",
"m_headHelper",
"=",
"this",
";",
"}",
"public",
"void",
"feed",
"(",
")",
"{",
"m_stopTime",
"=",
"Timer",
".",
"getFPGATimestamp",
"(",
")",
"+",
"m_expiration",
";",
"}",
"public",
"void",
"setExpiration",
"(",
"double",
"expirationTime",
")",
"{",
"m_expiration",
"=",
"expirationTime",
";",
"}",
"public",
"double",
"getExpiration",
"(",
")",
"{",
"return",
"m_expiration",
";",
"}",
"public",
"boolean",
"isAlive",
"(",
")",
"{",
"return",
"!",
"m_enabled",
"||",
"m_stopTime",
">",
"Timer",
".",
"getFPGATimestamp",
"(",
")",
";",
"}",
"public",
"void",
"check",
"(",
")",
"{",
"if",
"(",
"!",
"m_enabled",
")",
"{",
"return",
";",
"}",
"if",
"(",
"m_stopTime",
"<",
"Timer",
".",
"getFPGATimestamp",
"(",
")",
")",
"{",
"m_safeObject",
".",
"stopMotor",
"(",
")",
";",
"}",
"}",
"public",
"void",
"setSafetyEnabled",
"(",
"boolean",
"enabled",
")",
"{",
"m_enabled",
"=",
"enabled",
";",
"}",
"public",
"boolean",
"isSafetyEnabled",
"(",
")",
"{",
"return",
"m_enabled",
";",
"}",
"public",
"static",
"void",
"checkMotors",
"(",
")",
"{",
"for",
"(",
"MotorSafetyHelper",
"msh",
"=",
"m_headHelper",
";",
"msh",
"!=",
"null",
";",
"msh",
"=",
"msh",
".",
"m_nextHelper",
")",
"{",
"msh",
".",
"check",
"(",
")",
";",
"}",
"}",
"}",
"</s>"
] |
7,422 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
".",
"tWatchdog",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"IUtility",
";",
"public",
"class",
"Watchdog",
"extends",
"SensorBase",
"implements",
"IUtility",
"{",
"private",
"static",
"Watchdog",
"m_instance",
";",
"private",
"tWatchdog",
"m_fpgaWatchdog",
";",
"public",
"static",
"final",
"double",
"kDefaultWatchdogExpiration",
"=",
".5",
";",
"protected",
"Watchdog",
"(",
")",
"{",
"m_fpgaWatchdog",
"=",
"new",
"tWatchdog",
"(",
")",
";",
"setExpiration",
"(",
"Watchdog",
".",
"kDefaultWatchdogExpiration",
")",
";",
"setEnabled",
"(",
"true",
")",
";",
"}",
"public",
"static",
"synchronized",
"Watchdog",
"getInstance",
"(",
")",
"{",
"if",
"(",
"m_instance",
"==",
"null",
")",
"{",
"m_instance",
"=",
"new",
"Watchdog",
"(",
")",
";",
"}",
"return",
"m_instance",
";",
"}",
"public",
"void",
"feed",
"(",
")",
"{",
"tWatchdog",
".",
"strobeFeed",
"(",
")",
";",
"}",
"public",
"void",
"kill",
"(",
")",
"{",
"tWatchdog",
".",
"strobeKill",
"(",
")",
";",
"}",
"public",
"double",
"getTimer",
"(",
")",
"{",
"long",
"timer",
"=",
"tWatchdog",
".",
"readTimer",
"(",
")",
";",
"return",
"timer",
"/",
"(",
"kSystemClockTicksPerMicrosecond",
"*",
"1e6",
")",
";",
"}",
"public",
"double",
"getExpiration",
"(",
")",
"{",
"long",
"expiration",
"=",
"tWatchdog",
".",
"readExpiration",
"(",
")",
";",
"return",
"(",
"double",
")",
"expiration",
"/",
"(",
"kSystemClockTicksPerMicrosecond",
"*",
"1e6",
")",
";",
"}",
"public",
"void",
"setExpiration",
"(",
"double",
"expiration",
")",
"{",
"tWatchdog",
".",
"writeExpiration",
"(",
"(",
"int",
")",
"(",
"expiration",
"*",
"(",
"kSystemClockTicksPerMicrosecond",
"*",
"1e6",
")",
")",
")",
";",
"}",
"public",
"boolean",
"getEnabled",
"(",
")",
"{",
"return",
"!",
"tWatchdog",
".",
"readImmortal",
"(",
")",
";",
"}",
"public",
"void",
"setEnabled",
"(",
"final",
"boolean",
"enabled",
")",
"{",
"tWatchdog",
".",
"writeImmortal",
"(",
"!",
"enabled",
")",
";",
"}",
"public",
"boolean",
"isAlive",
"(",
")",
"{",
"return",
"tWatchdog",
".",
"readStatus_Alive",
"(",
")",
";",
"}",
"public",
"boolean",
"isSystemActive",
"(",
")",
"{",
"return",
"tWatchdog",
".",
"readStatus_SystemActive",
"(",
")",
";",
"}",
"}",
"</s>"
] |
7,423 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
".",
"tAI",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"communication",
".",
"AICalibration",
";",
"public",
"class",
"AnalogModule",
"extends",
"Module",
"{",
"public",
"static",
"final",
"int",
"kTimebase",
"=",
"40000000",
";",
"public",
"static",
"final",
"int",
"kDefaultOversampleBits",
"=",
"0",
";",
"public",
"static",
"final",
"int",
"kDefaultAverageBits",
"=",
"7",
";",
"public",
"static",
"final",
"double",
"kDefaultSampleRate",
"=",
"50000.0",
";",
"private",
"tAI",
"m_module",
";",
"private",
"boolean",
"m_sampleRateSet",
";",
"private",
"long",
"m_accumulatorOffset",
";",
"private",
"int",
"m_numChannelsToActivate",
";",
"private",
"final",
"Object",
"syncRoot",
"=",
"new",
"Object",
"(",
")",
";",
"public",
"static",
"synchronized",
"AnalogModule",
"getInstance",
"(",
"final",
"int",
"slot",
")",
"{",
"checkAnalogModule",
"(",
"slot",
")",
";",
"if",
"(",
"Module",
".",
"m_modules",
"[",
"slot",
"]",
"==",
"null",
")",
"{",
"Module",
".",
"m_modules",
"[",
"slot",
"]",
"=",
"new",
"AnalogModule",
"(",
"slot",
")",
";",
"}",
"return",
"(",
"AnalogModule",
")",
"Module",
".",
"m_modules",
"[",
"slot",
"]",
";",
"}",
"public",
"static",
"int",
"slotToIndex",
"(",
"final",
"int",
"slot",
")",
"{",
"return",
"slot",
"-",
"1",
";",
"}",
"protected",
"AnalogModule",
"(",
"final",
"int",
"slot",
")",
"{",
"super",
"(",
"slot",
")",
";",
"m_module",
"=",
"new",
"tAI",
"(",
"slotToIndex",
"(",
"slot",
")",
")",
";",
"setNumChannelsToActivate",
"(",
"SensorBase",
".",
"kAnalogChannels",
")",
";",
"setSampleRate",
"(",
"AnalogModule",
".",
"kDefaultSampleRate",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"SensorBase",
".",
"kAnalogChannels",
";",
"i",
"++",
")",
"{",
"m_module",
".",
"writeScanList",
"(",
"i",
",",
"i",
")",
";",
"setAverageBits",
"(",
"i",
"+",
"1",
",",
"kDefaultAverageBits",
")",
";",
"setOversampleBits",
"(",
"i",
"+",
"1",
",",
"kDefaultOversampleBits",
")",
";",
"}",
"}",
"public",
"void",
"setSampleRate",
"(",
"final",
"double",
"samplesPerSecond",
")",
"{",
"m_sampleRateSet",
"=",
"true",
";",
"final",
"int",
"ticksPerSample",
"=",
"(",
"int",
")",
"(",
"(",
"double",
")",
"AnalogModule",
".",
"kTimebase",
"/",
"samplesPerSecond",
")",
";",
"int",
"ticksPerConversion",
"=",
"ticksPerSample",
"/",
"getNumChannelsToActivate",
"(",
")",
";",
"if",
"(",
"ticksPerConversion",
"<",
"80",
")",
"{",
"ticksPerConversion",
"=",
"80",
";",
"}",
"m_module",
".",
"writeConfig_ScanSize",
"(",
"getNumChannelsToActivate",
"(",
")",
")",
";",
"m_module",
".",
"writeConfig_ConvertRate",
"(",
"ticksPerConversion",
")",
";",
"setNumChannelsToActivate",
"(",
"0",
")",
";",
"}",
"public",
"double",
"getSampleRate",
"(",
")",
"{",
"final",
"long",
"ticksPerConversion",
"=",
"m_module",
".",
"readLoopTiming",
"(",
")",
";",
"final",
"long",
"ticksPerSample",
"=",
"ticksPerConversion",
"*",
"getNumActiveChannels",
"(",
")",
";",
"return",
"(",
"double",
")",
"AnalogModule",
".",
"kTimebase",
"/",
"(",
"double",
")",
"ticksPerSample",
";",
"}",
"private",
"int",
"getNumActiveChannels",
"(",
")",
"{",
"final",
"int",
"scanSize",
"=",
"m_module",
".",
"readConfig_ScanSize",
"(",
")",
";",
"return",
"scanSize",
"==",
"0",
"?",
"8",
":",
"scanSize",
";",
"}",
"private",
"int",
"getNumChannelsToActivate",
"(",
")",
"{",
"if",
"(",
"m_numChannelsToActivate",
"==",
"0",
")",
"{",
"return",
"getNumActiveChannels",
"(",
")",
";",
"}",
"return",
"m_numChannelsToActivate",
";",
"}",
"private",
"void",
"setNumChannelsToActivate",
"(",
"final",
"int",
"channels",
")",
"{",
"m_numChannelsToActivate",
"=",
"channels",
";",
"}",
"public",
"void",
"setAverageBits",
"(",
"final",
"int",
"channel",
",",
"final",
"int",
"bits",
")",
"{",
"m_module",
".",
"writeAverageBits",
"(",
"channel",
"-",
"1",
",",
"bits",
")",
";",
"}",
"public",
"int",
"getAverageBits",
"(",
"final",
"int",
"channel",
")",
"{",
"return",
"m_module",
".",
"readAverageBits",
"(",
"channel",
"-",
"1",
")",
";",
"}",
"public",
"void",
"setOversampleBits",
"(",
"final",
"int",
"channel",
",",
"final",
"int",
"bits",
")",
"{",
"m_module",
".",
"writeOversampleBits",
"(",
"channel",
"-",
"1",
",",
"bits",
")",
";",
"}",
"public",
"int",
"getOversampleBits",
"(",
"final",
"int",
"channel",
")",
"{",
"return",
"m_module",
".",
"readOversampleBits",
"(",
"channel",
"-",
"1",
")",
";",
"}",
"public",
"int",
"getValue",
"(",
"final",
"int",
"channel",
")",
"{",
"int",
"value",
";",
"SensorBase",
".",
"checkAnalogChannel",
"(",
"channel",
")",
";",
"synchronized",
"(",
"syncRoot",
")",
"{",
"tAI",
".",
"writeReadSelect_Channel",
"(",
"channel",
"-",
"1",
")",
";",
"tAI",
".",
"writeReadSelect_Module",
"(",
"slotToIndex",
"(",
"m_slot",
")",
")",
";",
"tAI",
".",
"writeReadSelect_Averaged",
"(",
"false",
")",
";",
"tAI",
".",
"strobeLatchOutput",
"(",
")",
";",
"value",
"=",
"tAI",
".",
"readOutput",
"(",
")",
";",
"}",
"return",
"(",
"short",
")",
"value",
";",
"}",
"public",
"int",
"getAverageValue",
"(",
"final",
"int",
"channel",
")",
"{",
"int",
"value",
";",
"SensorBase",
".",
"checkAnalogChannel",
"(",
"channel",
")",
";",
"synchronized",
"(",
"syncRoot",
")",
"{",
"tAI",
".",
"writeReadSelect_Channel",
"(",
"channel",
"-",
"1",
")",
";",
"tAI",
".",
"writeReadSelect_Module",
"(",
"slotToIndex",
"(",
"m_slot",
")",
")",
";",
"tAI",
".",
"writeReadSelect_Averaged",
"(",
"true",
")",
";",
"tAI",
".",
"strobeLatchOutput",
"(",
")",
";",
"value",
"=",
"tAI",
".",
"readOutput",
"(",
")",
";",
"}",
"return",
"value",
";",
"}",
"public",
"int",
"voltsToValue",
"(",
"final",
"int",
"channel",
",",
"final",
"double",
"voltage",
")",
"{",
"final",
"long",
"LSBWeight",
"=",
"getLSBWeight",
"(",
"channel",
")",
";",
"final",
"int",
"offset",
"=",
"getOffset",
"(",
"channel",
")",
";",
"final",
"int",
"value",
"=",
"(",
"int",
")",
"(",
"(",
"voltage",
"+",
"offset",
"*",
"1.0e-9",
")",
"/",
"(",
"LSBWeight",
"*",
"1.0e-9",
")",
")",
";",
"return",
"value",
";",
"}",
"public",
"double",
"getVoltage",
"(",
"final",
"int",
"channel",
")",
"{",
"final",
"int",
"value",
"=",
"getValue",
"(",
"channel",
")",
";",
"final",
"long",
"LSBWeight",
"=",
"getLSBWeight",
"(",
"channel",
")",
";",
"final",
"int",
"offset",
"=",
"getOffset",
"(",
"channel",
")",
";",
"final",
"double",
"voltage",
"=",
"(",
"LSBWeight",
"*",
"1.0e-9",
"*",
"value",
")",
"-",
"(",
"offset",
"*",
"1.0e-9",
")",
";",
"return",
"voltage",
";",
"}",
"public",
"double",
"getAverageVoltage",
"(",
"final",
"int",
"channel",
")",
"{",
"final",
"int",
"value",
"=",
"getAverageValue",
"(",
"channel",
")",
";",
"final",
"long",
"LSBWeight",
"=",
"getLSBWeight",
"(",
"channel",
")",
";",
"final",
"int",
"offset",
"=",
"getOffset",
"(",
"channel",
")",
";",
"final",
"int",
"oversampleBits",
"=",
"getOversampleBits",
"(",
"channel",
")",
";",
"final",
"double",
"voltage",
"=",
"(",
"(",
"LSBWeight",
"*",
"1.0e-9",
"*",
"value",
")",
"/",
"(",
"double",
")",
"(",
"1",
"<<",
"oversampleBits",
")",
")",
"-",
"(",
"offset",
"*",
"1.0e-9",
")",
";",
"return",
"voltage",
";",
"}",
"public",
"long",
"getLSBWeight",
"(",
"final",
"int",
"channel",
")",
"{",
"return",
"AICalibration",
".",
"getLSBWeight",
"(",
"m_module",
".",
"getSystemIndex",
"(",
")",
",",
"channel",
"-",
"1",
")",
";",
"}",
"public",
"int",
"getOffset",
"(",
"final",
"int",
"channel",
")",
"{",
"return",
"AICalibration",
".",
"getOffset",
"(",
"m_module",
".",
"getSystemIndex",
"(",
")",
",",
"channel",
"-",
"1",
")",
";",
"}",
"}",
"</s>"
] |
7,424 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"com",
".",
"sun",
".",
"squawk",
".",
"*",
";",
"public",
"class",
"IterativeRobot",
"extends",
"RobotBase",
"{",
"private",
"final",
"static",
"boolean",
"TRACE_LOOP_ALLOCATIONS",
"=",
"false",
";",
"private",
"final",
"static",
"boolean",
"TRACE_LOOP_ALLOCATIONS_AFTER_INIT",
"=",
"true",
";",
"private",
"boolean",
"m_disabledInitialized",
";",
"private",
"boolean",
"m_autonomousInitialized",
";",
"private",
"boolean",
"m_teleopInitialized",
";",
"public",
"IterativeRobot",
"(",
")",
"{",
"m_disabledInitialized",
"=",
"false",
";",
"m_autonomousInitialized",
"=",
"false",
";",
"m_teleopInitialized",
"=",
"false",
";",
"}",
"public",
"void",
"startCompetition",
"(",
")",
"{",
"robotInit",
"(",
")",
";",
"final",
"int",
"TRACE_LOOP_MAX",
"=",
"100",
";",
"int",
"loopCount",
"=",
"TRACE_LOOP_MAX",
";",
"Object",
"marker",
"=",
"null",
";",
"boolean",
"didDisabledPeriodic",
"=",
"false",
";",
"boolean",
"didAutonomousPeriodic",
"=",
"false",
";",
"boolean",
"didTeleopPeriodic",
"=",
"false",
";",
"if",
"(",
"TRACE_LOOP_ALLOCATIONS",
")",
"{",
"GC",
".",
"initHeapStats",
"(",
")",
";",
"if",
"(",
"!",
"TRACE_LOOP_ALLOCATIONS_AFTER_INIT",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"marker",
"=",
"new",
"Object",
"(",
")",
";",
"}",
"}",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"TRACE_LOOP_ALLOCATIONS",
"&&",
"didDisabledPeriodic",
"&&",
"didAutonomousPeriodic",
"&&",
"didTeleopPeriodic",
"&&",
"--",
"loopCount",
"<=",
"0",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"break",
";",
"}",
"if",
"(",
"isDisabled",
"(",
")",
")",
"{",
"if",
"(",
"!",
"m_disabledInitialized",
")",
"{",
"disabledInit",
"(",
")",
";",
"m_disabledInitialized",
"=",
"true",
";",
"m_autonomousInitialized",
"=",
"false",
";",
"m_teleopInitialized",
"=",
"false",
";",
"}",
"if",
"(",
"nextPeriodReady",
"(",
")",
")",
"{",
"disabledPeriodic",
"(",
")",
";",
"didDisabledPeriodic",
"=",
"true",
";",
"}",
"disabledContinuous",
"(",
")",
";",
"}",
"else",
"if",
"(",
"isAutonomous",
"(",
")",
")",
"{",
"if",
"(",
"!",
"m_autonomousInitialized",
")",
"{",
"autonomousInit",
"(",
")",
";",
"m_autonomousInitialized",
"=",
"true",
";",
"m_teleopInitialized",
"=",
"false",
";",
"m_disabledInitialized",
"=",
"false",
";",
"}",
"if",
"(",
"nextPeriodReady",
"(",
")",
")",
"{",
"getWatchdog",
"(",
")",
".",
"feed",
"(",
")",
";",
"autonomousPeriodic",
"(",
")",
";",
"didAutonomousPeriodic",
"=",
"true",
";",
"}",
"autonomousContinuous",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"m_teleopInitialized",
")",
"{",
"teleopInit",
"(",
")",
";",
"m_teleopInitialized",
"=",
"true",
";",
"m_autonomousInitialized",
"=",
"false",
";",
"m_disabledInitialized",
"=",
"false",
";",
"}",
"if",
"(",
"nextPeriodReady",
"(",
")",
")",
"{",
"getWatchdog",
"(",
")",
".",
"feed",
"(",
")",
";",
"teleopPeriodic",
"(",
")",
";",
"didTeleopPeriodic",
"=",
"true",
";",
"}",
"teleopContinuous",
"(",
")",
";",
"}",
"if",
"(",
"TRACE_LOOP_ALLOCATIONS",
"&&",
"TRACE_LOOP_ALLOCATIONS_AFTER_INIT",
"&&",
"didDisabledPeriodic",
"&&",
"didAutonomousPeriodic",
"&&",
"didTeleopPeriodic",
"&&",
"loopCount",
"==",
"TRACE_LOOP_MAX",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"marker",
"=",
"new",
"Object",
"(",
")",
";",
"}",
"}",
"if",
"(",
"TRACE_LOOP_ALLOCATIONS",
")",
"{",
"GC",
".",
"printHeapStats",
"(",
"marker",
",",
"false",
")",
";",
"}",
"}",
"private",
"boolean",
"nextPeriodReady",
"(",
")",
"{",
"return",
"m_ds",
".",
"isNewControlData",
"(",
")",
";",
"}",
"public",
"void",
"robotInit",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"disabledInit",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"autonomousInit",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"teleopInit",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"private",
"boolean",
"dpFirstRun",
"=",
"true",
";",
"public",
"void",
"disabledPeriodic",
"(",
")",
"{",
"if",
"(",
"dpFirstRun",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"dpFirstRun",
"=",
"false",
";",
"}",
"Timer",
".",
"delay",
"(",
"0.001",
")",
";",
"}",
"private",
"boolean",
"apFirstRun",
"=",
"true",
";",
"public",
"void",
"autonomousPeriodic",
"(",
")",
"{",
"if",
"(",
"apFirstRun",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"apFirstRun",
"=",
"false",
";",
"}",
"Timer",
".",
"delay",
"(",
"0.001",
")",
";",
"}",
"private",
"boolean",
"tpFirstRun",
"=",
"true",
";",
"public",
"void",
"teleopPeriodic",
"(",
")",
"{",
"if",
"(",
"tpFirstRun",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"tpFirstRun",
"=",
"false",
";",
"}",
"Timer",
".",
"delay",
"(",
"0.001",
")",
";",
"}",
"private",
"boolean",
"dcFirstRun",
"=",
"true",
";",
"public",
"void",
"disabledContinuous",
"(",
")",
"{",
"if",
"(",
"dcFirstRun",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"dcFirstRun",
"=",
"false",
";",
"}",
"Timer",
".",
"delay",
"(",
"0.001",
")",
";",
"}",
"private",
"boolean",
"acFirstRun",
"=",
"true",
";",
"public",
"void",
"autonomousContinuous",
"(",
")",
"{",
"if",
"(",
"acFirstRun",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"acFirstRun",
"=",
"false",
";",
"}",
"Timer",
".",
"delay",
"(",
"0.001",
")",
";",
"}",
"private",
"boolean",
"tcFirstRun",
"=",
"true",
";",
"public",
"void",
"teleopContinuous",
"(",
")",
"{",
"if",
"(",
"tcFirstRun",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"tcFirstRun",
"=",
"false",
";",
"}",
"Timer",
".",
"delay",
"(",
"0.001",
")",
";",
"}",
"}",
"</s>"
] |
7,425 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"public",
"class",
"AccumulatorResult",
"{",
"public",
"long",
"value",
";",
"public",
"long",
"count",
";",
"}",
"</s>"
] |
7,426 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
".",
"tEncoder",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"ISensor",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"AllocationException",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"CheckedAllocationException",
";",
"public",
"class",
"Encoder",
"extends",
"SensorBase",
"implements",
"CounterBase",
",",
"ISensor",
"{",
"static",
"Resource",
"quadEncoders",
"=",
"new",
"Resource",
"(",
"tEncoder",
".",
"kNumSystems",
")",
";",
"protected",
"DigitalSource",
"m_aSource",
";",
"protected",
"DigitalSource",
"m_bSource",
";",
"protected",
"DigitalSource",
"m_indexSource",
"=",
"null",
";",
"private",
"tEncoder",
"m_encoder",
";",
"private",
"int",
"m_index",
";",
"private",
"double",
"m_distancePerPulse",
";",
"private",
"Counter",
"m_counter",
";",
"private",
"EncodingType",
"m_encodingType",
"=",
"EncodingType",
".",
"k4X",
";",
"private",
"boolean",
"m_allocatedA",
";",
"private",
"boolean",
"m_allocatedB",
";",
"private",
"boolean",
"m_allocatedI",
";",
"private",
"void",
"initEncoder",
"(",
"boolean",
"reverseDirection",
")",
"{",
"switch",
"(",
"m_encodingType",
".",
"value",
")",
"{",
"case",
"EncodingType",
".",
"k4X_val",
":",
"try",
"{",
"m_index",
"=",
"quadEncoders",
".",
"allocate",
"(",
")",
";",
"}",
"catch",
"(",
"CheckedAllocationException",
"e",
")",
"{",
"throw",
"new",
"AllocationException",
"(",
"\"\"",
")",
";",
"}",
"m_encoder",
"=",
"new",
"tEncoder",
"(",
"m_index",
")",
";",
"m_encoder",
".",
"writeConfig_ASource_Module",
"(",
"m_aSource",
".",
"getModuleForRouting",
"(",
")",
")",
";",
"m_encoder",
".",
"writeConfig_ASource_Channel",
"(",
"m_aSource",
".",
"getChannelForRouting",
"(",
")",
")",
";",
"m_encoder",
".",
"writeConfig_ASource_AnalogTrigger",
"(",
"m_aSource",
".",
"getAnalogTriggerForRouting",
"(",
")",
")",
";",
"m_encoder",
".",
"writeConfig_BSource_Module",
"(",
"m_bSource",
".",
"getModuleForRouting",
"(",
")",
")",
";",
"m_encoder",
".",
"writeConfig_BSource_Channel",
"(",
"m_bSource",
".",
"getChannelForRouting",
"(",
")",
")",
";",
"m_encoder",
".",
"writeConfig_BSource_AnalogTrigger",
"(",
"m_bSource",
".",
"getAnalogTriggerForRouting",
"(",
")",
")",
";",
"m_encoder",
".",
"strobeReset",
"(",
")",
";",
"m_encoder",
".",
"writeConfig_Reverse",
"(",
"reverseDirection",
")",
";",
"m_encoder",
".",
"writeTimerConfig_AverageSize",
"(",
"1",
")",
";",
"if",
"(",
"m_indexSource",
"!=",
"null",
")",
"{",
"m_encoder",
".",
"writeConfig_IndexSource_Module",
"(",
"m_indexSource",
".",
"getModuleForRouting",
"(",
")",
")",
";",
"m_encoder",
".",
"writeConfig_IndexSource_Channel",
"(",
"m_indexSource",
".",
"getChannelForRouting",
"(",
")",
")",
";",
"m_encoder",
".",
"writeConfig_IndexSource_AnalogTrigger",
"(",
"m_indexSource",
".",
"getAnalogTriggerForRouting",
"(",
")",
")",
";",
"m_encoder",
".",
"writeConfig_IndexActiveHigh",
"(",
"true",
")",
";",
"}",
"m_counter",
"=",
"null",
";",
"break",
";",
"case",
"EncodingType",
".",
"k2X_val",
":",
"case",
"EncodingType",
".",
"k1X_val",
":",
"m_counter",
"=",
"new",
"Counter",
"(",
"m_encodingType",
",",
"m_aSource",
",",
"m_bSource",
",",
"reverseDirection",
")",
";",
"break",
";",
"}",
"m_distancePerPulse",
"=",
"1.0",
";",
"}",
"public",
"Encoder",
"(",
"final",
"int",
"aSlot",
",",
"final",
"int",
"aChannel",
",",
"final",
"int",
"bSlot",
",",
"final",
"int",
"bChannel",
",",
"boolean",
"reverseDirection",
")",
"{",
"m_allocatedA",
"=",
"true",
";",
"m_allocatedB",
"=",
"true",
";",
"m_allocatedI",
"=",
"false",
";",
"m_aSource",
"=",
"new",
"DigitalInput",
"(",
"aSlot",
",",
"aChannel",
")",
";",
"m_bSource",
"=",
"new",
"DigitalInput",
"(",
"bSlot",
",",
"bChannel",
")",
";",
"initEncoder",
"(",
"reverseDirection",
")",
";",
"}",
"public",
"Encoder",
"(",
"final",
"int",
"aSlot",
",",
"final",
"int",
"aChannel",
",",
"final",
"int",
"bSlot",
",",
"final",
"int",
"bChannel",
")",
"{",
"this",
"(",
"aSlot",
",",
"aChannel",
",",
"bSlot",
",",
"bChannel",
",",
"false",
")",
";",
"}",
"public",
"Encoder",
"(",
"final",
"int",
"aSlot",
",",
"final",
"int",
"aChannel",
",",
"final",
"int",
"bSlot",
",",
"final",
"int",
"bChannel",
",",
"boolean",
"reverseDirection",
",",
"final",
"EncodingType",
"encodingType",
")",
"{",
"m_allocatedA",
"=",
"true",
";",
"m_allocatedB",
"=",
"true",
";",
"m_allocatedI",
"=",
"false",
";",
"m_aSource",
"=",
"new",
"DigitalInput",
"(",
"aSlot",
",",
"aChannel",
")",
";",
"m_bSource",
"=",
"new",
"DigitalInput",
"(",
"bSlot",
",",
"bChannel",
")",
";",
"if",
"(",
"encodingType",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"m_encodingType",
"=",
"encodingType",
";",
"initEncoder",
"(",
"reverseDirection",
")",
";",
"}",
"public",
"Encoder",
"(",
"final",
"int",
"aSlot",
",",
"final",
"int",
"aChannel",
",",
"final",
"int",
"bSlot",
",",
"final",
"int",
"bChannel",
",",
"final",
"int",
"indexSlot",
",",
"final",
"int",
"indexChannel",
",",
"boolean",
"reverseDirection",
")",
"{",
"m_allocatedA",
"=",
"true",
";",
"m_allocatedB",
"=",
"true",
";",
"m_allocatedI",
"=",
"true",
";",
"m_aSource",
"=",
"new",
"DigitalInput",
"(",
"aSlot",
",",
"aChannel",
")",
";",
"m_bSource",
"=",
"new",
"DigitalInput",
"(",
"bSlot",
",",
"bChannel",
")",
";",
"m_indexSource",
"=",
"new",
"DigitalInput",
"(",
"indexSlot",
",",
"indexChannel",
")",
";",
"initEncoder",
"(",
"reverseDirection",
")",
";",
"}",
"public",
"Encoder",
"(",
"final",
"int",
"aSlot",
",",
"final",
"int",
"aChannel",
",",
"final",
"int",
"bSlot",
",",
"final",
"int",
"bChannel",
",",
"final",
"int",
"indexSlot",
",",
"final",
"int",
"indexChannel",
")",
"{",
"this",
"(",
"aSlot",
",",
"aChannel",
",",
"bSlot",
",",
"bChannel",
",",
"indexSlot",
",",
"indexChannel",
",",
"false",
")",
";",
"}",
"public",
"Encoder",
"(",
"final",
"int",
"aChannel",
",",
"final",
"int",
"bChannel",
",",
"boolean",
"reverseDirection",
")",
"{",
"m_allocatedA",
"=",
"true",
";",
"m_allocatedB",
"=",
"true",
";",
"m_allocatedI",
"=",
"false",
";",
"m_aSource",
"=",
"new",
"DigitalInput",
"(",
"aChannel",
")",
";",
"m_bSource",
"=",
"new",
"DigitalInput",
"(",
"bChannel",
")",
";",
"initEncoder",
"(",
"reverseDirection",
")",
";",
"}",
"public",
"Encoder",
"(",
"final",
"int",
"aChannel",
",",
"final",
"int",
"bChannel",
")",
"{",
"this",
"(",
"aChannel",
",",
"bChannel",
",",
"false",
")",
";",
"}",
"public",
"Encoder",
"(",
"final",
"int",
"aChannel",
",",
"final",
"int",
"bChannel",
",",
"boolean",
"reverseDirection",
",",
"final",
"EncodingType",
"encodingType",
")",
"{",
"m_allocatedA",
"=",
"true",
";",
"m_allocatedB",
"=",
"true",
";",
"m_allocatedI",
"=",
"false",
";",
"if",
"(",
"encodingType",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"m_encodingType",
"=",
"encodingType",
";",
"m_aSource",
"=",
"new",
"DigitalInput",
"(",
"aChannel",
")",
";",
"m_bSource",
"=",
"new",
"DigitalInput",
"(",
"bChannel",
")",
";",
"initEncoder",
"(",
"reverseDirection",
")",
";",
"}",
"public",
"Encoder",
"(",
"final",
"int",
"aChannel",
",",
"final",
"int",
"bChannel",
",",
"final",
"int",
"indexChannel",
",",
"boolean",
"reverseDirection",
")",
"{",
"m_allocatedA",
"=",
"true",
";",
"m_allocatedB",
"=",
"true",
";",
"m_allocatedI",
"=",
"true",
";",
"m_aSource",
"=",
"new",
"DigitalInput",
"(",
"aChannel",
")",
";",
"m_bSource",
"=",
"new",
"DigitalInput",
"(",
"bChannel",
")",
";",
"m_indexSource",
"=",
"new",
"DigitalInput",
"(",
"indexChannel",
")",
";",
"initEncoder",
"(",
"reverseDirection",
")",
";",
"}",
"public",
"Encoder",
"(",
"final",
"int",
"aChannel",
",",
"final",
"int",
"bChannel",
",",
"final",
"int",
"indexChannel",
")",
"{",
"this",
"(",
"aChannel",
",",
"bChannel",
",",
"indexChannel",
",",
"false",
")",
";",
"}",
"public",
"Encoder",
"(",
"DigitalSource",
"aSource",
",",
"DigitalSource",
"bSource",
",",
"boolean",
"reverseDirection",
")",
"{",
"m_allocatedA",
"=",
"false",
";",
"m_allocatedB",
"=",
"false",
";",
"m_allocatedI",
"=",
"false",
";",
"if",
"(",
"aSource",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"m_aSource",
"=",
"aSource",
";",
"if",
"(",
"bSource",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"m_bSource",
"=",
"bSource",
";",
"initEncoder",
"(",
"reverseDirection",
")",
";",
"}",
"public",
"Encoder",
"(",
"DigitalSource",
"aSource",
",",
"DigitalSource",
"bSource",
")",
"{",
"this",
"(",
"aSource",
",",
"bSource",
",",
"false",
")",
";",
"}",
"public",
"Encoder",
"(",
"DigitalSource",
"aSource",
",",
"DigitalSource",
"bSource",
",",
"boolean",
"reverseDirection",
",",
"final",
"EncodingType",
"encodingType",
")",
"{",
"m_allocatedA",
"=",
"false",
";",
"m_allocatedB",
"=",
"false",
";",
"m_allocatedI",
"=",
"false",
";",
"if",
"(",
"encodingType",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"m_encodingType",
"=",
"encodingType",
";",
"if",
"(",
"aSource",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"m_aSource",
"=",
"aSource",
";",
"if",
"(",
"bSource",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"m_aSource",
"=",
"aSource",
";",
"m_bSource",
"=",
"bSource",
";",
"initEncoder",
"(",
"reverseDirection",
")",
";",
"}",
"public",
"Encoder",
"(",
"DigitalSource",
"aSource",
",",
"DigitalSource",
"bSource",
",",
"DigitalSource",
"indexSource",
",",
"boolean",
"reverseDirection",
")",
"{",
"m_allocatedA",
"=",
"false",
";",
"m_allocatedB",
"=",
"false",
";",
"m_allocatedI",
"=",
"false",
";",
"if",
"(",
"aSource",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"m_aSource",
"=",
"aSource",
";",
"if",
"(",
"bSource",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"m_aSource",
"=",
"aSource",
";",
"m_bSource",
"=",
"bSource",
";",
"m_indexSource",
"=",
"indexSource",
";",
"initEncoder",
"(",
"reverseDirection",
")",
";",
"}",
"public",
"Encoder",
"(",
"DigitalSource",
"aSource",
",",
"DigitalSource",
"bSource",
",",
"DigitalSource",
"indexSource",
")",
"{",
"this",
"(",
"aSource",
",",
"bSource",
",",
"indexSource",
",",
"false",
")",
";",
"}",
"protected",
"void",
"free",
"(",
")",
"{",
"if",
"(",
"m_aSource",
"!=",
"null",
"&&",
"m_allocatedA",
")",
"{",
"m_aSource",
".",
"free",
"(",
")",
";",
"m_allocatedA",
"=",
"false",
";",
"}",
"if",
"(",
"m_bSource",
"!=",
"null",
"&&",
"m_allocatedB",
")",
"{",
"m_bSource",
".",
"free",
"(",
")",
";",
"m_allocatedB",
"=",
"false",
";",
"}",
"if",
"(",
"m_indexSource",
"!=",
"null",
"&&",
"m_allocatedI",
")",
"{",
"m_indexSource",
".",
"free",
"(",
")",
";",
"m_allocatedI",
"=",
"false",
";",
"}",
"m_aSource",
"=",
"null",
";",
"m_bSource",
"=",
"null",
";",
"m_indexSource",
"=",
"null",
";",
"if",
"(",
"m_counter",
"!=",
"null",
")",
"{",
"m_counter",
".",
"free",
"(",
")",
";",
"m_counter",
"=",
"null",
";",
"}",
"else",
"{",
"m_encoder",
".",
"Release",
"(",
")",
";",
"quadEncoders",
".",
"free",
"(",
"m_index",
")",
";",
"m_encoder",
"=",
"null",
";",
"}",
"}",
"public",
"void",
"start",
"(",
")",
"{",
"if",
"(",
"m_counter",
"!=",
"null",
")",
"{",
"m_counter",
".",
"start",
"(",
")",
";",
"}",
"else",
"{",
"m_encoder",
".",
"writeConfig_Enable",
"(",
"true",
")",
";",
"}",
"}",
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"m_counter",
"!=",
"null",
")",
"{",
"m_counter",
".",
"stop",
"(",
")",
";",
"}",
"else",
"{",
"m_encoder",
".",
"writeConfig_Enable",
"(",
"false",
")",
";",
"}",
"}",
"public",
"int",
"getRaw",
"(",
")",
"{",
"int",
"value",
";",
"if",
"(",
"m_counter",
"!=",
"null",
")",
"{",
"value",
"=",
"m_counter",
".",
"get",
"(",
")",
";",
"}",
"else",
"{",
"value",
"=",
"m_encoder",
".",
"readOutput_Value",
"(",
")",
";",
"}",
"return",
"value",
";",
"}",
"public",
"int",
"get",
"(",
")",
"{",
"return",
"(",
"int",
")",
"(",
"getRaw",
"(",
")",
"*",
"decodingScaleFactor",
"(",
")",
")",
";",
"}",
"public",
"void",
"reset",
"(",
")",
"{",
"if",
"(",
"m_counter",
"!=",
"null",
")",
"{",
"m_counter",
".",
"reset",
"(",
")",
";",
"}",
"else",
"{",
"m_encoder",
".",
"strobeReset",
"(",
")",
";",
"}",
"}",
"public",
"double",
"getPeriod",
"(",
")",
"{",
"double",
"measuredPeriod",
";",
"if",
"(",
"m_counter",
"!=",
"null",
")",
"{",
"measuredPeriod",
"=",
"m_counter",
".",
"getPeriod",
"(",
")",
";",
"}",
"else",
"{",
"double",
"value",
";",
"if",
"(",
"m_encoder",
".",
"readTimerOutput_Stalled",
"(",
")",
")",
"{",
"return",
"Double",
".",
"POSITIVE_INFINITY",
";",
"}",
"else",
"{",
"value",
"=",
"(",
"double",
")",
"m_encoder",
".",
"readTimerOutput_Period",
"(",
")",
"/",
"(",
"double",
")",
"m_encoder",
".",
"readTimerOutput_Count",
"(",
")",
";",
"}",
"measuredPeriod",
"=",
"value",
"*",
"1.0e-6",
";",
"}",
"return",
"measuredPeriod",
"/",
"decodingScaleFactor",
"(",
")",
";",
"}",
"public",
"void",
"setMaxPeriod",
"(",
"double",
"maxPeriod",
")",
"{",
"if",
"(",
"m_counter",
"!=",
"null",
")",
"{",
"m_counter",
".",
"setMaxPeriod",
"(",
"maxPeriod",
"*",
"decodingScaleFactor",
"(",
")",
")",
";",
"}",
"else",
"{",
"m_encoder",
".",
"writeTimerConfig_StallPeriod",
"(",
"(",
"int",
")",
"(",
"maxPeriod",
"*",
"1.0e6",
"*",
"decodingScaleFactor",
"(",
")",
")",
")",
";",
"}",
"}",
"public",
"boolean",
"getStopped",
"(",
")",
"{",
"if",
"(",
"m_counter",
"!=",
"null",
")",
"{",
"return",
"m_counter",
".",
"getStopped",
"(",
")",
";",
"}",
"else",
"{",
"boolean",
"value",
"=",
"m_encoder",
".",
"readTimerOutput_Stalled",
"(",
")",
"!=",
"false",
";",
"return",
"value",
";",
"}",
"}",
"public",
"boolean",
"getDirection",
"(",
")",
"{",
"if",
"(",
"m_counter",
"!=",
"null",
")",
"{",
"return",
"m_counter",
".",
"getDirection",
"(",
")",
";",
"}",
"else",
"{",
"boolean",
"value",
"=",
"m_encoder",
".",
"readOutput_Direction",
"(",
")",
";",
"return",
"value",
";",
"}",
"}",
"private",
"double",
"decodingScaleFactor",
"(",
")",
"{",
"switch",
"(",
"m_encodingType",
".",
"value",
")",
"{",
"case",
"EncodingType",
".",
"k1X_val",
":",
"return",
"1.0",
";",
"case",
"EncodingType",
".",
"k2X_val",
":",
"return",
"0.5",
";",
"case",
"EncodingType",
".",
"k4X_val",
":",
"return",
"0.25",
";",
"default",
":",
"return",
"0.0",
";",
"}",
"}",
"public",
"double",
"getDistance",
"(",
")",
"{",
"return",
"getRaw",
"(",
")",
"*",
"decodingScaleFactor",
"(",
")",
"*",
"m_distancePerPulse",
";",
"}",
"public",
"double",
"getRate",
"(",
")",
"{",
"return",
"m_distancePerPulse",
"/",
"getPeriod",
"(",
")",
";",
"}",
"public",
"void",
"setMinRate",
"(",
"double",
"minRate",
")",
"{",
"setMaxPeriod",
"(",
"m_distancePerPulse",
"/",
"minRate",
")",
";",
"}",
"public",
"void",
"setDistancePerPulse",
"(",
"double",
"distancePerPulse",
")",
"{",
"m_distancePerPulse",
"=",
"distancePerPulse",
";",
"}",
"public",
"void",
"setReverseDirection",
"(",
"boolean",
"reverseDirection",
")",
"{",
"if",
"(",
"m_counter",
"!=",
"null",
")",
"{",
"m_counter",
".",
"setReverseDirection",
"(",
"reverseDirection",
")",
";",
"}",
"else",
"{",
"m_encoder",
".",
"writeConfig_Reverse",
"(",
"reverseDirection",
")",
";",
"}",
"}",
"}",
"</s>"
] |
7,427 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"visa",
".",
"Visa",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"visa",
".",
"VisaException",
";",
"public",
"class",
"SerialPort",
"{",
"private",
"int",
"m_resourceManagerHandle",
";",
"private",
"int",
"m_portHandle",
";",
"public",
"static",
"class",
"Parity",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"int",
"kNone_val",
"=",
"0",
";",
"static",
"final",
"int",
"kOdd_val",
"=",
"1",
";",
"static",
"final",
"int",
"kEven_val",
"=",
"2",
";",
"static",
"final",
"int",
"kMark_val",
"=",
"3",
";",
"static",
"final",
"int",
"kSpace_val",
"=",
"4",
";",
"public",
"static",
"final",
"Parity",
"kNone",
"=",
"new",
"Parity",
"(",
"kNone_val",
")",
";",
"public",
"static",
"final",
"Parity",
"kOdd",
"=",
"new",
"Parity",
"(",
"kOdd_val",
")",
";",
"public",
"static",
"final",
"Parity",
"kEven",
"=",
"new",
"Parity",
"(",
"kEven_val",
")",
";",
"public",
"static",
"final",
"Parity",
"kMark",
"=",
"new",
"Parity",
"(",
"kMark_val",
")",
";",
"public",
"static",
"final",
"Parity",
"kSpace",
"=",
"new",
"Parity",
"(",
"(",
"kSpace_val",
")",
")",
";",
"private",
"Parity",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"static",
"class",
"StopBits",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"int",
"kOne_val",
"=",
"10",
";",
"static",
"final",
"int",
"kOnePointFive_val",
"=",
"15",
";",
"static",
"final",
"int",
"kTwo_val",
"=",
"20",
";",
"public",
"static",
"final",
"StopBits",
"kOne",
"=",
"new",
"StopBits",
"(",
"kOne_val",
")",
";",
"public",
"static",
"final",
"StopBits",
"kOnePointFive",
"=",
"new",
"StopBits",
"(",
"kOnePointFive_val",
")",
";",
"public",
"static",
"final",
"StopBits",
"kTwo",
"=",
"new",
"StopBits",
"(",
"kTwo_val",
")",
";",
"private",
"StopBits",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"static",
"class",
"FlowControl",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"int",
"kNone_val",
"=",
"0",
";",
"static",
"final",
"int",
"kXonXoff_val",
"=",
"1",
";",
"static",
"final",
"int",
"kRtsCts_val",
"=",
"2",
";",
"static",
"final",
"int",
"kDtrDsr_val",
"=",
"4",
";",
"public",
"static",
"final",
"FlowControl",
"kNone",
"=",
"new",
"FlowControl",
"(",
"kNone_val",
")",
";",
"public",
"static",
"final",
"FlowControl",
"kXonXoff",
"=",
"new",
"FlowControl",
"(",
"kXonXoff_val",
")",
";",
"public",
"static",
"final",
"FlowControl",
"kRtsCts",
"=",
"new",
"FlowControl",
"(",
"kRtsCts_val",
")",
";",
"public",
"static",
"final",
"FlowControl",
"kDtrDsr",
"=",
"new",
"FlowControl",
"(",
"kDtrDsr_val",
")",
";",
"private",
"FlowControl",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"static",
"class",
"WriteBufferMode",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"int",
"kFlushOnAccess_val",
"=",
"1",
";",
"static",
"final",
"int",
"kFlushWhenFull_val",
"=",
"2",
";",
"public",
"static",
"final",
"WriteBufferMode",
"kFlushOnAccess",
"=",
"new",
"WriteBufferMode",
"(",
"kFlushOnAccess_val",
")",
";",
"public",
"static",
"final",
"WriteBufferMode",
"kFlushWhenFull",
"=",
"new",
"WriteBufferMode",
"(",
"kFlushWhenFull_val",
")",
";",
"private",
"WriteBufferMode",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"SerialPort",
"(",
"final",
"int",
"baudRate",
",",
"final",
"int",
"dataBits",
",",
"Parity",
"parity",
",",
"StopBits",
"stopBits",
")",
"throws",
"VisaException",
"{",
"m_resourceManagerHandle",
"=",
"0",
";",
"m_portHandle",
"=",
"0",
";",
"m_resourceManagerHandle",
"=",
"Visa",
".",
"viOpenDefaultRM",
"(",
")",
";",
"m_portHandle",
"=",
"Visa",
".",
"viOpen",
"(",
"m_resourceManagerHandle",
",",
"\"ASRL1::INSTR\"",
",",
"0",
",",
"0",
")",
";",
"Visa",
".",
"viSetAttribute",
"(",
"m_portHandle",
",",
"Visa",
".",
"VI_ATTR_ASRL_BAUD",
",",
"baudRate",
")",
";",
"Visa",
".",
"viSetAttribute",
"(",
"m_portHandle",
",",
"Visa",
".",
"VI_ATTR_ASRL_DATA_BITS",
",",
"dataBits",
")",
";",
"Visa",
".",
"viSetAttribute",
"(",
"m_portHandle",
",",
"Visa",
".",
"VI_ATTR_ASRL_PARITY",
",",
"parity",
".",
"value",
")",
";",
"Visa",
".",
"viSetAttribute",
"(",
"m_portHandle",
",",
"Visa",
".",
"VI_ATTR_ASRL_STOP_BITS",
",",
"stopBits",
".",
"value",
")",
";",
"setTimeout",
"(",
"5.0f",
")",
";",
"setWriteBufferMode",
"(",
"WriteBufferMode",
".",
"kFlushOnAccess",
")",
";",
"disableTermination",
"(",
")",
";",
"}",
"public",
"SerialPort",
"(",
"final",
"int",
"baudRate",
",",
"final",
"int",
"dataBits",
",",
"Parity",
"parity",
")",
"throws",
"VisaException",
"{",
"this",
"(",
"baudRate",
",",
"dataBits",
",",
"parity",
",",
"StopBits",
".",
"kOne",
")",
";",
"}",
"public",
"SerialPort",
"(",
"final",
"int",
"baudRate",
",",
"final",
"int",
"dataBits",
")",
"throws",
"VisaException",
"{",
"this",
"(",
"baudRate",
",",
"dataBits",
",",
"Parity",
".",
"kNone",
",",
"StopBits",
".",
"kOne",
")",
";",
"}",
"public",
"SerialPort",
"(",
"final",
"int",
"baudRate",
")",
"throws",
"VisaException",
"{",
"this",
"(",
"baudRate",
",",
"8",
",",
"Parity",
".",
"kNone",
",",
"StopBits",
".",
"kOne",
")",
";",
"}",
"protected",
"void",
"free",
"(",
")",
"{",
"Visa",
".",
"viClose",
"(",
"m_portHandle",
")",
";",
"Visa",
".",
"viClose",
"(",
"m_resourceManagerHandle",
")",
";",
"}",
"public",
"void",
"setFlowControl",
"(",
"FlowControl",
"flowControl",
")",
"throws",
"VisaException",
"{",
"Visa",
".",
"viSetAttribute",
"(",
"m_portHandle",
",",
"Visa",
".",
"VI_ATTR_ASRL_FLOW_CNTRL",
",",
"flowControl",
".",
"value",
")",
";",
"}",
"public",
"void",
"enableTermination",
"(",
"char",
"terminator",
")",
"throws",
"VisaException",
"{",
"Visa",
".",
"viSetAttribute",
"(",
"m_portHandle",
",",
"Visa",
".",
"VI_ATTR_TERMCHAR_EN",
",",
"true",
")",
";",
"Visa",
".",
"viSetAttribute",
"(",
"m_portHandle",
",",
"Visa",
".",
"VI_ATTR_TERMCHAR",
",",
"terminator",
")",
";",
"Visa",
".",
"viSetAttribute",
"(",
"m_portHandle",
",",
"Visa",
".",
"VI_ATTR_ASRL_END_IN",
",",
"Visa",
".",
"VI_ASRL_END_TERMCHAR",
")",
";",
"}",
"public",
"void",
"enableTermination",
"(",
")",
"throws",
"VisaException",
"{",
"this",
".",
"enableTermination",
"(",
"'\\n'",
")",
";",
"}",
"public",
"void",
"disableTermination",
"(",
")",
"throws",
"VisaException",
"{",
"Visa",
".",
"viSetAttribute",
"(",
"m_portHandle",
",",
"Visa",
".",
"VI_ATTR_TERMCHAR_EN",
",",
"false",
")",
";",
"Visa",
".",
"viSetAttribute",
"(",
"m_portHandle",
",",
"Visa",
".",
"VI_ATTR_ASRL_END_IN",
",",
"Visa",
".",
"VI_ASRL_END_NONE",
")",
";",
"}",
"public",
"int",
"getBytesReceived",
"(",
")",
"throws",
"VisaException",
"{",
"return",
"Visa",
".",
"viGetAttribute",
"(",
"m_portHandle",
",",
"Visa",
".",
"VI_ATTR_ASRL_AVAIL_NUM",
")",
";",
"}",
"public",
"void",
"print",
"(",
"String",
"write",
")",
"throws",
"VisaException",
"{",
"Visa",
".",
"viVPrintf",
"(",
"m_portHandle",
",",
"write",
")",
";",
"}",
"public",
"String",
"readString",
"(",
")",
"throws",
"VisaException",
"{",
"return",
"readString",
"(",
"getBytesReceived",
"(",
")",
")",
";",
"}",
"public",
"String",
"readString",
"(",
"int",
"count",
")",
"throws",
"VisaException",
"{",
"byte",
"[",
"]",
"out",
"=",
"Visa",
".",
"viBufRead",
"(",
"m_portHandle",
",",
"count",
")",
";",
"StringBuffer",
"s",
"=",
"new",
"StringBuffer",
"(",
"count",
"+",
"1",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"s",
".",
"append",
"(",
"out",
"[",
"i",
"]",
")",
";",
"}",
"return",
"s",
".",
"toString",
"(",
")",
";",
"}",
"public",
"byte",
"[",
"]",
"read",
"(",
"final",
"int",
"count",
")",
"throws",
"VisaException",
"{",
"return",
"Visa",
".",
"viBufRead",
"(",
"m_portHandle",
",",
"count",
")",
";",
"}",
"public",
"int",
"write",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"count",
")",
"throws",
"VisaException",
"{",
"return",
"Visa",
".",
"viBufWrite",
"(",
"m_portHandle",
",",
"buffer",
",",
"count",
")",
";",
"}",
"public",
"void",
"setTimeout",
"(",
"double",
"timeout",
")",
"throws",
"VisaException",
"{",
"Visa",
".",
"viSetAttribute",
"(",
"m_portHandle",
",",
"Visa",
".",
"VI_ATTR_TMO_VALUE",
",",
"(",
"int",
")",
"(",
"timeout",
"*",
"1e3",
")",
")",
";",
"}",
"public",
"void",
"setWriteBufferMode",
"(",
"WriteBufferMode",
"mode",
")",
"throws",
"VisaException",
"{",
"Visa",
".",
"viSetAttribute",
"(",
"m_portHandle",
",",
"Visa",
".",
"VI_ATTR_WR_BUF_OPER_MODE",
",",
"mode",
".",
"value",
")",
";",
"}",
"public",
"void",
"flush",
"(",
")",
"throws",
"VisaException",
"{",
"Visa",
".",
"viFlush",
"(",
"m_portHandle",
",",
"Visa",
".",
"VI_WRITE_BUF",
")",
";",
"}",
"public",
"void",
"reset",
"(",
")",
"throws",
"VisaException",
"{",
"Visa",
".",
"viClear",
"(",
"m_portHandle",
")",
";",
"}",
"}",
"</s>"
] |
7,428 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"public",
"abstract",
"class",
"DigitalSource",
"extends",
"InterruptableSensorBase",
"{",
"public",
"abstract",
"int",
"getChannelForRouting",
"(",
")",
";",
"public",
"abstract",
"int",
"getModuleForRouting",
"(",
")",
";",
"public",
"abstract",
"boolean",
"getAnalogTriggerForRouting",
"(",
")",
";",
"}",
"</s>"
] |
7,429 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"IDevice",
";",
"public",
"class",
"Compressor",
"extends",
"SensorBase",
"implements",
"IDevice",
"{",
"private",
"DigitalInput",
"m_pressureSwitch",
";",
"private",
"Relay",
"m_relay",
";",
"private",
"boolean",
"m_enabled",
";",
"private",
"Thread",
"m_task",
";",
"private",
"boolean",
"m_run",
"=",
"true",
";",
"private",
"class",
"CompressorThread",
"extends",
"Thread",
"{",
"Compressor",
"m_compressor",
";",
"CompressorThread",
"(",
"Compressor",
"comp",
")",
"{",
"m_compressor",
"=",
"comp",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"while",
"(",
"m_run",
")",
"{",
"if",
"(",
"m_compressor",
".",
"enabled",
"(",
")",
")",
"{",
"m_compressor",
".",
"setRelayValue",
"(",
"!",
"m_compressor",
".",
"getPressureSwitchValue",
"(",
")",
"?",
"Relay",
".",
"Value",
".",
"kOn",
":",
"Relay",
".",
"Value",
".",
"kOff",
")",
";",
"}",
"else",
"{",
"m_compressor",
".",
"setRelayValue",
"(",
"Relay",
".",
"Value",
".",
"kOff",
")",
";",
"}",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"500",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"}",
"}",
"}",
"private",
"void",
"initCompressor",
"(",
"final",
"int",
"pressureSwitchSlot",
",",
"final",
"int",
"pressureSwitchChannel",
",",
"final",
"int",
"compresssorRelaySlot",
",",
"final",
"int",
"compressorRelayChannel",
")",
"{",
"checkDigitalModule",
"(",
"pressureSwitchSlot",
")",
";",
"checkRelayModule",
"(",
"compresssorRelaySlot",
")",
";",
"checkDigitalChannel",
"(",
"pressureSwitchChannel",
")",
";",
"checkRelayChannel",
"(",
"compressorRelayChannel",
")",
";",
"m_enabled",
"=",
"false",
";",
"m_pressureSwitch",
"=",
"new",
"DigitalInput",
"(",
"pressureSwitchSlot",
",",
"pressureSwitchChannel",
")",
";",
"m_relay",
"=",
"new",
"Relay",
"(",
"compresssorRelaySlot",
",",
"compressorRelayChannel",
",",
"Relay",
".",
"Direction",
".",
"kForward",
")",
";",
"m_task",
"=",
"new",
"CompressorThread",
"(",
"this",
")",
";",
"m_task",
".",
"start",
"(",
")",
";",
"}",
"public",
"Compressor",
"(",
"final",
"int",
"pressureSwitchSlot",
",",
"final",
"int",
"pressureSwitchChannel",
",",
"final",
"int",
"compresssorRelaySlot",
",",
"final",
"int",
"compressorRelayChannel",
")",
"{",
"initCompressor",
"(",
"pressureSwitchSlot",
",",
"pressureSwitchChannel",
",",
"compresssorRelaySlot",
",",
"compressorRelayChannel",
")",
";",
"}",
"public",
"Compressor",
"(",
"final",
"int",
"pressureSwitchChannel",
",",
"final",
"int",
"compressorRelayChannel",
")",
"{",
"initCompressor",
"(",
"getDefaultDigitalModule",
"(",
")",
",",
"pressureSwitchChannel",
",",
"getDefaultDigitalModule",
"(",
")",
",",
"compressorRelayChannel",
")",
";",
"}",
"protected",
"void",
"free",
"(",
")",
"{",
"m_run",
"=",
"false",
";",
"try",
"{",
"m_task",
".",
"join",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"m_pressureSwitch",
".",
"free",
"(",
")",
";",
"m_relay",
".",
"free",
"(",
")",
";",
"m_pressureSwitch",
"=",
"null",
";",
"m_relay",
"=",
"null",
";",
"}",
"public",
"void",
"setRelayValue",
"(",
"Relay",
".",
"Value",
"relayValue",
")",
"{",
"m_relay",
".",
"set",
"(",
"relayValue",
")",
";",
"}",
"public",
"boolean",
"getPressureSwitchValue",
"(",
")",
"{",
"return",
"m_pressureSwitch",
".",
"get",
"(",
")",
";",
"}",
"public",
"void",
"start",
"(",
")",
"{",
"m_enabled",
"=",
"true",
";",
"}",
"public",
"void",
"stop",
"(",
")",
"{",
"m_enabled",
"=",
"false",
";",
"}",
"public",
"boolean",
"enabled",
"(",
")",
"{",
"return",
"m_enabled",
";",
"}",
"}",
"</s>"
] |
7,430 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"public",
"class",
"SensorBase",
"{",
"private",
"static",
"final",
"int",
"[",
"]",
"modulePopulation",
"=",
"new",
"int",
"[",
"]",
"{",
"0",
",",
"9201",
",",
"9201",
",",
"0",
",",
"9403",
",",
"0",
",",
"9403",
",",
"9472",
",",
"9472",
"}",
";",
"public",
"static",
"final",
"int",
"kSystemClockTicksPerMicrosecond",
"=",
"40",
";",
"public",
"static",
"final",
"int",
"kDigitalChannels",
"=",
"14",
";",
"public",
"static",
"final",
"int",
"kAnalogChannels",
"=",
"8",
";",
"public",
"static",
"final",
"int",
"kAnalogModules",
"=",
"2",
";",
"public",
"static",
"final",
"int",
"kSolenoidChannels",
"=",
"8",
";",
"public",
"static",
"final",
"int",
"kSolenoidModules",
"=",
"2",
";",
"public",
"static",
"final",
"int",
"kPwmChannels",
"=",
"10",
";",
"public",
"static",
"final",
"int",
"kRelayChannels",
"=",
"8",
";",
"public",
"static",
"final",
"int",
"kChassisSlots",
"=",
"8",
";",
"private",
"static",
"int",
"m_defaultAnalogModule",
"=",
"1",
";",
"private",
"static",
"int",
"m_defaultDigitalModule",
"=",
"4",
";",
"private",
"static",
"int",
"m_defaultSolenoidModule",
"=",
"8",
";",
"public",
"SensorBase",
"(",
")",
"{",
"}",
"public",
"static",
"void",
"setDefaultDigitalModule",
"(",
"final",
"int",
"slot",
")",
"{",
"checkDigitalModule",
"(",
"slot",
")",
";",
"SensorBase",
".",
"m_defaultDigitalModule",
"=",
"slot",
";",
"}",
"public",
"static",
"void",
"setDefaultAnalogModule",
"(",
"final",
"int",
"slot",
")",
"{",
"checkAnalogModule",
"(",
"slot",
")",
";",
"SensorBase",
".",
"m_defaultAnalogModule",
"=",
"slot",
";",
"}",
"public",
"static",
"void",
"setDefaultSolenoidModule",
"(",
"final",
"int",
"slot",
")",
"{",
"checkSolenoidModule",
"(",
"slot",
")",
";",
"SensorBase",
".",
"m_defaultSolenoidModule",
"=",
"slot",
";",
"}",
"protected",
"static",
"void",
"checkDigitalModule",
"(",
"final",
"int",
"slot",
")",
"{",
"if",
"(",
"slot",
">",
"kChassisSlots",
"||",
"modulePopulation",
"[",
"slot",
"]",
"!=",
"9403",
")",
"{",
"System",
".",
"err",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"err",
".",
"print",
"(",
"slot",
")",
";",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"\"",
"+",
"slot",
"+",
"\"\"",
")",
";",
"}",
"}",
"protected",
"static",
"void",
"checkRelayModule",
"(",
"final",
"int",
"slot",
")",
"{",
"checkDigitalModule",
"(",
"slot",
")",
";",
"}",
"protected",
"static",
"void",
"checkPWMModule",
"(",
"final",
"int",
"slot",
")",
"{",
"SensorBase",
".",
"checkDigitalModule",
"(",
"slot",
")",
";",
"}",
"protected",
"static",
"void",
"checkAnalogModule",
"(",
"final",
"int",
"slot",
")",
"{",
"if",
"(",
"slot",
">",
"kChassisSlots",
"||",
"modulePopulation",
"[",
"slot",
"]",
"!=",
"9201",
")",
"{",
"System",
".",
"err",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"err",
".",
"print",
"(",
"slot",
")",
";",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"}",
"protected",
"static",
"void",
"checkSolenoidModule",
"(",
"final",
"int",
"slot",
")",
"{",
"if",
"(",
"slot",
">",
"kChassisSlots",
"||",
"modulePopulation",
"[",
"slot",
"]",
"!=",
"9472",
")",
"{",
"System",
".",
"err",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"err",
".",
"print",
"(",
"slot",
")",
";",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"}",
"protected",
"static",
"void",
"checkDigitalChannel",
"(",
"final",
"int",
"channel",
")",
"{",
"if",
"(",
"channel",
"<=",
"0",
"||",
"channel",
">",
"kDigitalChannels",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"}",
"protected",
"static",
"void",
"checkRelayChannel",
"(",
"final",
"int",
"channel",
")",
"{",
"if",
"(",
"channel",
"<=",
"0",
"||",
"channel",
">",
"kRelayChannels",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"\"",
")",
";",
"}",
"}",
"protected",
"static",
"void",
"checkPWMChannel",
"(",
"final",
"int",
"channel",
")",
"{",
"if",
"(",
"channel",
"<=",
"0",
"||",
"channel",
">",
"kPwmChannels",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"\"",
")",
";",
"}",
"}",
"protected",
"static",
"void",
"checkAnalogChannel",
"(",
"final",
"int",
"channel",
")",
"{",
"if",
"(",
"channel",
"<=",
"0",
"||",
"channel",
">",
"kAnalogChannels",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"}",
"protected",
"static",
"void",
"checkSolenoidChannel",
"(",
"final",
"int",
"channel",
")",
"{",
"if",
"(",
"channel",
"<=",
"0",
"||",
"channel",
">",
"kSolenoidChannels",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"}",
"public",
"static",
"int",
"getDefaultAnalogModule",
"(",
")",
"{",
"return",
"SensorBase",
".",
"m_defaultAnalogModule",
";",
"}",
"public",
"static",
"int",
"getDefaultDigitalModule",
"(",
")",
"{",
"return",
"SensorBase",
".",
"m_defaultDigitalModule",
";",
"}",
"public",
"static",
"int",
"getDefaultSolenoidModule",
"(",
")",
"{",
"return",
"SensorBase",
".",
"m_defaultSolenoidModule",
";",
"}",
"protected",
"void",
"free",
"(",
")",
"{",
"}",
"}",
"</s>"
] |
7,431 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"public",
"interface",
"PIDOutput",
"{",
"public",
"void",
"pidWrite",
"(",
"double",
"output",
")",
";",
"}",
"</s>"
] |
7,432 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"IDeviceController",
";",
"public",
"class",
"Victor",
"extends",
"SafePWM",
"implements",
"SpeedController",
",",
"IDeviceController",
"{",
"private",
"void",
"initVictor",
"(",
")",
"{",
"setBounds",
"(",
"210",
",",
"138",
",",
"132",
",",
"126",
",",
"56",
")",
";",
"setPeriodMultiplier",
"(",
"PeriodMultiplier",
".",
"k2X",
")",
";",
"setRaw",
"(",
"m_centerPwm",
")",
";",
"}",
"public",
"Victor",
"(",
"final",
"int",
"channel",
")",
"{",
"super",
"(",
"channel",
")",
";",
"initVictor",
"(",
")",
";",
"}",
"public",
"Victor",
"(",
"final",
"int",
"slot",
",",
"final",
"int",
"channel",
")",
"{",
"super",
"(",
"slot",
",",
"channel",
")",
";",
"initVictor",
"(",
")",
";",
"}",
"public",
"void",
"set",
"(",
"double",
"speed",
",",
"byte",
"syncGroup",
")",
"{",
"setSpeed",
"(",
"speed",
")",
";",
"}",
"public",
"void",
"set",
"(",
"double",
"speed",
")",
"{",
"setSpeed",
"(",
"speed",
")",
";",
"}",
"public",
"double",
"get",
"(",
")",
"{",
"return",
"getSpeed",
"(",
")",
";",
"}",
"public",
"void",
"pidWrite",
"(",
"double",
"output",
")",
"{",
"set",
"(",
"output",
")",
";",
"}",
"}",
"</s>"
] |
7,433 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"public",
"interface",
"SpeedController",
"extends",
"PIDOutput",
"{",
"double",
"get",
"(",
")",
";",
"void",
"set",
"(",
"double",
"speed",
",",
"byte",
"syncGroup",
")",
";",
"void",
"set",
"(",
"double",
"speed",
")",
";",
"void",
"disable",
"(",
")",
";",
"}",
"</s>"
] |
7,434 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"com",
".",
"sun",
".",
"squawk",
".",
"util",
".",
"MathUtils",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
".",
"tDIO",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"AllocationException",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"CheckedAllocationException",
";",
"public",
"class",
"DigitalModule",
"extends",
"Module",
"{",
"public",
"static",
"final",
"int",
"kExpectedLoopTiming",
"=",
"261",
";",
"private",
"static",
"final",
"int",
"mapping",
"[",
"]",
"=",
"{",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"1",
",",
"0",
",",
"0",
"}",
";",
"private",
"static",
"final",
"Resource",
"DIOChannels",
"=",
"new",
"Resource",
"(",
"tDIO",
".",
"kNumSystems",
"*",
"SensorBase",
".",
"kDigitalChannels",
")",
";",
"private",
"static",
"final",
"Resource",
"DO_PWMGenerators",
"[",
"]",
"=",
"new",
"Resource",
"[",
"tDIO",
".",
"kNumSystems",
"]",
";",
"tDIO",
"m_fpgaDIO",
";",
"private",
"final",
"Object",
"syncRoot",
"=",
"new",
"Object",
"(",
")",
";",
"public",
"static",
"synchronized",
"DigitalModule",
"getInstance",
"(",
"final",
"int",
"slot",
")",
"{",
"SensorBase",
".",
"checkDigitalModule",
"(",
"slot",
")",
";",
"if",
"(",
"Module",
".",
"m_modules",
"[",
"slot",
"]",
"==",
"null",
")",
"{",
"Module",
".",
"m_modules",
"[",
"slot",
"]",
"=",
"new",
"DigitalModule",
"(",
"slot",
")",
";",
"}",
"return",
"(",
"DigitalModule",
")",
"Module",
".",
"m_modules",
"[",
"slot",
"]",
";",
"}",
"public",
"static",
"int",
"slotToIndex",
"(",
"final",
"int",
"slot",
")",
"{",
"return",
"DigitalModule",
".",
"mapping",
"[",
"slot",
"-",
"1",
"]",
";",
"}",
"public",
"static",
"int",
"remapDigitalChannel",
"(",
"final",
"int",
"channel",
")",
"{",
"return",
"15",
"-",
"channel",
";",
"}",
"public",
"static",
"int",
"unmapDigitalChannel",
"(",
"final",
"int",
"channel",
")",
"{",
"return",
"15",
"-",
"channel",
";",
"}",
"protected",
"DigitalModule",
"(",
"final",
"int",
"slot",
")",
"{",
"super",
"(",
"slot",
")",
";",
"DO_PWMGenerators",
"[",
"slotToIndex",
"(",
"m_slot",
")",
"]",
"=",
"new",
"Resource",
"(",
"tDIO",
".",
"kDO_PWMDutyCycle_NumElements",
")",
";",
"m_fpgaDIO",
"=",
"new",
"tDIO",
"(",
"slotToIndex",
"(",
"m_slot",
")",
")",
";",
"while",
"(",
"tDIO",
".",
"readLoopTiming",
"(",
")",
"==",
"0",
")",
"{",
"Timer",
".",
"delay",
"(",
".001",
")",
";",
"}",
"if",
"(",
"tDIO",
".",
"readLoopTiming",
"(",
")",
"!=",
"kExpectedLoopTiming",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"tDIO",
".",
"readLoopTiming",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"kExpectedLoopTiming",
")",
";",
"}",
"tDIO",
".",
"writePWMConfig_Period",
"(",
"(",
"short",
")",
"PWM",
".",
"kDefaultPwmPeriod",
")",
";",
"tDIO",
".",
"writePWMConfig_MinHigh",
"(",
"(",
"short",
")",
"PWM",
".",
"kDefaultMinPwmHigh",
")",
";",
"for",
"(",
"int",
"pwm_index",
"=",
"1",
";",
"pwm_index",
"<=",
"kPwmChannels",
";",
"pwm_index",
"++",
")",
"{",
"setPWM",
"(",
"pwm_index",
",",
"PWM",
".",
"kPwmDisabled",
")",
";",
"setPWMPeriodScale",
"(",
"pwm_index",
",",
"PWM",
".",
"PeriodMultiplier",
".",
"k4X_val",
")",
";",
"}",
"m_fpgaDIO",
".",
"writeSlowValue_RelayFwd",
"(",
"0",
")",
";",
"m_fpgaDIO",
".",
"writeSlowValue_RelayRev",
"(",
"0",
")",
";",
"}",
"public",
"void",
"setPWM",
"(",
"final",
"int",
"channel",
",",
"final",
"int",
"value",
")",
"{",
"checkPWMChannel",
"(",
"channel",
")",
";",
"m_fpgaDIO",
".",
"writePWMValue",
"(",
"channel",
"-",
"1",
",",
"value",
")",
";",
"}",
"public",
"int",
"getPWM",
"(",
"final",
"int",
"channel",
")",
"{",
"checkPWMChannel",
"(",
"channel",
")",
";",
"return",
"m_fpgaDIO",
".",
"readPWMValue",
"(",
"channel",
"-",
"1",
")",
";",
"}",
"public",
"void",
"setPWMPeriodScale",
"(",
"final",
"int",
"channel",
",",
"final",
"int",
"squelchMask",
")",
"{",
"checkPWMChannel",
"(",
"channel",
")",
";",
"m_fpgaDIO",
".",
"writePWMPeriodScale",
"(",
"(",
"byte",
")",
"(",
"channel",
"-",
"1",
")",
",",
"squelchMask",
")",
";",
"}",
"public",
"void",
"setRelayForward",
"(",
"final",
"int",
"channel",
",",
"final",
"boolean",
"on",
")",
"{",
"checkRelayChannel",
"(",
"channel",
")",
";",
"synchronized",
"(",
"syncRoot",
")",
"{",
"int",
"forwardRelays",
"=",
"m_fpgaDIO",
".",
"readSlowValue_RelayFwd",
"(",
")",
";",
"if",
"(",
"on",
")",
"{",
"forwardRelays",
"|=",
"1",
"<<",
"(",
"channel",
"-",
"1",
")",
";",
"}",
"else",
"{",
"forwardRelays",
"&=",
"~",
"(",
"1",
"<<",
"(",
"channel",
"-",
"1",
")",
")",
";",
"}",
"m_fpgaDIO",
".",
"writeSlowValue_RelayFwd",
"(",
"forwardRelays",
")",
";",
"}",
"}",
"public",
"void",
"setRelayReverse",
"(",
"final",
"int",
"channel",
",",
"final",
"boolean",
"on",
")",
"{",
"SensorBase",
".",
"checkRelayChannel",
"(",
"channel",
")",
";",
"synchronized",
"(",
"syncRoot",
")",
"{",
"int",
"reverseRelays",
"=",
"m_fpgaDIO",
".",
"readSlowValue_RelayRev",
"(",
")",
";",
"if",
"(",
"on",
")",
"{",
"reverseRelays",
"|=",
"1",
"<<",
"(",
"channel",
"-",
"1",
")",
";",
"}",
"else",
"{",
"reverseRelays",
"&=",
"~",
"(",
"1",
"<<",
"(",
"channel",
"-",
"1",
")",
")",
";",
"}",
"m_fpgaDIO",
".",
"writeSlowValue_RelayRev",
"(",
"reverseRelays",
")",
";",
"}",
"}",
"public",
"boolean",
"getRelayForward",
"(",
"int",
"channel",
")",
"{",
"int",
"forwardRelays",
"=",
"m_fpgaDIO",
".",
"readSlowValue_RelayFwd",
"(",
")",
";",
"return",
"(",
"forwardRelays",
"&",
"(",
"1",
"<<",
"(",
"channel",
"-",
"1",
")",
")",
")",
"!=",
"0",
";",
"}",
"public",
"byte",
"getRelayForward",
"(",
")",
"{",
"return",
"(",
"byte",
")",
"m_fpgaDIO",
".",
"readSlowValue_RelayFwd",
"(",
")",
";",
"}",
"public",
"boolean",
"getRelayReverse",
"(",
"int",
"channel",
")",
"{",
"int",
"reverseRelays",
"=",
"m_fpgaDIO",
".",
"readSlowValue_RelayRev",
"(",
")",
";",
"return",
"(",
"reverseRelays",
"&",
"(",
"1",
"<<",
"(",
"channel",
"-",
"1",
")",
")",
")",
"!=",
"0",
";",
"}",
"public",
"byte",
"getRelayReverse",
"(",
")",
"{",
"return",
"(",
"byte",
")",
"m_fpgaDIO",
".",
"readSlowValue_RelayRev",
"(",
")",
";",
"}",
"public",
"boolean",
"allocateDIO",
"(",
"final",
"int",
"channel",
",",
"final",
"boolean",
"input",
")",
"{",
"try",
"{",
"DIOChannels",
".",
"allocate",
"(",
"(",
"kDigitalChannels",
"*",
"slotToIndex",
"(",
"m_slot",
")",
"+",
"channel",
"-",
"1",
")",
")",
";",
"}",
"catch",
"(",
"CheckedAllocationException",
"e",
")",
"{",
"throw",
"new",
"AllocationException",
"(",
"\"\"",
"+",
"channel",
"+",
"\"",
"on",
"module",
"\"",
"+",
"m_slot",
"+",
"\"\"",
")",
";",
"}",
"final",
"int",
"outputEnable",
"=",
"m_fpgaDIO",
".",
"readOutputEnable",
"(",
")",
";",
"final",
"int",
"bitToSet",
"=",
"1",
"<<",
"(",
"DigitalModule",
".",
"remapDigitalChannel",
"(",
"(",
"channel",
"-",
"1",
")",
")",
")",
";",
"short",
"outputEnableValue",
";",
"if",
"(",
"input",
")",
"{",
"outputEnableValue",
"=",
"(",
"short",
")",
"(",
"outputEnable",
"&",
"(",
"~",
"bitToSet",
")",
")",
";",
"}",
"else",
"{",
"outputEnableValue",
"=",
"(",
"short",
")",
"(",
"outputEnable",
"|",
"bitToSet",
")",
";",
"}",
"m_fpgaDIO",
".",
"writeOutputEnable",
"(",
"outputEnableValue",
")",
";",
"return",
"true",
";",
"}",
"public",
"void",
"freeDIO",
"(",
"final",
"int",
"channel",
")",
"{",
"DIOChannels",
".",
"free",
"(",
"(",
"kDigitalChannels",
"*",
"slotToIndex",
"(",
"m_slot",
")",
"+",
"channel",
"-",
"1",
")",
")",
";",
"}",
"public",
"void",
"setDIO",
"(",
"final",
"int",
"channel",
",",
"final",
"boolean",
"value",
")",
"{",
"int",
"currentDIO",
"=",
"m_fpgaDIO",
".",
"readDO",
"(",
")",
";",
"if",
"(",
"value",
")",
"{",
"currentDIO",
"=",
"(",
"currentDIO",
"&",
"~",
"(",
"1",
"<<",
"DigitalModule",
".",
"remapDigitalChannel",
"(",
"channel",
"-",
"1",
")",
")",
")",
";",
"}",
"else",
"{",
"currentDIO",
"=",
"(",
"currentDIO",
"|",
"(",
"1",
"<<",
"DigitalModule",
".",
"remapDigitalChannel",
"(",
"channel",
"-",
"1",
")",
")",
")",
";",
"}",
"m_fpgaDIO",
".",
"writeDO",
"(",
"currentDIO",
")",
";",
"}",
"public",
"boolean",
"getDIO",
"(",
"final",
"int",
"channel",
")",
"{",
"final",
"int",
"currentDIO",
"=",
"m_fpgaDIO",
".",
"readDI",
"(",
")",
";",
"return",
"(",
"(",
"currentDIO",
">>",
"remapDigitalChannel",
"(",
"channel",
"-",
"1",
")",
")",
"&",
"1",
")",
"==",
"1",
";",
"}",
"public",
"short",
"getAllDIO",
"(",
")",
"{",
"return",
"(",
"short",
")",
"m_fpgaDIO",
".",
"readDI",
"(",
")",
";",
"}",
"public",
"boolean",
"getDIODirection",
"(",
"int",
"channel",
")",
"{",
"int",
"currentOutputEnable",
"=",
"m_fpgaDIO",
".",
"readOutputEnable",
"(",
")",
";",
"return",
"(",
"(",
"currentOutputEnable",
">>",
"remapDigitalChannel",
"(",
"channel",
"-",
"1",
")",
")",
"&",
"1",
")",
"!=",
"0",
";",
"}",
"public",
"short",
"getDIODirection",
"(",
")",
"{",
"return",
"(",
"short",
")",
"m_fpgaDIO",
".",
"readOutputEnable",
"(",
")",
";",
"}",
"public",
"void",
"pulse",
"(",
"final",
"int",
"channel",
",",
"final",
"int",
"pulseLength",
")",
"{",
"final",
"short",
"mask",
"=",
"(",
"short",
")",
"(",
"1",
"<<",
"remapDigitalChannel",
"(",
"channel",
"-",
"1",
")",
")",
";",
"m_fpgaDIO",
".",
"writePulseLength",
"(",
"pulseLength",
")",
";",
"m_fpgaDIO",
".",
"writePulse",
"(",
"mask",
")",
";",
"}",
"public",
"boolean",
"isPulsing",
"(",
"final",
"int",
"channel",
")",
"{",
"final",
"int",
"mask",
"=",
"1",
"<<",
"remapDigitalChannel",
"(",
"channel",
"-",
"1",
")",
";",
"final",
"int",
"pulseRegister",
"=",
"m_fpgaDIO",
".",
"readPulse",
"(",
")",
";",
"return",
"(",
"pulseRegister",
"&",
"mask",
")",
"!=",
"0",
";",
"}",
"public",
"boolean",
"isPulsing",
"(",
")",
"{",
"final",
"int",
"pulseRegister",
"=",
"m_fpgaDIO",
".",
"readPulse",
"(",
")",
";",
"return",
"pulseRegister",
"!=",
"0",
";",
"}",
"public",
"int",
"allocateDO_PWM",
"(",
")",
"{",
"try",
"{",
"return",
"DO_PWMGenerators",
"[",
"slotToIndex",
"(",
"m_slot",
")",
"]",
".",
"allocate",
"(",
")",
";",
"}",
"catch",
"(",
"CheckedAllocationException",
"e",
")",
"{",
"throw",
"new",
"AllocationException",
"(",
"\"\"",
"+",
"m_slot",
"+",
"\"",
"remaining\"",
")",
";",
"}",
"}",
"public",
"void",
"freeDO_PWM",
"(",
"int",
"pwmGenerator",
")",
"{",
"if",
"(",
"pwmGenerator",
"==",
"~",
"0",
")",
"return",
";",
"DO_PWMGenerators",
"[",
"slotToIndex",
"(",
"m_slot",
")",
"]",
".",
"free",
"(",
"pwmGenerator",
")",
";",
"}",
"public",
"void",
"setDO_PWMRate",
"(",
"double",
"rate",
")",
"{",
"byte",
"pwmPeriodPower",
"=",
"(",
"byte",
")",
"(",
"MathUtils",
".",
"log",
"(",
"1.0",
"/",
"(",
"m_fpgaDIO",
".",
"readLoopTiming",
"(",
")",
"*",
"0.25E-6",
"*",
"rate",
")",
")",
"/",
"MathUtils",
".",
"log",
"(",
"2.0",
")",
"+",
"0.5",
")",
";",
"m_fpgaDIO",
".",
"writeDO_PWMConfig_PeriodPower",
"(",
"pwmPeriodPower",
")",
";",
"}",
"public",
"void",
"setDO_PWMOutputChannel",
"(",
"int",
"pwmGenerator",
",",
"int",
"channel",
")",
"{",
"if",
"(",
"pwmGenerator",
"==",
"~",
"0",
")",
"return",
";",
"switch",
"(",
"pwmGenerator",
")",
"{",
"case",
"0",
":",
"m_fpgaDIO",
".",
"writeDO_PWMConfig_OutputSelect_0",
"(",
"remapDigitalChannel",
"(",
"channel",
"-",
"1",
")",
")",
";",
"break",
";",
"case",
"1",
":",
"m_fpgaDIO",
".",
"writeDO_PWMConfig_OutputSelect_1",
"(",
"remapDigitalChannel",
"(",
"channel",
"-",
"1",
")",
")",
";",
"break",
";",
"case",
"2",
":",
"m_fpgaDIO",
".",
"writeDO_PWMConfig_OutputSelect_2",
"(",
"remapDigitalChannel",
"(",
"channel",
"-",
"1",
")",
")",
";",
"break",
";",
"case",
"3",
":",
"m_fpgaDIO",
".",
"writeDO_PWMConfig_OutputSelect_3",
"(",
"remapDigitalChannel",
"(",
"channel",
"-",
"1",
")",
")",
";",
"break",
";",
"}",
"}",
"public",
"void",
"setDO_PWMDutyCycle",
"(",
"int",
"pwmGenerator",
",",
"double",
"dutyCycle",
")",
"{",
"if",
"(",
"pwmGenerator",
"==",
"~",
"0",
")",
"return",
";",
"if",
"(",
"dutyCycle",
">",
"1.0",
")",
"{",
"dutyCycle",
"=",
"1.0",
";",
"}",
"if",
"(",
"dutyCycle",
"<",
"0.0",
")",
"{",
"dutyCycle",
"=",
"0.0",
";",
"}",
"double",
"rawDutyCycle",
"=",
"256.0",
"*",
"dutyCycle",
";",
"if",
"(",
"rawDutyCycle",
">",
"255.5",
")",
"{",
"rawDutyCycle",
"=",
"255.5",
";",
"}",
"byte",
"pwmPeriodPower",
"=",
"m_fpgaDIO",
".",
"readDO_PWMConfig_PeriodPower",
"(",
")",
";",
"if",
"(",
"pwmPeriodPower",
"<",
"4",
")",
"{",
"rawDutyCycle",
"=",
"rawDutyCycle",
"/",
"MathUtils",
".",
"pow",
"(",
"2.0",
",",
"4",
"-",
"pwmPeriodPower",
")",
";",
"}",
"m_fpgaDIO",
".",
"writeDO_PWMDutyCycle",
"(",
"pwmGenerator",
",",
"(",
"byte",
")",
"rawDutyCycle",
")",
";",
"}",
"public",
"I2C",
"getI2C",
"(",
"final",
"int",
"address",
")",
"{",
"return",
"new",
"I2C",
"(",
"this",
",",
"address",
")",
";",
"}",
"}",
"</s>"
] |
7,435 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"public",
"interface",
"PIDSource",
"{",
"public",
"double",
"pidGet",
"(",
")",
";",
"}",
"</s>"
] |
7,436 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
".",
"tInterrupt",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
".",
"tInterruptManager",
";",
"public",
"abstract",
"class",
"InterruptableSensorBase",
"extends",
"SensorBase",
"{",
"protected",
"tInterrupt",
"m_interrupt",
";",
"protected",
"tInterruptManager",
"m_manager",
";",
"protected",
"int",
"m_interruptIndex",
";",
"protected",
"static",
"Resource",
"interrupts",
"=",
"new",
"Resource",
"(",
"8",
")",
";",
"public",
"InterruptableSensorBase",
"(",
")",
"{",
"m_manager",
"=",
"null",
";",
"m_interrupt",
"=",
"null",
";",
"}",
"public",
"void",
"allocateInterrupts",
"(",
"boolean",
"watcher",
")",
"{",
"if",
"(",
"!",
"watcher",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"}",
"m_interrupt",
"=",
"new",
"tInterrupt",
"(",
"(",
"byte",
")",
"m_interruptIndex",
")",
";",
"m_interrupt",
".",
"writeConfig_WaitForAck",
"(",
"false",
")",
";",
"m_manager",
"=",
"new",
"tInterruptManager",
"(",
"1",
"<<",
"m_interruptIndex",
",",
"watcher",
")",
";",
"}",
"public",
"void",
"cancelInterrupts",
"(",
")",
"{",
"if",
"(",
"m_interrupt",
"==",
"null",
"||",
"m_manager",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"}",
"m_interrupt",
".",
"Release",
"(",
")",
";",
"m_interrupt",
"=",
"null",
";",
"m_manager",
".",
"Release",
"(",
")",
";",
"m_manager",
"=",
"null",
";",
"}",
"public",
"void",
"waitForInterrupt",
"(",
"double",
"timeout",
")",
"{",
"m_manager",
".",
"watch",
"(",
"(",
"int",
")",
"(",
"timeout",
"*",
"1e3",
")",
")",
";",
"}",
"public",
"void",
"enableInterrupts",
"(",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"disableInterrupts",
"(",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"\"",
")",
";",
"}",
"public",
"double",
"readInterruptTimestamp",
"(",
")",
"{",
"return",
"m_interrupt",
".",
"readTimeStamp",
"(",
")",
"*",
"1e-6",
";",
"}",
"}",
"</s>"
] |
7,437 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
";",
"import",
"java",
".",
"util",
".",
"Vector",
";",
"public",
"class",
"SortedVector",
"extends",
"Vector",
"{",
"public",
"static",
"interface",
"Comparator",
"{",
"public",
"int",
"compare",
"(",
"Object",
"object1",
",",
"Object",
"object2",
")",
";",
"}",
"Comparator",
"comparator",
";",
"public",
"SortedVector",
"(",
"Comparator",
"comparator",
")",
"{",
"this",
".",
"comparator",
"=",
"comparator",
";",
"}",
"public",
"void",
"addElement",
"(",
"Object",
"element",
")",
"{",
"int",
"highBound",
"=",
"size",
"(",
")",
";",
"int",
"lowBound",
"=",
"0",
";",
"while",
"(",
"highBound",
"-",
"lowBound",
">",
"0",
")",
"{",
"int",
"index",
"=",
"(",
"highBound",
"+",
"lowBound",
")",
"/",
"2",
";",
"int",
"result",
"=",
"comparator",
".",
"compare",
"(",
"element",
",",
"elementAt",
"(",
"index",
")",
")",
";",
"if",
"(",
"result",
"<",
"0",
")",
"{",
"lowBound",
"=",
"index",
"+",
"1",
";",
"}",
"else",
"if",
"(",
"result",
">",
"0",
")",
"{",
"highBound",
"=",
"index",
";",
"}",
"else",
"{",
"lowBound",
"=",
"index",
";",
"highBound",
"=",
"index",
";",
"}",
"}",
"insertElementAt",
"(",
"element",
",",
"lowBound",
")",
";",
"}",
"public",
"void",
"sort",
"(",
")",
"{",
"Object",
"[",
"]",
"array",
"=",
"new",
"Object",
"[",
"size",
"(",
")",
"]",
";",
"copyInto",
"(",
"array",
")",
";",
"removeAllElements",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"addElement",
"(",
"array",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"</s>"
] |
7,438 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
";",
"public",
"class",
"AllocationException",
"extends",
"RuntimeException",
"{",
"public",
"AllocationException",
"(",
"String",
"msg",
")",
"{",
"super",
"(",
"msg",
")",
";",
"}",
"}",
"</s>"
] |
7,439 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
";",
"public",
"class",
"CheckedAllocationException",
"extends",
"Exception",
"{",
"public",
"CheckedAllocationException",
"(",
"String",
"msg",
")",
"{",
"super",
"(",
"msg",
")",
";",
"}",
"}",
"</s>"
] |
7,440 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
";",
"public",
"class",
"BoundaryException",
"extends",
"RuntimeException",
"{",
"public",
"BoundaryException",
"(",
"String",
"message",
")",
"{",
"super",
"(",
"message",
")",
";",
"}",
"public",
"static",
"void",
"assertWithinBounds",
"(",
"double",
"value",
",",
"double",
"lower",
",",
"double",
"upper",
")",
"{",
"if",
"(",
"value",
"<",
"lower",
"||",
"value",
">",
"upper",
")",
"throw",
"new",
"BoundaryException",
"(",
"\"\"",
"+",
"lower",
"+",
"\"",
"and",
"\"",
"+",
"upper",
"+",
"\",",
"\"",
"+",
"value",
"+",
"\"",
"given\"",
")",
";",
"}",
"}",
"</s>"
] |
7,441 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
";",
"public",
"final",
"class",
"UncleanStatusException",
"extends",
"IllegalStateException",
"{",
"private",
"final",
"int",
"statusCode",
";",
"public",
"UncleanStatusException",
"(",
"int",
"status",
",",
"String",
"message",
")",
"{",
"super",
"(",
"message",
")",
";",
"statusCode",
"=",
"status",
";",
"}",
"public",
"UncleanStatusException",
"(",
"int",
"status",
")",
"{",
"this",
"(",
"status",
",",
"\"\"",
")",
";",
"}",
"public",
"UncleanStatusException",
"(",
"String",
"message",
")",
"{",
"this",
"(",
"-",
"1",
",",
"message",
")",
";",
"}",
"public",
"UncleanStatusException",
"(",
")",
"{",
"this",
"(",
"-",
"1",
",",
"\"\"",
")",
";",
"}",
"public",
"int",
"getStatus",
"(",
")",
"{",
"return",
"statusCode",
";",
"}",
"}",
"</s>"
] |
7,442 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
";",
"public",
"interface",
"IInputOutput",
"extends",
"IDevice",
"{",
"}",
"</s>"
] |
7,443 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
";",
"public",
"interface",
"ISensor",
"extends",
"IDevice",
"{",
"}",
"</s>"
] |
7,444 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
";",
"public",
"interface",
"IDevice",
"{",
"}",
"</s>"
] |
7,445 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
";",
"public",
"interface",
"IMechanism",
"{",
"}",
"</s>"
] |
7,446 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
";",
"public",
"interface",
"IDeviceController",
"extends",
"IDevice",
"{",
"}",
"</s>"
] |
7,447 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
";",
"public",
"interface",
"IUtility",
"extends",
"IDevice",
"{",
"}",
"</s>"
] |
7,448 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"IInputOutput",
";",
"import",
"java",
".",
"util",
".",
"Stack",
";",
"public",
"class",
"Dashboard",
"implements",
"IDashboard",
",",
"IInputOutput",
"{",
"protected",
"class",
"MemAccess",
"{",
"byte",
"[",
"]",
"m_bytes",
";",
"protected",
"MemAccess",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"m_bytes",
"=",
"bytes",
";",
"}",
"protected",
"MemAccess",
"(",
"int",
"length",
")",
"{",
"m_bytes",
"=",
"new",
"byte",
"[",
"length",
"]",
";",
"}",
"public",
"void",
"setByte",
"(",
"int",
"index",
",",
"byte",
"value",
")",
"{",
"m_bytes",
"[",
"index",
"]",
"=",
"value",
";",
"}",
"public",
"void",
"setShort",
"(",
"int",
"index",
",",
"short",
"value",
")",
"{",
"setByte",
"(",
"index",
"++",
",",
"(",
"byte",
")",
"(",
"value",
">>>",
"8",
")",
")",
";",
"setByte",
"(",
"index",
"++",
",",
"(",
"byte",
")",
"(",
"value",
")",
")",
";",
"}",
"public",
"void",
"setInt",
"(",
"int",
"index",
",",
"int",
"value",
")",
"{",
"setByte",
"(",
"index",
"++",
",",
"(",
"byte",
")",
"(",
"value",
">>>",
"24",
")",
")",
";",
"setByte",
"(",
"index",
"++",
",",
"(",
"byte",
")",
"(",
"value",
">>>",
"16",
")",
")",
";",
"setByte",
"(",
"index",
"++",
",",
"(",
"byte",
")",
"(",
"value",
">>>",
"8",
")",
")",
";",
"setByte",
"(",
"index",
"++",
",",
"(",
"byte",
")",
"(",
"value",
")",
")",
";",
"}",
"public",
"void",
"setFloat",
"(",
"int",
"index",
",",
"float",
"value",
")",
"{",
"setInt",
"(",
"index",
",",
"Float",
".",
"floatToIntBits",
"(",
"value",
")",
")",
";",
"}",
"public",
"void",
"setDouble",
"(",
"int",
"index",
",",
"double",
"value",
")",
"{",
"setInt",
"(",
"index",
",",
"(",
"int",
")",
"(",
"Double",
".",
"doubleToLongBits",
"(",
"value",
")",
">>>",
"32",
")",
")",
";",
"setInt",
"(",
"index",
"+",
"4",
",",
"(",
"int",
")",
"Double",
".",
"doubleToLongBits",
"(",
"value",
")",
")",
";",
"}",
"public",
"void",
"setString",
"(",
"int",
"index",
",",
"String",
"value",
")",
"{",
"setBytes",
"(",
"index",
",",
"value",
".",
"getBytes",
"(",
")",
",",
"0",
",",
"value",
".",
"length",
"(",
")",
")",
";",
"}",
"public",
"void",
"setBytes",
"(",
"int",
"index",
",",
"byte",
"[",
"]",
"value",
",",
"int",
"offset",
",",
"int",
"number",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"number",
";",
"i",
"++",
")",
"{",
"m_bytes",
"[",
"i",
"+",
"index",
"]",
"=",
"value",
"[",
"i",
"+",
"offset",
"]",
";",
"}",
"}",
"}",
"private",
"static",
"final",
"String",
"kArray",
"=",
"\"Array\"",
";",
"private",
"static",
"final",
"String",
"kCluster",
"=",
"\"Cluster\"",
";",
"private",
"static",
"final",
"Integer",
"kByte",
"=",
"new",
"Integer",
"(",
"0",
")",
";",
"private",
"static",
"final",
"Integer",
"kShort",
"=",
"new",
"Integer",
"(",
"1",
")",
";",
"private",
"static",
"final",
"Integer",
"kInt",
"=",
"new",
"Integer",
"(",
"2",
")",
";",
"private",
"static",
"final",
"Integer",
"kFloat",
"=",
"new",
"Integer",
"(",
"3",
")",
";",
"private",
"static",
"final",
"Integer",
"kDouble",
"=",
"new",
"Integer",
"(",
"4",
")",
";",
"private",
"static",
"final",
"Integer",
"kString",
"=",
"new",
"Integer",
"(",
"5",
")",
";",
"private",
"static",
"final",
"Integer",
"kOther",
"=",
"new",
"Integer",
"(",
"6",
")",
";",
"private",
"static",
"final",
"Integer",
"kBoolean",
"=",
"new",
"Integer",
"(",
"7",
")",
";",
"private",
"static",
"final",
"int",
"kMaxDashboardDataSize",
"=",
"DriverStation",
".",
"USER_STATUS_DATA_SIZE",
"-",
"4",
"*",
"3",
"-",
"1",
";",
"protected",
"MemAccess",
"m_userStatus",
";",
"protected",
"int",
"m_userStatusSize",
"=",
"0",
";",
"private",
"MemAccess",
"m_localBuffer",
";",
"private",
"int",
"m_packPtr",
";",
"private",
"Stack",
"m_expectedArrayElementType",
"=",
"new",
"Stack",
"(",
")",
";",
"private",
"Stack",
"m_arrayElementCount",
"=",
"new",
"Stack",
"(",
")",
";",
"private",
"Stack",
"m_arraySizePtr",
"=",
"new",
"Stack",
"(",
")",
";",
"private",
"Stack",
"m_complexTypeStack",
"=",
"new",
"Stack",
"(",
")",
";",
"private",
"final",
"Object",
"m_statusDataSemaphore",
";",
"protected",
"Dashboard",
"(",
"Object",
"statusDataSemaphore",
")",
"{",
"m_userStatus",
"=",
"new",
"MemAccess",
"(",
"kMaxDashboardDataSize",
")",
";",
"m_localBuffer",
"=",
"new",
"MemAccess",
"(",
"kMaxDashboardDataSize",
")",
";",
"m_packPtr",
"=",
"0",
";",
"m_statusDataSemaphore",
"=",
"statusDataSemaphore",
";",
"}",
"public",
"boolean",
"addByte",
"(",
"byte",
"value",
")",
"{",
"if",
"(",
"!",
"validateAdd",
"(",
"1",
")",
")",
"{",
"return",
"false",
";",
"}",
"m_localBuffer",
".",
"setByte",
"(",
"m_packPtr",
",",
"value",
")",
";",
"m_packPtr",
"+=",
"1",
";",
"return",
"addedElement",
"(",
"kByte",
")",
";",
"}",
"public",
"boolean",
"addShort",
"(",
"short",
"value",
")",
"{",
"if",
"(",
"!",
"validateAdd",
"(",
"2",
")",
")",
"{",
"return",
"false",
";",
"}",
"m_localBuffer",
".",
"setShort",
"(",
"m_packPtr",
",",
"value",
")",
";",
"m_packPtr",
"+=",
"2",
";",
"return",
"addedElement",
"(",
"kShort",
")",
";",
"}",
"public",
"boolean",
"addInt",
"(",
"int",
"value",
")",
"{",
"if",
"(",
"!",
"validateAdd",
"(",
"4",
")",
")",
"{",
"return",
"false",
";",
"}",
"m_localBuffer",
".",
"setInt",
"(",
"m_packPtr",
",",
"value",
")",
";",
"m_packPtr",
"+=",
"4",
";",
"return",
"addedElement",
"(",
"kInt",
")",
";",
"}",
"public",
"boolean",
"addFloat",
"(",
"float",
"value",
")",
"{",
"if",
"(",
"!",
"validateAdd",
"(",
"4",
")",
")",
"{",
"return",
"false",
";",
"}",
"m_localBuffer",
".",
"setFloat",
"(",
"m_packPtr",
",",
"value",
")",
";",
"m_packPtr",
"+=",
"4",
";",
"return",
"addedElement",
"(",
"kFloat",
")",
";",
"}",
"public",
"boolean",
"addDouble",
"(",
"double",
"value",
")",
"{",
"if",
"(",
"!",
"validateAdd",
"(",
"8",
")",
")",
"{",
"return",
"false",
";",
"}",
"m_localBuffer",
".",
"setDouble",
"(",
"m_packPtr",
",",
"value",
")",
";",
"m_packPtr",
"+=",
"8",
";",
"return",
"addedElement",
"(",
"kDouble",
")",
";",
"}",
"public",
"boolean",
"addBoolean",
"(",
"boolean",
"value",
")",
"{",
"if",
"(",
"!",
"validateAdd",
"(",
"1",
")",
")",
"{",
"return",
"false",
";",
"}",
"m_localBuffer",
".",
"setByte",
"(",
"m_packPtr",
",",
"(",
"byte",
")",
"(",
"value",
"?",
"1",
":",
"0",
")",
")",
";",
"m_packPtr",
"+=",
"1",
";",
"return",
"addedElement",
"(",
"kBoolean",
")",
";",
"}",
"public",
"boolean",
"addString",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"!",
"validateAdd",
"(",
"value",
".",
"length",
"(",
")",
"+",
"4",
")",
")",
"{",
"return",
"false",
";",
"}",
"m_localBuffer",
".",
"setInt",
"(",
"m_packPtr",
",",
"value",
".",
"length",
"(",
")",
")",
";",
"m_packPtr",
"+=",
"4",
";",
"m_localBuffer",
".",
"setString",
"(",
"m_packPtr",
",",
"value",
")",
";",
"m_packPtr",
"+=",
"value",
".",
"length",
"(",
")",
";",
"return",
"addedElement",
"(",
"kString",
")",
";",
"}",
"public",
"boolean",
"addString",
"(",
"String",
"value",
",",
"int",
"length",
")",
"{",
"return",
"addString",
"(",
"value",
".",
"substring",
"(",
"0",
",",
"length",
")",
")",
";",
"}",
"public",
"boolean",
"addArray",
"(",
")",
"{",
"if",
"(",
"!",
"validateAdd",
"(",
"4",
")",
")",
"{",
"return",
"false",
";",
"}",
"m_complexTypeStack",
".",
"push",
"(",
"kArray",
")",
";",
"m_arrayElementCount",
".",
"push",
"(",
"new",
"Integer",
"(",
"0",
")",
")",
";",
"m_arraySizePtr",
".",
"push",
"(",
"new",
"Integer",
"(",
"m_packPtr",
")",
")",
";",
"m_packPtr",
"+=",
"4",
";",
"return",
"true",
";",
"}",
"public",
"boolean",
"finalizeArray",
"(",
")",
"{",
"if",
"(",
"m_complexTypeStack",
".",
"peek",
"(",
")",
"!=",
"kArray",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"return",
"false",
";",
"}",
"m_complexTypeStack",
".",
"pop",
"(",
")",
";",
"m_localBuffer",
".",
"setInt",
"(",
"(",
"(",
"Integer",
")",
"m_arraySizePtr",
".",
"pop",
"(",
")",
")",
".",
"intValue",
"(",
")",
",",
"(",
"(",
"Integer",
")",
"m_arrayElementCount",
".",
"peek",
"(",
")",
")",
".",
"intValue",
"(",
")",
")",
";",
"if",
"(",
"(",
"(",
"Integer",
")",
"m_arrayElementCount",
".",
"peek",
"(",
")",
")",
".",
"intValue",
"(",
")",
"!=",
"0",
")",
"{",
"m_expectedArrayElementType",
".",
"pop",
"(",
")",
";",
"}",
"m_arrayElementCount",
".",
"pop",
"(",
")",
";",
"return",
"addedElement",
"(",
"kOther",
")",
";",
"}",
"public",
"boolean",
"addCluster",
"(",
")",
"{",
"m_complexTypeStack",
".",
"push",
"(",
"kCluster",
")",
";",
"return",
"true",
";",
"}",
"public",
"boolean",
"finalizeCluster",
"(",
")",
"{",
"if",
"(",
"m_complexTypeStack",
".",
"peek",
"(",
")",
"!=",
"kCluster",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"return",
"false",
";",
"}",
"m_complexTypeStack",
".",
"pop",
"(",
")",
";",
"return",
"addedElement",
"(",
"kOther",
")",
";",
"}",
"public",
"synchronized",
"int",
"commit",
"(",
")",
"{",
"if",
"(",
"!",
"m_complexTypeStack",
".",
"empty",
"(",
")",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"m_packPtr",
"=",
"0",
";",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"return",
"0",
";",
"}",
"synchronized",
"(",
"m_statusDataSemaphore",
")",
"{",
"DriverStation",
".",
"getInstance",
"(",
")",
".",
"incrementUpdateNumber",
"(",
")",
";",
"m_userStatusSize",
"=",
"m_packPtr",
";",
"m_userStatus",
".",
"setBytes",
"(",
"0",
",",
"m_localBuffer",
".",
"m_bytes",
",",
"0",
",",
"m_userStatusSize",
")",
";",
"m_packPtr",
"=",
"0",
";",
"}",
"return",
"m_userStatusSize",
";",
"}",
"private",
"boolean",
"validateAdd",
"(",
"int",
"size",
")",
"{",
"if",
"(",
"m_packPtr",
"+",
"size",
">",
"kMaxDashboardDataSize",
")",
"{",
"m_packPtr",
"=",
"0",
";",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}",
"private",
"boolean",
"addedElement",
"(",
"Integer",
"type",
")",
"{",
"if",
"(",
"isArrayRoot",
"(",
")",
")",
"{",
"if",
"(",
"(",
"(",
"Integer",
")",
"m_arrayElementCount",
".",
"peek",
"(",
")",
")",
".",
"intValue",
"(",
")",
"==",
"0",
")",
"{",
"m_expectedArrayElementType",
".",
"push",
"(",
"type",
")",
";",
"}",
"else",
"{",
"if",
"(",
"type",
"!=",
"m_expectedArrayElementType",
".",
"peek",
"(",
")",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"return",
"false",
";",
"}",
"}",
"m_arrayElementCount",
".",
"push",
"(",
"new",
"Integer",
"(",
"(",
"(",
"Integer",
")",
"m_arrayElementCount",
".",
"pop",
"(",
")",
")",
".",
"intValue",
"(",
")",
"+",
"1",
")",
")",
";",
"}",
"return",
"true",
";",
"}",
"private",
"boolean",
"isArrayRoot",
"(",
")",
"{",
"return",
"!",
"m_complexTypeStack",
".",
"empty",
"(",
")",
"&&",
"m_complexTypeStack",
".",
"peek",
"(",
")",
"==",
"kArray",
";",
"}",
"public",
"byte",
"[",
"]",
"getBytes",
"(",
")",
"{",
"return",
"m_userStatus",
".",
"m_bytes",
";",
"}",
"public",
"int",
"getBytesLength",
"(",
")",
"{",
"return",
"m_userStatusSize",
";",
"}",
"public",
"void",
"flush",
"(",
")",
"{",
"}",
"}",
"</s>"
] |
7,449 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"public",
"class",
"SimpleRobot",
"extends",
"RobotBase",
"{",
"private",
"boolean",
"m_robotMainOverridden",
";",
"public",
"SimpleRobot",
"(",
")",
"{",
"super",
"(",
")",
";",
"m_robotMainOverridden",
"=",
"true",
";",
"}",
"protected",
"void",
"robotInit",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"protected",
"void",
"disabled",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"autonomous",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"operatorControl",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"public",
"void",
"robotMain",
"(",
")",
"{",
"m_robotMainOverridden",
"=",
"false",
";",
"}",
"public",
"void",
"startCompetition",
"(",
")",
"{",
"robotMain",
"(",
")",
";",
"if",
"(",
"!",
"m_robotMainOverridden",
")",
"{",
"robotInit",
"(",
")",
";",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"isDisabled",
"(",
")",
")",
"{",
"disabled",
"(",
")",
";",
"while",
"(",
"isDisabled",
"(",
")",
")",
"{",
"Timer",
".",
"delay",
"(",
"0.01",
")",
";",
"}",
"}",
"else",
"if",
"(",
"isAutonomous",
"(",
")",
")",
"{",
"autonomous",
"(",
")",
";",
"while",
"(",
"isAutonomous",
"(",
")",
"&&",
"!",
"isDisabled",
"(",
")",
")",
"{",
"Timer",
".",
"delay",
"(",
"0.01",
")",
";",
"}",
"}",
"else",
"{",
"operatorControl",
"(",
")",
";",
"while",
"(",
"isOperatorControl",
"(",
")",
"&&",
"!",
"isDisabled",
"(",
")",
")",
"{",
"Timer",
".",
"delay",
"(",
"0.01",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"</s>"
] |
7,450 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"ISensor",
";",
"public",
"class",
"HiTechnicCompass",
"extends",
"SensorBase",
"implements",
"ISensor",
"{",
"public",
"class",
"CompassException",
"extends",
"RuntimeException",
"{",
"public",
"CompassException",
"(",
"String",
"message",
")",
"{",
"super",
"(",
"message",
")",
";",
"}",
"}",
"private",
"static",
"final",
"byte",
"kAddress",
"=",
"0x02",
";",
"private",
"static",
"final",
"byte",
"kManufacturerBaseRegister",
"=",
"0x08",
";",
"private",
"static",
"final",
"byte",
"kManufacturerSize",
"=",
"0x08",
";",
"private",
"static",
"final",
"byte",
"kSensorTypeBaseRegister",
"=",
"0x10",
";",
"private",
"static",
"final",
"byte",
"kSensorTypeSize",
"=",
"0x08",
";",
"private",
"static",
"final",
"byte",
"kHeadingRegister",
"=",
"0x44",
";",
"private",
"I2C",
"m_i2c",
";",
"public",
"HiTechnicCompass",
"(",
"int",
"slot",
")",
"{",
"DigitalModule",
"module",
"=",
"DigitalModule",
".",
"getInstance",
"(",
"slot",
")",
";",
"m_i2c",
"=",
"module",
".",
"getI2C",
"(",
"kAddress",
")",
";",
"final",
"byte",
"[",
"]",
"kExpectedManufacturer",
"=",
"\"HiTechnc\"",
".",
"getBytes",
"(",
")",
";",
"final",
"byte",
"[",
"]",
"kExpectedSensorType",
"=",
"\"Compass",
"\"",
".",
"getBytes",
"(",
")",
";",
"if",
"(",
"!",
"m_i2c",
".",
"verifySensor",
"(",
"kManufacturerBaseRegister",
",",
"kManufacturerSize",
",",
"kExpectedManufacturer",
")",
")",
"{",
"throw",
"new",
"CompassException",
"(",
"\"\"",
")",
";",
"}",
"if",
"(",
"!",
"m_i2c",
".",
"verifySensor",
"(",
"kSensorTypeBaseRegister",
",",
"kSensorTypeSize",
",",
"kExpectedSensorType",
")",
")",
"{",
"throw",
"new",
"CompassException",
"(",
"\"\"",
")",
";",
"}",
"}",
"protected",
"void",
"free",
"(",
")",
"{",
"if",
"(",
"m_i2c",
"!=",
"null",
")",
"{",
"m_i2c",
".",
"free",
"(",
")",
";",
"}",
"m_i2c",
"=",
"null",
";",
"}",
"public",
"double",
"getAngle",
"(",
")",
"{",
"byte",
"[",
"]",
"heading",
"=",
"new",
"byte",
"[",
"2",
"]",
";",
"m_i2c",
".",
"read",
"(",
"kHeadingRegister",
",",
"(",
"byte",
")",
"heading",
".",
"length",
",",
"heading",
")",
";",
"return",
"(",
"(",
"int",
")",
"heading",
"[",
"1",
"]",
"+",
"(",
"int",
")",
"heading",
"[",
"2",
"]",
"*",
"(",
"int",
")",
"(",
"1",
"<<",
"8",
")",
")",
";",
"}",
"}",
"</s>"
] |
7,451 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
".",
"tAnalogTrigger",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"IInputOutput",
";",
"public",
"class",
"AnalogTriggerOutput",
"extends",
"DigitalSource",
"implements",
"IInputOutput",
"{",
"public",
"class",
"AnalogTriggerOutputException",
"extends",
"RuntimeException",
"{",
"public",
"AnalogTriggerOutputException",
"(",
"String",
"message",
")",
"{",
"super",
"(",
"message",
")",
";",
"}",
"}",
"public",
"static",
"class",
"Type",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"int",
"kInWindow_val",
"=",
"0",
";",
"static",
"final",
"int",
"kTypeState_val",
"=",
"1",
";",
"static",
"final",
"int",
"kRisingPulse_val",
"=",
"2",
";",
"static",
"final",
"int",
"kFallingPulse_val",
"=",
"3",
";",
"public",
"static",
"final",
"Type",
"kInWindow",
"=",
"new",
"Type",
"(",
"kInWindow_val",
")",
";",
"public",
"static",
"final",
"Type",
"kTypeState",
"=",
"new",
"Type",
"(",
"kTypeState_val",
")",
";",
"public",
"static",
"final",
"Type",
"kRisingPulse",
"=",
"new",
"Type",
"(",
"kRisingPulse_val",
")",
";",
"public",
"static",
"final",
"Type",
"kFallingPulse",
"=",
"new",
"Type",
"(",
"kFallingPulse_val",
")",
";",
"private",
"Type",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"private",
"AnalogTrigger",
"m_trigger",
";",
"private",
"Type",
"m_outputType",
";",
"public",
"AnalogTriggerOutput",
"(",
"AnalogTrigger",
"trigger",
",",
"final",
"Type",
"outputType",
")",
"{",
"if",
"(",
"trigger",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"m_trigger",
"=",
"trigger",
";",
"m_outputType",
"=",
"outputType",
";",
"}",
"protected",
"void",
"free",
"(",
")",
"{",
"}",
"public",
"boolean",
"get",
"(",
")",
"{",
"switch",
"(",
"m_outputType",
".",
"value",
")",
"{",
"case",
"Type",
".",
"kInWindow_val",
":",
"return",
"tAnalogTrigger",
".",
"readOutput_InHysteresis",
"(",
"(",
"byte",
")",
"m_trigger",
".",
"m_index",
")",
";",
"case",
"Type",
".",
"kTypeState_val",
":",
"return",
"tAnalogTrigger",
".",
"readOutput_OverLimit",
"(",
"(",
"byte",
")",
"m_trigger",
".",
"m_index",
")",
";",
"case",
"Type",
".",
"kRisingPulse_val",
":",
"case",
"Type",
".",
"kFallingPulse_val",
":",
"throw",
"new",
"AnalogTriggerOutputException",
"(",
"\"\"",
")",
";",
"}",
"return",
"false",
";",
"}",
"public",
"int",
"getChannelForRouting",
"(",
")",
"{",
"return",
"(",
"m_trigger",
".",
"m_index",
"<<",
"2",
")",
"+",
"m_outputType",
".",
"value",
";",
"}",
"public",
"int",
"getModuleForRouting",
"(",
")",
"{",
"return",
"m_trigger",
".",
"m_index",
">>",
"2",
";",
"}",
"public",
"boolean",
"getAnalogTriggerForRouting",
"(",
")",
"{",
"return",
"true",
";",
"}",
"}",
"</s>"
] |
7,452 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
".",
"tAnalogTrigger",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"IInputOutput",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"AllocationException",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"BoundaryException",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"CheckedAllocationException",
";",
"public",
"class",
"AnalogTrigger",
"implements",
"IInputOutput",
"{",
"public",
"class",
"AnalogTriggerException",
"extends",
"RuntimeException",
"{",
"public",
"AnalogTriggerException",
"(",
"String",
"message",
")",
"{",
"super",
"(",
"message",
")",
";",
"}",
"}",
"private",
"static",
"Resource",
"triggers",
"=",
"new",
"Resource",
"(",
"tAnalogTrigger",
".",
"kNumSystems",
")",
";",
"protected",
"int",
"m_index",
";",
"private",
"tAnalogTrigger",
"m_trigger",
";",
"private",
"AnalogModule",
"m_analogModule",
";",
"private",
"int",
"m_channel",
";",
"protected",
"void",
"initTrigger",
"(",
"final",
"int",
"slot",
",",
"final",
"int",
"channel",
")",
"{",
"m_channel",
"=",
"channel",
";",
"m_analogModule",
"=",
"AnalogModule",
".",
"getInstance",
"(",
"slot",
")",
";",
"try",
"{",
"m_index",
"=",
"triggers",
".",
"allocate",
"(",
")",
";",
"}",
"catch",
"(",
"CheckedAllocationException",
"e",
")",
"{",
"throw",
"new",
"AllocationException",
"(",
"\"\"",
")",
";",
"}",
"m_trigger",
"=",
"new",
"tAnalogTrigger",
"(",
"(",
"byte",
")",
"m_index",
")",
";",
"m_trigger",
".",
"writeSourceSelect_Channel",
"(",
"(",
"byte",
")",
"(",
"m_channel",
"-",
"1",
")",
")",
";",
"m_trigger",
".",
"writeSourceSelect_Module",
"(",
"(",
"byte",
")",
"AnalogModule",
".",
"slotToIndex",
"(",
"(",
"byte",
")",
"slot",
")",
")",
";",
"}",
"public",
"AnalogTrigger",
"(",
"final",
"int",
"channel",
")",
"{",
"initTrigger",
"(",
"AnalogModule",
".",
"getDefaultAnalogModule",
"(",
")",
",",
"channel",
")",
";",
"}",
"public",
"AnalogTrigger",
"(",
"final",
"int",
"slot",
",",
"final",
"int",
"channel",
")",
"{",
"initTrigger",
"(",
"slot",
",",
"channel",
")",
";",
"}",
"public",
"AnalogTrigger",
"(",
"AnalogChannel",
"channel",
")",
"{",
"initTrigger",
"(",
"channel",
".",
"getSlot",
"(",
")",
",",
"channel",
".",
"getChannel",
"(",
")",
")",
";",
"}",
"protected",
"void",
"free",
"(",
")",
"{",
"triggers",
".",
"free",
"(",
"m_index",
")",
";",
"m_trigger",
".",
"Release",
"(",
")",
";",
"m_trigger",
"=",
"null",
";",
"}",
"public",
"void",
"setLimitsRaw",
"(",
"final",
"int",
"lower",
",",
"final",
"int",
"upper",
")",
"{",
"if",
"(",
"lower",
">",
"upper",
")",
"{",
"throw",
"new",
"BoundaryException",
"(",
"\"\"",
")",
";",
"}",
"m_trigger",
".",
"writeLowerLimit",
"(",
"lower",
")",
";",
"m_trigger",
".",
"writeUpperLimit",
"(",
"upper",
")",
";",
"}",
"public",
"void",
"setLimitsVoltage",
"(",
"double",
"lower",
",",
"double",
"upper",
")",
"{",
"if",
"(",
"lower",
">",
"upper",
")",
"{",
"throw",
"new",
"BoundaryException",
"(",
"\"\"",
")",
";",
"}",
"m_trigger",
".",
"writeLowerLimit",
"(",
"m_analogModule",
".",
"voltsToValue",
"(",
"m_channel",
",",
"lower",
")",
")",
";",
"m_trigger",
".",
"writeUpperLimit",
"(",
"m_analogModule",
".",
"voltsToValue",
"(",
"m_channel",
",",
"upper",
")",
")",
";",
"}",
"public",
"void",
"setAveraged",
"(",
"boolean",
"useAveragedValue",
")",
"{",
"if",
"(",
"m_trigger",
".",
"readSourceSelect_Filter",
"(",
")",
"&&",
"useAveragedValue",
")",
"{",
"throw",
"new",
"AnalogTriggerException",
"(",
"\"\"",
")",
";",
"}",
"m_trigger",
".",
"writeSourceSelect_Averaged",
"(",
"useAveragedValue",
")",
";",
"}",
"public",
"void",
"setFiltered",
"(",
"boolean",
"useFilteredValue",
")",
"{",
"if",
"(",
"m_trigger",
".",
"readSourceSelect_Averaged",
"(",
")",
"&&",
"useFilteredValue",
")",
"{",
"throw",
"new",
"AnalogTriggerException",
"(",
"\"\"",
")",
";",
"}",
"m_trigger",
".",
"writeSourceSelect_Filter",
"(",
"useFilteredValue",
")",
";",
"}",
"public",
"int",
"getIndex",
"(",
")",
"{",
"return",
"m_index",
";",
"}",
"public",
"boolean",
"getInWindow",
"(",
")",
"{",
"return",
"tAnalogTrigger",
".",
"readOutput_InHysteresis",
"(",
"(",
"byte",
")",
"m_index",
")",
";",
"}",
"public",
"boolean",
"getTriggerState",
"(",
")",
"{",
"return",
"tAnalogTrigger",
".",
"readOutput_OverLimit",
"(",
"(",
"byte",
")",
"m_index",
")",
";",
"}",
"AnalogTriggerOutput",
"createOutput",
"(",
"AnalogTriggerOutput",
".",
"Type",
"type",
")",
"{",
"return",
"new",
"AnalogTriggerOutput",
"(",
"this",
",",
"type",
")",
";",
"}",
"}",
"</s>"
] |
7,453 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"IUtility",
";",
"public",
"class",
"Timer",
"implements",
"IUtility",
"{",
"private",
"long",
"m_startTime",
";",
"private",
"double",
"m_accumulatedTime",
";",
"private",
"boolean",
"m_running",
";",
"public",
"static",
"void",
"delay",
"(",
"final",
"double",
"seconds",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"(",
"long",
")",
"(",
"seconds",
"*",
"1e3",
")",
")",
";",
"}",
"catch",
"(",
"final",
"InterruptedException",
"e",
")",
"{",
"}",
"}",
"public",
"static",
"long",
"getUsClock",
"(",
")",
"{",
"return",
"Utility",
".",
"getFPGATime",
"(",
")",
";",
"}",
"static",
"long",
"getMsClock",
"(",
")",
"{",
"return",
"getUsClock",
"(",
")",
"/",
"1000",
";",
"}",
"public",
"static",
"double",
"getFPGATimestamp",
"(",
")",
"{",
"return",
"Utility",
".",
"getFPGATime",
"(",
")",
"/",
"1000000.0",
";",
"}",
"public",
"Timer",
"(",
")",
"{",
"reset",
"(",
")",
";",
"}",
"public",
"synchronized",
"double",
"get",
"(",
")",
"{",
"if",
"(",
"m_running",
")",
"{",
"return",
"(",
"(",
"double",
")",
"(",
"(",
"getMsClock",
"(",
")",
"-",
"m_startTime",
")",
"+",
"m_accumulatedTime",
")",
")",
"/",
"1000.0",
";",
"}",
"else",
"{",
"return",
"m_accumulatedTime",
";",
"}",
"}",
"public",
"synchronized",
"void",
"reset",
"(",
")",
"{",
"m_accumulatedTime",
"=",
"0",
";",
"m_startTime",
"=",
"getMsClock",
"(",
")",
";",
"}",
"public",
"synchronized",
"void",
"start",
"(",
")",
"{",
"m_startTime",
"=",
"getMsClock",
"(",
")",
";",
"m_running",
"=",
"true",
";",
"}",
"public",
"synchronized",
"void",
"stop",
"(",
")",
"{",
"final",
"double",
"temp",
"=",
"get",
"(",
")",
";",
"m_accumulatedTime",
"+=",
"temp",
";",
"m_running",
"=",
"false",
";",
"}",
"}",
"</s>"
] |
7,454 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"ISensor",
";",
"public",
"class",
"Accelerometer",
"extends",
"SensorBase",
"implements",
"PIDSource",
",",
"ISensor",
"{",
"private",
"AnalogChannel",
"m_analogChannel",
";",
"private",
"double",
"m_voltsPerG",
"=",
"1.0",
";",
"private",
"double",
"m_zeroGVoltage",
"=",
"2.5",
";",
"private",
"boolean",
"m_allocatedChannel",
";",
"public",
"Accelerometer",
"(",
"final",
"int",
"channel",
")",
"{",
"m_allocatedChannel",
"=",
"true",
";",
"m_analogChannel",
"=",
"new",
"AnalogChannel",
"(",
"channel",
")",
";",
"}",
"public",
"Accelerometer",
"(",
"final",
"int",
"slot",
",",
"final",
"int",
"channel",
")",
"{",
"m_allocatedChannel",
"=",
"true",
";",
"m_analogChannel",
"=",
"new",
"AnalogChannel",
"(",
"slot",
",",
"channel",
")",
";",
"}",
"public",
"Accelerometer",
"(",
"AnalogChannel",
"channel",
")",
"{",
"m_allocatedChannel",
"=",
"false",
";",
"if",
"(",
"channel",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"m_analogChannel",
"=",
"channel",
";",
"}",
"protected",
"void",
"free",
"(",
")",
"{",
"if",
"(",
"m_analogChannel",
"!=",
"null",
"&&",
"m_allocatedChannel",
")",
"{",
"m_analogChannel",
".",
"free",
"(",
")",
";",
"}",
"m_analogChannel",
"=",
"null",
";",
"}",
"public",
"double",
"getAcceleration",
"(",
")",
"{",
"return",
"(",
"m_analogChannel",
".",
"getAverageVoltage",
"(",
")",
"-",
"m_zeroGVoltage",
")",
"/",
"m_voltsPerG",
";",
"}",
"public",
"void",
"setSensitivity",
"(",
"double",
"sensitivity",
")",
"{",
"m_voltsPerG",
"=",
"sensitivity",
";",
"}",
"public",
"void",
"setZero",
"(",
"double",
"zero",
")",
"{",
"m_zeroGVoltage",
"=",
"zero",
";",
"}",
"public",
"double",
"pidGet",
"(",
")",
"{",
"return",
"getAcceleration",
"(",
")",
";",
"}",
"}",
"</s>"
] |
7,455 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"java",
".",
"io",
".",
"ByteArrayOutputStream",
";",
"import",
"java",
".",
"io",
".",
"DataOutputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"util",
".",
"Enumeration",
";",
"import",
"java",
".",
"util",
".",
"Hashtable",
";",
"public",
"class",
"SmartDashboard",
"implements",
"IDashboard",
"{",
"public",
"static",
"final",
"int",
"MAX_FIELDS",
"=",
"127",
";",
"public",
"static",
"final",
"int",
"BUFFER_SIZE",
"=",
"768",
";",
"public",
"static",
"final",
"int",
"SUCCESS",
"=",
"0",
";",
"public",
"static",
"final",
"int",
"ERROR_BUFFER_FULL",
"=",
"-",
"1",
";",
"public",
"static",
"final",
"int",
"ERROR_TYPE_MISMATCH",
"=",
"-",
"2",
";",
"public",
"static",
"final",
"int",
"ERROR_TOO_MANY_FIELDS",
"=",
"-",
"3",
";",
"public",
"static",
"final",
"int",
"ERROR_STRING_TOO_LONG",
"=",
"-",
"4",
";",
"protected",
"static",
"final",
"byte",
"BYTE_TYPE",
"=",
"0",
";",
"protected",
"static",
"final",
"byte",
"CHAR_TYPE",
"=",
"1",
";",
"protected",
"static",
"final",
"byte",
"INT_TYPE",
"=",
"2",
";",
"protected",
"static",
"final",
"byte",
"LONG_TYPE",
"=",
"3",
";",
"protected",
"static",
"final",
"byte",
"SHORT_TYPE",
"=",
"4",
";",
"protected",
"static",
"final",
"byte",
"FLOAT_TYPE",
"=",
"5",
";",
"protected",
"static",
"final",
"byte",
"DOUBLE_TYPE",
"=",
"6",
";",
"protected",
"static",
"final",
"byte",
"STRING_UTF16_TYPE",
"=",
"7",
";",
"protected",
"static",
"final",
"byte",
"BOOL_TYPE",
"=",
"8",
";",
"protected",
"static",
"final",
"byte",
"STRING_UTF8_TYPE",
"=",
"9",
";",
"protected",
"static",
"final",
"int",
"REANNOUNCEMENT_INTERVAL_MS",
"=",
"5000",
";",
"protected",
"final",
"static",
"Hashtable",
"field_types",
"=",
"new",
"Hashtable",
"(",
")",
";",
"protected",
"final",
"static",
"Hashtable",
"field_ids",
"=",
"new",
"Hashtable",
"(",
")",
";",
"private",
"static",
"SmartDashboard",
"instance",
"=",
"null",
";",
"private",
"static",
"boolean",
"initialized",
"=",
"false",
";",
"protected",
"final",
"Object",
"m_monitor",
";",
"private",
"ByteArrayOutputStream",
"m_byteBuffer",
";",
"private",
"DataOutputStream",
"m_dataOutput",
";",
"private",
"long",
"m_nextReannouncementTime",
";",
"private",
"boolean",
"m_blockingIO",
"=",
"false",
";",
"private",
"SmartDashboard",
"(",
"Object",
"monitor",
")",
"{",
"m_monitor",
"=",
"monitor",
";",
"m_byteBuffer",
"=",
"new",
"ByteArrayOutputStream",
"(",
"BUFFER_SIZE",
")",
";",
"m_dataOutput",
"=",
"new",
"DataOutputStream",
"(",
"m_byteBuffer",
")",
";",
"m_nextReannouncementTime",
"=",
"Timer",
".",
"getMsClock",
"(",
")",
"+",
"REANNOUNCEMENT_INTERVAL_MS",
";",
"}",
"public",
"static",
"void",
"init",
"(",
")",
"{",
"field_types",
".",
"clear",
"(",
")",
";",
"field_ids",
".",
"clear",
"(",
")",
";",
"instance",
"=",
"new",
"SmartDashboard",
"(",
"DriverStation",
".",
"getInstance",
"(",
")",
".",
"getStatusDataMonitor",
"(",
")",
")",
";",
"DriverStation",
".",
"getInstance",
"(",
")",
".",
"setDashboardPackerToUseHigh",
"(",
"getInstance",
"(",
")",
")",
";",
"initialized",
"=",
"true",
";",
"}",
"public",
"static",
"int",
"log",
"(",
"byte",
"value",
",",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"initialized",
")",
"init",
"(",
")",
";",
"int",
"retcode",
"=",
"SUCCESS",
";",
"SmartDashboard",
"dash",
"=",
"getInstance",
"(",
")",
";",
"synchronized",
"(",
"dash",
".",
"m_monitor",
")",
"{",
"try",
"{",
"if",
"(",
"(",
"retcode",
"=",
"dash",
".",
"announceIfNewField",
"(",
"BYTE_TYPE",
",",
"name",
")",
")",
"!=",
"SUCCESS",
")",
"return",
"retcode",
";",
"byte",
"dataLen",
"=",
"1",
";",
"if",
"(",
"dash",
".",
"checkBufferFull",
"(",
"SmartDashboardPacketFactory",
".",
"getUpdateLength",
"(",
"dataLen",
")",
")",
")",
"return",
"ERROR_BUFFER_FULL",
";",
"dash",
".",
"fieldUpdatePrefix",
"(",
"name",
",",
"dataLen",
")",
";",
"dash",
".",
"m_dataOutput",
".",
"writeByte",
"(",
"value",
")",
";",
"dash",
".",
"periodicallyReannounce",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"return",
"ERROR_BUFFER_FULL",
";",
"}",
"DriverStation",
".",
"getInstance",
"(",
")",
".",
"incrementUpdateNumber",
"(",
")",
";",
"}",
"return",
"retcode",
";",
"}",
"public",
"static",
"int",
"log",
"(",
"char",
"value",
",",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"initialized",
")",
"init",
"(",
")",
";",
"int",
"retcode",
"=",
"SUCCESS",
";",
"SmartDashboard",
"dash",
"=",
"getInstance",
"(",
")",
";",
"synchronized",
"(",
"dash",
".",
"m_monitor",
")",
"{",
"try",
"{",
"if",
"(",
"(",
"retcode",
"=",
"dash",
".",
"announceIfNewField",
"(",
"CHAR_TYPE",
",",
"name",
")",
")",
"!=",
"SUCCESS",
")",
"return",
"retcode",
";",
"byte",
"dataLen",
"=",
"2",
";",
"if",
"(",
"dash",
".",
"checkBufferFull",
"(",
"SmartDashboardPacketFactory",
".",
"getUpdateLength",
"(",
"dataLen",
")",
")",
")",
"return",
"ERROR_BUFFER_FULL",
";",
"dash",
".",
"fieldUpdatePrefix",
"(",
"name",
",",
"dataLen",
")",
";",
"dash",
".",
"m_dataOutput",
".",
"writeChar",
"(",
"value",
")",
";",
"dash",
".",
"periodicallyReannounce",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"return",
"ERROR_BUFFER_FULL",
";",
"}",
"DriverStation",
".",
"getInstance",
"(",
")",
".",
"incrementUpdateNumber",
"(",
")",
";",
"}",
"return",
"retcode",
";",
"}",
"public",
"static",
"int",
"log",
"(",
"int",
"value",
",",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"initialized",
")",
"init",
"(",
")",
";",
"int",
"retcode",
"=",
"SUCCESS",
";",
"SmartDashboard",
"dash",
"=",
"getInstance",
"(",
")",
";",
"synchronized",
"(",
"dash",
".",
"m_monitor",
")",
"{",
"try",
"{",
"if",
"(",
"(",
"retcode",
"=",
"dash",
".",
"announceIfNewField",
"(",
"INT_TYPE",
",",
"name",
")",
")",
"!=",
"SUCCESS",
")",
"return",
"retcode",
";",
"byte",
"dataLen",
"=",
"4",
";",
"if",
"(",
"dash",
".",
"checkBufferFull",
"(",
"SmartDashboardPacketFactory",
".",
"getUpdateLength",
"(",
"dataLen",
")",
")",
")",
"return",
"ERROR_BUFFER_FULL",
";",
"dash",
".",
"fieldUpdatePrefix",
"(",
"name",
",",
"dataLen",
")",
";",
"dash",
".",
"m_dataOutput",
".",
"writeInt",
"(",
"value",
")",
";",
"dash",
".",
"periodicallyReannounce",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"return",
"ERROR_BUFFER_FULL",
";",
"}",
"DriverStation",
".",
"getInstance",
"(",
")",
".",
"incrementUpdateNumber",
"(",
")",
";",
"}",
"return",
"retcode",
";",
"}",
"public",
"static",
"int",
"log",
"(",
"long",
"value",
",",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"initialized",
")",
"init",
"(",
")",
";",
"int",
"retcode",
"=",
"SUCCESS",
";",
"SmartDashboard",
"dash",
"=",
"getInstance",
"(",
")",
";",
"synchronized",
"(",
"dash",
".",
"m_monitor",
")",
"{",
"try",
"{",
"if",
"(",
"(",
"retcode",
"=",
"dash",
".",
"announceIfNewField",
"(",
"LONG_TYPE",
",",
"name",
")",
")",
"!=",
"SUCCESS",
")",
"return",
"retcode",
";",
"byte",
"dataLen",
"=",
"8",
";",
"if",
"(",
"dash",
".",
"checkBufferFull",
"(",
"SmartDashboardPacketFactory",
".",
"getUpdateLength",
"(",
"dataLen",
")",
")",
")",
"return",
"ERROR_BUFFER_FULL",
";",
"dash",
".",
"fieldUpdatePrefix",
"(",
"name",
",",
"dataLen",
")",
";",
"dash",
".",
"m_dataOutput",
".",
"writeLong",
"(",
"value",
")",
";",
"dash",
".",
"periodicallyReannounce",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"return",
"ERROR_BUFFER_FULL",
";",
"}",
"DriverStation",
".",
"getInstance",
"(",
")",
".",
"incrementUpdateNumber",
"(",
")",
";",
"}",
"return",
"retcode",
";",
"}",
"public",
"static",
"int",
"log",
"(",
"short",
"value",
",",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"initialized",
")",
"init",
"(",
")",
";",
"int",
"retcode",
"=",
"SUCCESS",
";",
"SmartDashboard",
"dash",
"=",
"getInstance",
"(",
")",
";",
"synchronized",
"(",
"dash",
".",
"m_monitor",
")",
"{",
"try",
"{",
"if",
"(",
"(",
"retcode",
"=",
"dash",
".",
"announceIfNewField",
"(",
"SHORT_TYPE",
",",
"name",
")",
")",
"!=",
"SUCCESS",
")",
"return",
"retcode",
";",
"byte",
"dataLen",
"=",
"2",
";",
"if",
"(",
"dash",
".",
"checkBufferFull",
"(",
"SmartDashboardPacketFactory",
".",
"getUpdateLength",
"(",
"dataLen",
")",
")",
")",
"return",
"ERROR_BUFFER_FULL",
";",
"dash",
".",
"fieldUpdatePrefix",
"(",
"name",
",",
"dataLen",
")",
";",
"dash",
".",
"m_dataOutput",
".",
"writeShort",
"(",
"value",
")",
";",
"dash",
".",
"periodicallyReannounce",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"return",
"ERROR_BUFFER_FULL",
";",
"}",
"DriverStation",
".",
"getInstance",
"(",
")",
".",
"incrementUpdateNumber",
"(",
")",
";",
"}",
"return",
"retcode",
";",
"}",
"public",
"static",
"int",
"log",
"(",
"float",
"value",
",",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"initialized",
")",
"init",
"(",
")",
";",
"int",
"retcode",
"=",
"SUCCESS",
";",
"SmartDashboard",
"dash",
"=",
"getInstance",
"(",
")",
";",
"synchronized",
"(",
"dash",
".",
"m_monitor",
")",
"{",
"try",
"{",
"if",
"(",
"(",
"dash",
".",
"announceIfNewField",
"(",
"FLOAT_TYPE",
",",
"name",
")",
")",
"!=",
"SUCCESS",
")",
"return",
"retcode",
";",
"byte",
"dataLen",
"=",
"4",
";",
"if",
"(",
"dash",
".",
"checkBufferFull",
"(",
"SmartDashboardPacketFactory",
".",
"getUpdateLength",
"(",
"dataLen",
")",
")",
")",
"return",
"ERROR_BUFFER_FULL",
";",
"dash",
".",
"fieldUpdatePrefix",
"(",
"name",
",",
"dataLen",
")",
";",
"dash",
".",
"m_dataOutput",
".",
"writeFloat",
"(",
"value",
")",
";",
"dash",
".",
"periodicallyReannounce",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"return",
"ERROR_BUFFER_FULL",
";",
"}",
"DriverStation",
".",
"getInstance",
"(",
")",
".",
"incrementUpdateNumber",
"(",
")",
";",
"}",
"return",
"retcode",
";",
"}",
"public",
"static",
"int",
"log",
"(",
"double",
"value",
",",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"initialized",
")",
"init",
"(",
")",
";",
"int",
"retcode",
"=",
"SUCCESS",
";",
"SmartDashboard",
"dash",
"=",
"getInstance",
"(",
")",
";",
"synchronized",
"(",
"dash",
".",
"m_monitor",
")",
"{",
"try",
"{",
"if",
"(",
"(",
"retcode",
"=",
"dash",
".",
"announceIfNewField",
"(",
"DOUBLE_TYPE",
",",
"name",
")",
")",
"!=",
"SUCCESS",
")",
"return",
"retcode",
";",
"byte",
"dataLen",
"=",
"8",
";",
"if",
"(",
"dash",
".",
"checkBufferFull",
"(",
"SmartDashboardPacketFactory",
".",
"getUpdateLength",
"(",
"dataLen",
")",
")",
")",
"return",
"ERROR_BUFFER_FULL",
";",
"dash",
".",
"fieldUpdatePrefix",
"(",
"name",
",",
"dataLen",
")",
";",
"dash",
".",
"m_dataOutput",
".",
"writeDouble",
"(",
"value",
")",
";",
"dash",
".",
"periodicallyReannounce",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"return",
"ERROR_BUFFER_FULL",
";",
"}",
"DriverStation",
".",
"getInstance",
"(",
")",
".",
"incrementUpdateNumber",
"(",
")",
";",
"}",
"return",
"retcode",
";",
"}",
"static",
"int",
"utfLength",
"(",
"String",
"s",
")",
"{",
"int",
"sLength",
"=",
"s",
".",
"length",
"(",
")",
";",
"int",
"utfLength",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"sLength",
";",
"++",
"i",
")",
"{",
"char",
"c",
"=",
"s",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"c",
"==",
"0",
"||",
"c",
">=",
"0x80",
")",
"++",
"utfLength",
";",
"++",
"utfLength",
";",
"}",
"return",
"utfLength",
";",
"}",
"public",
"static",
"int",
"log",
"(",
"String",
"value",
",",
"String",
"name",
")",
"{",
"int",
"dataLen",
"=",
"utfLength",
"(",
"value",
")",
"+",
"2",
";",
"if",
"(",
"dataLen",
">",
"127",
")",
"return",
"ERROR_STRING_TOO_LONG",
";",
"if",
"(",
"!",
"initialized",
")",
"init",
"(",
")",
";",
"int",
"retcode",
"=",
"SUCCESS",
";",
"SmartDashboard",
"dash",
"=",
"getInstance",
"(",
")",
";",
"synchronized",
"(",
"dash",
".",
"m_monitor",
")",
"{",
"try",
"{",
"if",
"(",
"(",
"retcode",
"=",
"dash",
".",
"announceIfNewField",
"(",
"STRING_UTF8_TYPE",
",",
"name",
")",
")",
"!=",
"SUCCESS",
")",
"return",
"retcode",
";",
"if",
"(",
"dash",
".",
"checkBufferFull",
"(",
"SmartDashboardPacketFactory",
".",
"getUpdateLength",
"(",
"(",
"byte",
")",
"dataLen",
")",
")",
")",
"return",
"ERROR_BUFFER_FULL",
";",
"dash",
".",
"fieldUpdatePrefix",
"(",
"name",
",",
"(",
"byte",
")",
"dataLen",
")",
";",
"dash",
".",
"m_dataOutput",
".",
"writeUTF",
"(",
"value",
")",
";",
"dash",
".",
"periodicallyReannounce",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"return",
"ERROR_BUFFER_FULL",
";",
"}",
"DriverStation",
".",
"getInstance",
"(",
")",
".",
"incrementUpdateNumber",
"(",
")",
";",
"}",
"return",
"retcode",
";",
"}",
"public",
"static",
"int",
"log",
"(",
"boolean",
"value",
",",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"initialized",
")",
"init",
"(",
")",
";",
"int",
"retcode",
"=",
"SUCCESS",
";",
"SmartDashboard",
"dash",
"=",
"getInstance",
"(",
")",
";",
"synchronized",
"(",
"dash",
".",
"m_monitor",
")",
"{",
"try",
"{",
"if",
"(",
"(",
"retcode",
"=",
"dash",
".",
"announceIfNewField",
"(",
"BOOL_TYPE",
",",
"name",
")",
")",
"!=",
"SUCCESS",
")",
"return",
"retcode",
";",
"byte",
"dataLen",
"=",
"1",
";",
"if",
"(",
"dash",
".",
"checkBufferFull",
"(",
"SmartDashboardPacketFactory",
".",
"getUpdateLength",
"(",
"dataLen",
")",
")",
")",
"return",
"ERROR_BUFFER_FULL",
";",
"dash",
".",
"fieldUpdatePrefix",
"(",
"name",
",",
"dataLen",
")",
";",
"dash",
".",
"m_dataOutput",
".",
"writeBoolean",
"(",
"value",
")",
";",
"dash",
".",
"periodicallyReannounce",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"return",
"ERROR_BUFFER_FULL",
";",
"}",
"DriverStation",
".",
"getInstance",
"(",
")",
".",
"incrementUpdateNumber",
"(",
")",
";",
"}",
"return",
"retcode",
";",
"}",
"public",
"static",
"int",
"useProfile",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"initialized",
")",
"init",
"(",
")",
";",
"synchronized",
"(",
"getInstance",
"(",
")",
".",
"m_monitor",
")",
"{",
"try",
"{",
"if",
"(",
"getInstance",
"(",
")",
".",
"checkBufferFull",
"(",
"SmartDashboardPacketFactory",
".",
"getAnnounceProfileLength",
"(",
"name",
")",
")",
")",
"return",
"ERROR_BUFFER_FULL",
";",
"SmartDashboardPacketFactory",
".",
"announceProfile",
"(",
"getInstance",
"(",
")",
".",
"m_dataOutput",
",",
"name",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"return",
"ERROR_BUFFER_FULL",
";",
"}",
"}",
"return",
"SUCCESS",
";",
"}",
"public",
"static",
"String",
"diagnoseErrorCode",
"(",
"int",
"code",
")",
"{",
"switch",
"(",
"code",
")",
"{",
"case",
"SUCCESS",
":",
"return",
"\"\"",
";",
"case",
"ERROR_BUFFER_FULL",
":",
"return",
"\"\"",
"+",
"\"\"",
";",
"case",
"ERROR_TOO_MANY_FIELDS",
":",
"return",
"\"\"",
"+",
"\"\"",
"+",
"MAX_FIELDS",
"+",
"\".\"",
";",
"case",
"ERROR_TYPE_MISMATCH",
":",
"return",
"\"\"",
"+",
"\"\"",
"+",
"\"\"",
";",
"default",
":",
"return",
"\"\"",
"+",
"code",
";",
"}",
"}",
"public",
"static",
"void",
"useBlockingIO",
"(",
"boolean",
"value",
")",
"{",
"getInstance",
"(",
")",
".",
"m_blockingIO",
"=",
"value",
";",
"}",
"private",
"int",
"announceIfNewField",
"(",
"byte",
"type",
",",
"String",
"name",
")",
"throws",
"IOException",
"{",
"if",
"(",
"checkBufferFull",
"(",
"SmartDashboardPacketFactory",
".",
"getAnnounceLength",
"(",
"name",
")",
")",
")",
"return",
"ERROR_BUFFER_FULL",
";",
"if",
"(",
"!",
"field_ids",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"if",
"(",
"field_ids",
".",
"size",
"(",
")",
">=",
"MAX_FIELDS",
")",
"return",
"ERROR_TOO_MANY_FIELDS",
";",
"field_ids",
".",
"put",
"(",
"name",
",",
"new",
"Byte",
"(",
"(",
"byte",
")",
"field_ids",
".",
"size",
"(",
")",
")",
")",
";",
"field_types",
".",
"put",
"(",
"name",
",",
"new",
"Byte",
"(",
"type",
")",
")",
";",
"SmartDashboardPacketFactory",
".",
"announce",
"(",
"m_dataOutput",
",",
"name",
",",
"type",
",",
"(",
"(",
"Byte",
")",
"field_ids",
".",
"get",
"(",
"name",
")",
")",
".",
"byteValue",
"(",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"(",
"(",
"Byte",
")",
"field_types",
".",
"get",
"(",
"name",
")",
")",
".",
"byteValue",
"(",
")",
"!=",
"type",
")",
"{",
"return",
"ERROR_TYPE_MISMATCH",
";",
"}",
"}",
"return",
"SUCCESS",
";",
"}",
"private",
"void",
"periodicallyReannounce",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"Timer",
".",
"getMsClock",
"(",
")",
">=",
"m_nextReannouncementTime",
")",
"{",
"Enumeration",
"e",
"=",
"field_ids",
".",
"keys",
"(",
")",
";",
"while",
"(",
"e",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"String",
"name",
"=",
"(",
"String",
")",
"e",
".",
"nextElement",
"(",
")",
";",
"byte",
"id",
"=",
"(",
"(",
"Byte",
")",
"field_ids",
".",
"get",
"(",
"name",
")",
")",
".",
"byteValue",
"(",
")",
";",
"byte",
"type",
"=",
"(",
"(",
"Byte",
")",
"field_types",
".",
"get",
"(",
"name",
")",
")",
".",
"byteValue",
"(",
")",
";",
"if",
"(",
"!",
"checkBufferFull",
"(",
"SmartDashboardPacketFactory",
".",
"getAnnounceLength",
"(",
"name",
")",
")",
")",
"SmartDashboardPacketFactory",
".",
"announce",
"(",
"m_dataOutput",
",",
"name",
",",
"type",
",",
"id",
")",
";",
"}",
"m_nextReannouncementTime",
"+=",
"REANNOUNCEMENT_INTERVAL_MS",
";",
"}",
"}",
"private",
"void",
"fieldUpdatePrefix",
"(",
"String",
"name",
",",
"byte",
"len",
")",
"throws",
"IOException",
"{",
"SmartDashboardPacketFactory",
".",
"updatePrefix",
"(",
"m_dataOutput",
",",
"(",
"(",
"Byte",
")",
"field_ids",
".",
"get",
"(",
"name",
")",
")",
".",
"byteValue",
"(",
")",
",",
"len",
")",
";",
"}",
"private",
"boolean",
"checkBufferFull",
"(",
"int",
"requestedBytes",
")",
"{",
"synchronized",
"(",
"m_monitor",
")",
"{",
"while",
"(",
"(",
"m_byteBuffer",
".",
"size",
"(",
")",
"+",
"requestedBytes",
")",
">",
"BUFFER_SIZE",
")",
"{",
"if",
"(",
"!",
"m_blockingIO",
")",
"return",
"true",
";",
"try",
"{",
"m_monitor",
".",
"wait",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"}",
"}",
"}",
"return",
"false",
";",
"}",
"private",
"static",
"SmartDashboard",
"getInstance",
"(",
")",
"{",
"return",
"instance",
";",
"}",
"public",
"byte",
"[",
"]",
"getBytes",
"(",
")",
"{",
"synchronized",
"(",
"m_monitor",
")",
"{",
"return",
"m_byteBuffer",
".",
"toByteArray",
"(",
")",
";",
"}",
"}",
"public",
"int",
"getBytesLength",
"(",
")",
"{",
"synchronized",
"(",
"m_monitor",
")",
"{",
"return",
"m_byteBuffer",
".",
"size",
"(",
")",
";",
"}",
"}",
"public",
"void",
"flush",
"(",
")",
"{",
"synchronized",
"(",
"m_monitor",
")",
"{",
"m_byteBuffer",
".",
"reset",
"(",
")",
";",
"m_monitor",
".",
"notifyAll",
"(",
")",
";",
"}",
"}",
"}",
"</s>"
] |
7,456 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"java",
".",
"io",
".",
"DataOutputStream",
";",
"import",
"java",
".",
"io",
".",
"IOException",
";",
"import",
"java",
".",
"io",
".",
"OutputStream",
";",
"public",
"class",
"SmartDashboardPacketFactory",
"{",
"private",
"static",
"final",
"byte",
"ANNOUNCE_TYPE",
"=",
"0",
";",
"private",
"static",
"final",
"byte",
"UPDATE_TYPE",
"=",
"1",
";",
"private",
"static",
"final",
"byte",
"ANNOUNCE_PROFILE_TYPE",
"=",
"2",
";",
"public",
"static",
"void",
"announce",
"(",
"DataOutputStream",
"s",
",",
"String",
"name",
",",
"byte",
"type",
",",
"byte",
"id",
")",
"throws",
"IOException",
"{",
"s",
".",
"writeByte",
"(",
"ANNOUNCE_TYPE",
")",
";",
"s",
".",
"writeByte",
"(",
"id",
")",
";",
"s",
".",
"writeByte",
"(",
"type",
")",
";",
"s",
".",
"writeUTF",
"(",
"name",
")",
";",
"}",
"public",
"static",
"int",
"getAnnounceLength",
"(",
"String",
"name",
")",
"{",
"return",
"5",
"+",
"SmartDashboard",
".",
"utfLength",
"(",
"name",
")",
";",
"}",
"public",
"static",
"void",
"updatePrefix",
"(",
"DataOutputStream",
"s",
",",
"byte",
"id",
",",
"byte",
"length",
")",
"throws",
"IOException",
"{",
"s",
".",
"writeByte",
"(",
"UPDATE_TYPE",
")",
";",
"s",
".",
"writeByte",
"(",
"id",
")",
";",
"s",
".",
"writeByte",
"(",
"length",
")",
";",
"}",
"public",
"static",
"int",
"getUpdateLength",
"(",
"int",
"dataLen",
")",
"{",
"return",
"3",
"+",
"dataLen",
";",
"}",
"public",
"static",
"void",
"announceProfile",
"(",
"DataOutputStream",
"s",
",",
"String",
"name",
")",
"throws",
"IOException",
"{",
"s",
".",
"writeByte",
"(",
"ANNOUNCE_PROFILE_TYPE",
")",
";",
"s",
".",
"writeUTF",
"(",
"name",
")",
";",
"}",
"public",
"static",
"int",
"getAnnounceProfileLength",
"(",
"String",
"name",
")",
"{",
"return",
"3",
"+",
"SmartDashboard",
".",
"utfLength",
"(",
"name",
")",
";",
"}",
"}",
"</s>"
] |
7,457 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
".",
"tCounter",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"AllocationException",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"CheckedAllocationException",
";",
"public",
"class",
"Counter",
"extends",
"SensorBase",
"implements",
"CounterBase",
"{",
"public",
"static",
"class",
"Mode",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"int",
"kTwoPulse_val",
"=",
"0",
";",
"static",
"final",
"int",
"kSemiperiod_val",
"=",
"1",
";",
"static",
"final",
"int",
"kPulseLength_val",
"=",
"2",
";",
"static",
"final",
"int",
"kExternalDirection_val",
"=",
"3",
";",
"public",
"static",
"final",
"Mode",
"kTwoPulse",
"=",
"new",
"Mode",
"(",
"kTwoPulse_val",
")",
";",
"public",
"static",
"final",
"Mode",
"kSemiperiod",
"=",
"new",
"Mode",
"(",
"kSemiperiod_val",
")",
";",
"public",
"static",
"final",
"Mode",
"kPulseLength",
"=",
"new",
"Mode",
"(",
"kPulseLength_val",
")",
";",
"public",
"static",
"final",
"Mode",
"kExternalDirection",
"=",
"new",
"Mode",
"(",
"kExternalDirection_val",
")",
";",
"private",
"Mode",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"private",
"DigitalSource",
"m_upSource",
";",
"private",
"DigitalSource",
"m_downSource",
";",
"private",
"boolean",
"m_allocatedUpSource",
";",
"private",
"boolean",
"m_allocatedDownSource",
";",
"private",
"tCounter",
"m_counter",
";",
"private",
"int",
"m_index",
";",
"private",
"static",
"Resource",
"counters",
"=",
"new",
"Resource",
"(",
"tCounter",
".",
"kNumSystems",
")",
";",
"private",
"void",
"initCounter",
"(",
"final",
"Mode",
"mode",
")",
"{",
"m_allocatedUpSource",
"=",
"false",
";",
"m_allocatedDownSource",
"=",
"false",
";",
"try",
"{",
"m_index",
"=",
"counters",
".",
"allocate",
"(",
")",
";",
"}",
"catch",
"(",
"CheckedAllocationException",
"e",
")",
"{",
"throw",
"new",
"AllocationException",
"(",
"\"\"",
")",
";",
"}",
"m_counter",
"=",
"new",
"tCounter",
"(",
"m_index",
")",
";",
"m_counter",
".",
"writeConfig_Mode",
"(",
"mode",
".",
"value",
")",
";",
"m_upSource",
"=",
"null",
";",
"m_downSource",
"=",
"null",
";",
"m_counter",
".",
"writeTimerConfig_AverageSize",
"(",
"1",
")",
";",
"}",
"public",
"Counter",
"(",
")",
"{",
"initCounter",
"(",
"Mode",
".",
"kTwoPulse",
")",
";",
"}",
"public",
"Counter",
"(",
"DigitalSource",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"initCounter",
"(",
"Mode",
".",
"kTwoPulse",
")",
";",
"setUpSource",
"(",
"source",
")",
";",
"}",
"public",
"Counter",
"(",
"int",
"channel",
")",
"{",
"initCounter",
"(",
"Mode",
".",
"kTwoPulse",
")",
";",
"setUpSource",
"(",
"channel",
")",
";",
"}",
"public",
"Counter",
"(",
"int",
"slot",
",",
"int",
"channel",
")",
"{",
"initCounter",
"(",
"Mode",
".",
"kTwoPulse",
")",
";",
"setUpSource",
"(",
"slot",
",",
"channel",
")",
";",
"}",
"public",
"Counter",
"(",
"EncodingType",
"encodingType",
",",
"DigitalSource",
"upSource",
",",
"DigitalSource",
"downSource",
",",
"boolean",
"inverted",
")",
"{",
"initCounter",
"(",
"Mode",
".",
"kExternalDirection",
")",
";",
"if",
"(",
"upSource",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"setUpSource",
"(",
"upSource",
")",
";",
"if",
"(",
"downSource",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"setDownSource",
"(",
"downSource",
")",
";",
"if",
"(",
"encodingType",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"if",
"(",
"encodingType",
"==",
"EncodingType",
".",
"k1X",
")",
"{",
"setUpSourceEdge",
"(",
"true",
",",
"false",
")",
";",
"}",
"else",
"{",
"setUpSourceEdge",
"(",
"true",
",",
"true",
")",
";",
"}",
"setDownSourceEdge",
"(",
"inverted",
",",
"true",
")",
";",
"}",
"public",
"Counter",
"(",
"AnalogTrigger",
"trigger",
")",
"{",
"initCounter",
"(",
"Mode",
".",
"kTwoPulse",
")",
";",
"setUpSource",
"(",
"trigger",
".",
"createOutput",
"(",
"AnalogTriggerOutput",
".",
"Type",
".",
"kTypeState",
")",
")",
";",
"}",
"protected",
"void",
"free",
"(",
")",
"{",
"setUpdateWhenEmpty",
"(",
"true",
")",
";",
"clearUpSource",
"(",
")",
";",
"clearDownSource",
"(",
")",
";",
"m_counter",
".",
"Release",
"(",
")",
";",
"m_upSource",
"=",
"null",
";",
"m_downSource",
"=",
"null",
";",
"m_counter",
"=",
"null",
";",
"counters",
".",
"free",
"(",
"m_index",
")",
";",
"}",
"public",
"void",
"setUpSource",
"(",
"int",
"slot",
",",
"int",
"channel",
")",
"{",
"m_allocatedUpSource",
"=",
"true",
";",
"setUpSource",
"(",
"new",
"DigitalInput",
"(",
"slot",
",",
"channel",
")",
")",
";",
"}",
"public",
"void",
"setUpSource",
"(",
"int",
"channel",
")",
"{",
"m_allocatedUpSource",
"=",
"true",
";",
"setUpSource",
"(",
"new",
"DigitalInput",
"(",
"channel",
")",
")",
";",
"}",
"public",
"void",
"setUpSource",
"(",
"DigitalSource",
"source",
")",
"{",
"m_upSource",
"=",
"source",
";",
"m_counter",
".",
"writeConfig_UpSource_Module",
"(",
"source",
".",
"getModuleForRouting",
"(",
")",
")",
";",
"m_counter",
".",
"writeConfig_UpSource_Channel",
"(",
"source",
".",
"getChannelForRouting",
"(",
")",
")",
";",
"m_counter",
".",
"writeConfig_UpSource_AnalogTrigger",
"(",
"source",
".",
"getAnalogTriggerForRouting",
"(",
")",
")",
";",
"if",
"(",
"m_counter",
".",
"readConfig_Mode",
"(",
")",
"==",
"Mode",
".",
"kTwoPulse",
".",
"value",
"||",
"m_counter",
".",
"readConfig_Mode",
"(",
")",
"==",
"Mode",
".",
"kExternalDirection",
".",
"value",
")",
"{",
"setUpSourceEdge",
"(",
"true",
",",
"false",
")",
";",
"}",
"m_counter",
".",
"strobeReset",
"(",
")",
";",
"}",
"public",
"void",
"setUpSource",
"(",
"AnalogTrigger",
"analogTrigger",
",",
"AnalogTriggerOutput",
".",
"Type",
"triggerType",
")",
"{",
"m_allocatedUpSource",
"=",
"true",
";",
"setUpSource",
"(",
"analogTrigger",
".",
"createOutput",
"(",
"triggerType",
")",
")",
";",
"}",
"public",
"void",
"setUpSourceEdge",
"(",
"boolean",
"risingEdge",
",",
"boolean",
"fallingEdge",
")",
"{",
"m_counter",
".",
"writeConfig_UpRisingEdge",
"(",
"risingEdge",
")",
";",
"m_counter",
".",
"writeConfig_UpFallingEdge",
"(",
"fallingEdge",
")",
";",
"}",
"public",
"void",
"clearUpSource",
"(",
")",
"{",
"if",
"(",
"m_upSource",
"!=",
"null",
"&&",
"m_allocatedUpSource",
")",
"{",
"m_upSource",
".",
"free",
"(",
")",
";",
"}",
"m_upSource",
"=",
"null",
";",
"boolean",
"state",
"=",
"m_counter",
".",
"readConfig_Enable",
"(",
")",
";",
"m_counter",
".",
"writeConfig_Enable",
"(",
"false",
")",
";",
"m_counter",
".",
"writeConfig_UpFallingEdge",
"(",
"false",
")",
";",
"m_counter",
".",
"writeConfig_UpRisingEdge",
"(",
"false",
")",
";",
"m_counter",
".",
"writeConfig_UpSource_Channel",
"(",
"0",
")",
";",
"m_counter",
".",
"writeConfig_UpSource_AnalogTrigger",
"(",
"false",
")",
";",
"m_counter",
".",
"writeConfig_Enable",
"(",
"state",
")",
";",
"}",
"public",
"void",
"setDownSource",
"(",
"int",
"channel",
")",
"{",
"m_allocatedDownSource",
"=",
"true",
";",
"setDownSource",
"(",
"new",
"DigitalInput",
"(",
"channel",
")",
")",
";",
"}",
"public",
"void",
"setDownSource",
"(",
"int",
"slot",
",",
"int",
"channel",
")",
"{",
"m_allocatedDownSource",
"=",
"true",
";",
"setDownSource",
"(",
"new",
"DigitalInput",
"(",
"slot",
",",
"channel",
")",
")",
";",
"}",
"public",
"void",
"setDownSource",
"(",
"DigitalSource",
"source",
")",
"{",
"int",
"mode",
"=",
"m_counter",
".",
"readConfig_Mode",
"(",
")",
";",
"m_downSource",
"=",
"source",
";",
"m_counter",
".",
"writeConfig_DownSource_Module",
"(",
"source",
".",
"getModuleForRouting",
"(",
")",
")",
";",
"m_counter",
".",
"writeConfig_DownSource_Channel",
"(",
"source",
".",
"getChannelForRouting",
"(",
")",
")",
";",
"m_counter",
".",
"writeConfig_DownSource_AnalogTrigger",
"(",
"source",
".",
"getAnalogTriggerForRouting",
"(",
")",
")",
";",
"setDownSourceEdge",
"(",
"true",
",",
"false",
")",
";",
"m_counter",
".",
"strobeReset",
"(",
")",
";",
"}",
"public",
"void",
"setDownSource",
"(",
"AnalogTrigger",
"analogTrigger",
",",
"AnalogTriggerOutput",
".",
"Type",
"triggerType",
")",
"{",
"m_allocatedDownSource",
"=",
"true",
";",
"setDownSource",
"(",
"analogTrigger",
".",
"createOutput",
"(",
"triggerType",
")",
")",
";",
"}",
"public",
"void",
"setDownSourceEdge",
"(",
"boolean",
"risingEdge",
",",
"boolean",
"fallingEdge",
")",
"{",
"m_counter",
".",
"writeConfig_DownRisingEdge",
"(",
"risingEdge",
")",
";",
"m_counter",
".",
"writeConfig_DownFallingEdge",
"(",
"fallingEdge",
")",
";",
"}",
"public",
"void",
"clearDownSource",
"(",
")",
"{",
"if",
"(",
"m_downSource",
"!=",
"null",
"&&",
"m_allocatedDownSource",
")",
"{",
"m_downSource",
".",
"free",
"(",
")",
";",
"}",
"m_downSource",
"=",
"null",
";",
"boolean",
"state",
"=",
"m_counter",
".",
"readConfig_Enable",
"(",
")",
";",
"m_counter",
".",
"writeConfig_Enable",
"(",
"false",
")",
";",
"m_counter",
".",
"writeConfig_DownFallingEdge",
"(",
"false",
")",
";",
"m_counter",
".",
"writeConfig_DownRisingEdge",
"(",
"false",
")",
";",
"m_counter",
".",
"writeConfig_DownSource_Channel",
"(",
"0",
")",
";",
"m_counter",
".",
"writeConfig_DownSource_AnalogTrigger",
"(",
"false",
")",
";",
"m_counter",
".",
"writeConfig_Enable",
"(",
"state",
")",
";",
"}",
"public",
"void",
"setUpDownCounterMode",
"(",
")",
"{",
"m_counter",
".",
"writeConfig_Mode",
"(",
"Mode",
".",
"kTwoPulse",
".",
"value",
")",
";",
"}",
"public",
"void",
"setExternalDirectionMode",
"(",
")",
"{",
"m_counter",
".",
"writeConfig_Mode",
"(",
"Mode",
".",
"kExternalDirection",
".",
"value",
")",
";",
"}",
"public",
"void",
"setSemiPeriodMode",
"(",
"boolean",
"highSemiPeriod",
")",
"{",
"m_counter",
".",
"writeConfig_Mode",
"(",
"Mode",
".",
"kSemiperiod",
".",
"value",
")",
";",
"m_counter",
".",
"writeConfig_UpRisingEdge",
"(",
"highSemiPeriod",
")",
";",
"setUpdateWhenEmpty",
"(",
"false",
")",
";",
"}",
"public",
"void",
"setPulseLengthMode",
"(",
"double",
"threshold",
")",
"{",
"m_counter",
".",
"writeConfig_Mode",
"(",
"Mode",
".",
"kPulseLength",
".",
"value",
")",
";",
"m_counter",
".",
"writeConfig_PulseLengthThreshold",
"(",
"(",
"short",
")",
"(",
"(",
"threshold",
"*",
"1.0e6",
")",
"*",
"kSystemClockTicksPerMicrosecond",
")",
")",
";",
"}",
"public",
"void",
"start",
"(",
")",
"{",
"m_counter",
".",
"writeConfig_Enable",
"(",
"true",
")",
";",
"}",
"public",
"int",
"get",
"(",
")",
"{",
"return",
"m_counter",
".",
"readOutput_Value",
"(",
")",
";",
"}",
"public",
"void",
"reset",
"(",
")",
"{",
"m_counter",
".",
"strobeReset",
"(",
")",
";",
"}",
"public",
"void",
"stop",
"(",
")",
"{",
"m_counter",
".",
"writeConfig_Enable",
"(",
"false",
")",
";",
"}",
"public",
"void",
"setMaxPeriod",
"(",
"double",
"maxPeriod",
")",
"{",
"m_counter",
".",
"writeTimerConfig_StallPeriod",
"(",
"(",
"int",
")",
"(",
"maxPeriod",
"*",
"1.0e6",
")",
")",
";",
"}",
"public",
"void",
"setUpdateWhenEmpty",
"(",
"boolean",
"enabled",
")",
"{",
"m_counter",
".",
"writeTimerConfig_UpdateWhenEmpty",
"(",
"enabled",
")",
";",
"}",
"public",
"boolean",
"getStopped",
"(",
")",
"{",
"return",
"m_counter",
".",
"readTimerOutput_Stalled",
"(",
")",
";",
"}",
"public",
"boolean",
"getDirection",
"(",
")",
"{",
"boolean",
"value",
"=",
"m_counter",
".",
"readOutput_Direction",
"(",
")",
";",
"return",
"value",
";",
"}",
"public",
"void",
"setReverseDirection",
"(",
"boolean",
"reverseDirection",
")",
"{",
"if",
"(",
"m_counter",
".",
"readConfig_Mode",
"(",
")",
"==",
"Mode",
".",
"kExternalDirection",
".",
"value",
")",
"{",
"if",
"(",
"reverseDirection",
")",
"{",
"setDownSourceEdge",
"(",
"true",
",",
"true",
")",
";",
"}",
"else",
"{",
"setDownSourceEdge",
"(",
"false",
",",
"true",
")",
";",
"}",
"}",
"}",
"public",
"double",
"getPeriod",
"(",
")",
"{",
"double",
"period",
";",
"if",
"(",
"m_counter",
".",
"readTimerOutput_Stalled",
"(",
")",
")",
"{",
"return",
"Double",
".",
"POSITIVE_INFINITY",
";",
"}",
"else",
"{",
"period",
"=",
"(",
"double",
")",
"m_counter",
".",
"readTimerOutput_Period",
"(",
")",
"/",
"(",
"double",
")",
"m_counter",
".",
"readTimerOutput_Count",
"(",
")",
";",
"}",
"return",
"period",
"/",
"1.0e6",
";",
"}",
"}",
"</s>"
] |
7,458 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"BoundaryException",
";",
"public",
"class",
"I2C",
"extends",
"SensorBase",
"{",
"private",
"DigitalModule",
"m_module",
";",
"private",
"int",
"m_deviceAddress",
";",
"private",
"boolean",
"m_compatibilityMode",
";",
"public",
"I2C",
"(",
"DigitalModule",
"module",
",",
"int",
"deviceAddress",
")",
"{",
"if",
"(",
"module",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"}",
"m_module",
"=",
"module",
";",
"m_deviceAddress",
"=",
"deviceAddress",
";",
"m_compatibilityMode",
"=",
"false",
";",
"}",
"protected",
"void",
"free",
"(",
")",
"{",
"}",
"public",
"synchronized",
"boolean",
"transaction",
"(",
"byte",
"[",
"]",
"dataToSend",
",",
"int",
"sendSize",
",",
"byte",
"[",
"]",
"dataReceived",
",",
"int",
"receiveSize",
")",
"{",
"BoundaryException",
".",
"assertWithinBounds",
"(",
"sendSize",
",",
"0",
",",
"6",
")",
";",
"BoundaryException",
".",
"assertWithinBounds",
"(",
"receiveSize",
",",
"0",
",",
"7",
")",
";",
"long",
"data",
"=",
"0",
";",
"long",
"dataHigh",
"=",
"0",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"sendSize",
"&&",
"i",
"<",
"4",
";",
"i",
"++",
")",
"{",
"data",
"|=",
"(",
"long",
")",
"dataToSend",
"[",
"i",
"]",
"<<",
"(",
"8",
"*",
"i",
")",
";",
"}",
"for",
"(",
";",
"i",
"<",
"sendSize",
";",
"i",
"++",
")",
"{",
"dataHigh",
"|=",
"(",
"long",
")",
"dataToSend",
"[",
"i",
"]",
"<<",
"(",
"8",
"*",
"(",
"i",
"-",
"4",
")",
")",
";",
"}",
"boolean",
"aborted",
"=",
"true",
";",
"m_module",
".",
"m_fpgaDIO",
".",
"writeI2CConfig_Address",
"(",
"m_deviceAddress",
")",
";",
"m_module",
".",
"m_fpgaDIO",
".",
"writeI2CConfig_BytesToWrite",
"(",
"sendSize",
")",
";",
"m_module",
".",
"m_fpgaDIO",
".",
"writeI2CConfig_BytesToRead",
"(",
"receiveSize",
")",
";",
"if",
"(",
"sendSize",
">",
"0",
")",
"{",
"m_module",
".",
"m_fpgaDIO",
".",
"writeI2CDataToSend",
"(",
"data",
")",
";",
"}",
"if",
"(",
"sendSize",
">",
"4",
")",
"{",
"m_module",
".",
"m_fpgaDIO",
".",
"writeI2CConfig_DataToSendHigh",
"(",
"(",
"int",
")",
"dataHigh",
")",
";",
"}",
"m_module",
".",
"m_fpgaDIO",
".",
"writeI2CConfig_BitwiseHandshake",
"(",
"m_compatibilityMode",
")",
";",
"byte",
"transaction",
"=",
"m_module",
".",
"m_fpgaDIO",
".",
"readI2CStatus_Transaction",
"(",
")",
";",
"m_module",
".",
"m_fpgaDIO",
".",
"strobeI2CStart",
"(",
")",
";",
"while",
"(",
"transaction",
"==",
"m_module",
".",
"m_fpgaDIO",
".",
"readI2CStatus_Transaction",
"(",
")",
")",
"{",
"Timer",
".",
"delay",
"(",
".001",
")",
";",
"}",
"while",
"(",
"!",
"m_module",
".",
"m_fpgaDIO",
".",
"readI2CStatus_Done",
"(",
")",
")",
"{",
"Timer",
".",
"delay",
"(",
".001",
")",
";",
"}",
"aborted",
"=",
"m_module",
".",
"m_fpgaDIO",
".",
"readI2CStatus_Aborted",
"(",
")",
";",
"if",
"(",
"receiveSize",
">",
"0",
")",
"{",
"data",
"=",
"m_module",
".",
"m_fpgaDIO",
".",
"readI2CDataReceived",
"(",
")",
";",
"}",
"if",
"(",
"receiveSize",
">",
"4",
")",
"{",
"dataHigh",
"=",
"m_module",
".",
"m_fpgaDIO",
".",
"readI2CStatus_DataReceivedHigh",
"(",
")",
";",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"receiveSize",
"&&",
"i",
"<",
"4",
";",
"i",
"++",
")",
"{",
"dataReceived",
"[",
"i",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"data",
">>",
"(",
"8",
"*",
"i",
")",
")",
"&",
"0xFF",
")",
";",
"}",
"for",
"(",
";",
"i",
"<",
"receiveSize",
";",
"i",
"++",
")",
"{",
"dataReceived",
"[",
"i",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"dataHigh",
">>",
"(",
"8",
"*",
"(",
"i",
"-",
"4",
")",
")",
")",
"&",
"0xFF",
")",
";",
"}",
"return",
"aborted",
";",
"}",
"public",
"boolean",
"addressOnly",
"(",
")",
"{",
"return",
"transaction",
"(",
"null",
",",
"(",
"byte",
")",
"0",
",",
"null",
",",
"(",
"byte",
")",
"0",
")",
";",
"}",
"public",
"synchronized",
"boolean",
"write",
"(",
"int",
"registerAddress",
",",
"int",
"data",
")",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"2",
"]",
";",
"buffer",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"registerAddress",
";",
"buffer",
"[",
"1",
"]",
"=",
"(",
"byte",
")",
"data",
";",
"return",
"transaction",
"(",
"buffer",
",",
"buffer",
".",
"length",
",",
"null",
",",
"0",
")",
";",
"}",
"public",
"boolean",
"read",
"(",
"int",
"registerAddress",
",",
"int",
"count",
",",
"byte",
"[",
"]",
"buffer",
")",
"{",
"BoundaryException",
".",
"assertWithinBounds",
"(",
"count",
",",
"1",
",",
"7",
")",
";",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"}",
"byte",
"[",
"]",
"registerAddressArray",
"=",
"new",
"byte",
"[",
"1",
"]",
";",
"registerAddressArray",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"registerAddress",
";",
"return",
"transaction",
"(",
"registerAddressArray",
",",
"registerAddressArray",
".",
"length",
",",
"buffer",
",",
"count",
")",
";",
"}",
"public",
"void",
"broadcast",
"(",
"int",
"registerAddress",
",",
"int",
"data",
")",
"{",
"}",
"public",
"void",
"setCompatabilityMode",
"(",
"boolean",
"enable",
")",
"{",
"m_compatibilityMode",
"=",
"enable",
";",
"}",
"public",
"boolean",
"verifySensor",
"(",
"int",
"registerAddress",
",",
"int",
"count",
",",
"byte",
"[",
"]",
"expected",
")",
"{",
"byte",
"[",
"]",
"deviceData",
"=",
"new",
"byte",
"[",
"4",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"curRegisterAddress",
"=",
"registerAddress",
";",
"i",
"<",
"count",
";",
"i",
"+=",
"4",
",",
"curRegisterAddress",
"+=",
"4",
")",
"{",
"int",
"toRead",
"=",
"count",
"-",
"i",
"<",
"4",
"?",
"count",
"-",
"i",
":",
"4",
";",
"if",
"(",
"read",
"(",
"curRegisterAddress",
",",
"toRead",
",",
"deviceData",
")",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"byte",
"j",
"=",
"0",
";",
"j",
"<",
"toRead",
";",
"j",
"++",
")",
"{",
"if",
"(",
"deviceData",
"[",
"j",
"]",
"!=",
"expected",
"[",
"i",
"+",
"j",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"}",
"return",
"true",
";",
"}",
"}",
"</s>"
] |
7,459 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"camera",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"BlockingFunction",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"Function",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"NativeLibrary",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"TaskExecutor",
";",
"import",
"com",
".",
"sun",
".",
"squawk",
".",
"VM",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"image",
".",
"ColorImage",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"image",
".",
"HSLImage",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"image",
".",
"NIVisionException",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"ISensor",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"BoundaryException",
";",
"public",
"class",
"AxisCamera",
"implements",
"ISensor",
"{",
"private",
"static",
"AxisCamera",
"m_instance",
"=",
"null",
";",
"public",
"static",
"class",
"ExposureT",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"ExposureT",
"[",
"]",
"allValues",
"=",
"new",
"ExposureT",
"[",
"4",
"]",
";",
"public",
"static",
"final",
"ExposureT",
"automatic",
"=",
"new",
"ExposureT",
"(",
"0",
")",
";",
"public",
"static",
"final",
"ExposureT",
"hold",
"=",
"new",
"ExposureT",
"(",
"1",
")",
";",
"public",
"static",
"final",
"ExposureT",
"flickerfree50",
"=",
"new",
"ExposureT",
"(",
"2",
")",
";",
"public",
"static",
"final",
"ExposureT",
"flickerfree60",
"=",
"new",
"ExposureT",
"(",
"3",
")",
";",
"private",
"ExposureT",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"allValues",
"[",
"value",
"]",
"=",
"this",
";",
"}",
"private",
"static",
"ExposureT",
"get",
"(",
"int",
"val",
")",
"{",
"return",
"allValues",
"[",
"val",
"]",
";",
"}",
"}",
"public",
"static",
"class",
"WhiteBalanceT",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"WhiteBalanceT",
"[",
"]",
"allValues",
"=",
"new",
"WhiteBalanceT",
"[",
"7",
"]",
";",
"public",
"static",
"final",
"WhiteBalanceT",
"automatic",
"=",
"new",
"WhiteBalanceT",
"(",
"0",
")",
";",
"public",
"static",
"final",
"WhiteBalanceT",
"hold",
"=",
"new",
"WhiteBalanceT",
"(",
"1",
")",
";",
"public",
"static",
"final",
"WhiteBalanceT",
"fixedOutdoor1",
"=",
"new",
"WhiteBalanceT",
"(",
"2",
")",
";",
"public",
"static",
"final",
"WhiteBalanceT",
"fixedOutdoor2",
"=",
"new",
"WhiteBalanceT",
"(",
"3",
")",
";",
"public",
"static",
"final",
"WhiteBalanceT",
"fixedIndoor",
"=",
"new",
"WhiteBalanceT",
"(",
"4",
")",
";",
"public",
"static",
"final",
"WhiteBalanceT",
"fixedFlour1",
"=",
"new",
"WhiteBalanceT",
"(",
"5",
")",
";",
"public",
"static",
"final",
"WhiteBalanceT",
"fixedFlour2",
"=",
"new",
"WhiteBalanceT",
"(",
"6",
")",
";",
"private",
"WhiteBalanceT",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"allValues",
"[",
"value",
"]",
"=",
"this",
";",
"}",
"private",
"static",
"WhiteBalanceT",
"get",
"(",
"int",
"value",
")",
"{",
"return",
"allValues",
"[",
"value",
"]",
";",
"}",
"}",
"public",
"static",
"class",
"ResolutionT",
"{",
"public",
"final",
"int",
"value",
";",
"public",
"final",
"int",
"width",
";",
"public",
"final",
"int",
"height",
";",
"static",
"final",
"ResolutionT",
"[",
"]",
"allValues",
"=",
"new",
"ResolutionT",
"[",
"4",
"]",
";",
"public",
"static",
"final",
"ResolutionT",
"k640x480",
"=",
"new",
"ResolutionT",
"(",
"0",
",",
"640",
",",
"480",
")",
";",
"public",
"static",
"final",
"ResolutionT",
"k640x360",
"=",
"new",
"ResolutionT",
"(",
"1",
",",
"640",
",",
"360",
")",
";",
"public",
"static",
"final",
"ResolutionT",
"k320x240",
"=",
"new",
"ResolutionT",
"(",
"2",
",",
"320",
",",
"240",
")",
";",
"public",
"static",
"final",
"ResolutionT",
"k160x120",
"=",
"new",
"ResolutionT",
"(",
"3",
",",
"160",
",",
"120",
")",
";",
"private",
"ResolutionT",
"(",
"int",
"value",
",",
"int",
"horizontal",
",",
"int",
"vertical",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"this",
".",
"width",
"=",
"horizontal",
";",
"this",
".",
"height",
"=",
"vertical",
";",
"allValues",
"[",
"value",
"]",
"=",
"this",
";",
"}",
"private",
"static",
"ResolutionT",
"get",
"(",
"int",
"value",
")",
"{",
"return",
"allValues",
"[",
"value",
"]",
";",
"}",
"}",
"public",
"static",
"class",
"RotationT",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"RotationT",
"[",
"]",
"allValues",
"=",
"new",
"RotationT",
"[",
"2",
"]",
";",
"public",
"static",
"final",
"RotationT",
"k0",
"=",
"new",
"RotationT",
"(",
"0",
")",
";",
"public",
"static",
"final",
"RotationT",
"k180",
"=",
"new",
"RotationT",
"(",
"1",
")",
";",
"private",
"RotationT",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"allValues",
"[",
"value",
"]",
"=",
"this",
";",
"}",
"private",
"static",
"RotationT",
"get",
"(",
"int",
"value",
")",
"{",
"return",
"allValues",
"[",
"value",
"]",
";",
"}",
"}",
"public",
"static",
"class",
"ExposurePriorityT",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"ExposurePriorityT",
"[",
"]",
"allValues",
"=",
"new",
"ExposurePriorityT",
"[",
"3",
"]",
";",
"public",
"static",
"final",
"ExposurePriorityT",
"imageQuality",
"=",
"new",
"ExposurePriorityT",
"(",
"0",
")",
";",
"public",
"static",
"final",
"ExposurePriorityT",
"none",
"=",
"new",
"ExposurePriorityT",
"(",
"50",
")",
";",
"public",
"static",
"final",
"ExposurePriorityT",
"frameRate",
"=",
"new",
"ExposurePriorityT",
"(",
"100",
")",
";",
"private",
"ExposurePriorityT",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"allValues",
"[",
"value",
"/",
"50",
"]",
"=",
"this",
";",
"}",
"private",
"static",
"ExposurePriorityT",
"get",
"(",
"int",
"value",
")",
"{",
"return",
"allValues",
"[",
"value",
"/",
"50",
"]",
";",
"}",
"}",
"public",
"static",
"synchronized",
"AxisCamera",
"getInstance",
"(",
")",
"{",
"if",
"(",
"m_instance",
"==",
"null",
")",
"{",
"m_instance",
"=",
"new",
"AxisCamera",
"(",
")",
";",
"}",
"return",
"m_instance",
";",
"}",
"private",
"static",
"final",
"Function",
"cameraStartFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"AxisCamera",
"(",
")",
"{",
"cameraStartFn",
".",
"call0",
"(",
")",
";",
"}",
"private",
"static",
"final",
"TaskExecutor",
"cameraTaskExecutor",
"=",
"new",
"TaskExecutor",
"(",
"\"\"",
")",
";",
"private",
"static",
"final",
"BlockingFunction",
"getImageFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getBlockingFunction",
"(",
"\"\"",
")",
";",
"static",
"{",
"getImageFn",
".",
"setTaskExecutor",
"(",
"cameraTaskExecutor",
")",
";",
"}",
"public",
"ColorImage",
"getImage",
"(",
")",
"throws",
"AxisCameraException",
",",
"NIVisionException",
"{",
"ColorImage",
"image",
"=",
"new",
"HSLImage",
"(",
")",
";",
"if",
"(",
"getImageFn",
".",
"call1",
"(",
"image",
".",
"image",
")",
"==",
"0",
")",
"{",
"image",
".",
"free",
"(",
")",
";",
"throw",
"new",
"AxisCameraException",
"(",
"\"\"",
")",
";",
"}",
"return",
"image",
";",
"}",
"private",
"static",
"final",
"Function",
"writeBrightnessFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"void",
"writeBrightness",
"(",
"int",
"brightness",
")",
"{",
"BoundaryException",
".",
"assertWithinBounds",
"(",
"brightness",
",",
"0",
",",
"100",
")",
";",
"writeBrightnessFn",
".",
"call1",
"(",
"brightness",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"getBrightnessFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"int",
"getBrightness",
"(",
")",
"{",
"return",
"getBrightnessFn",
".",
"call0",
"(",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"writeWhiteBalenceFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"void",
"writeWhiteBalance",
"(",
"WhiteBalanceT",
"whiteBalance",
")",
"{",
"writeWhiteBalenceFn",
".",
"call1",
"(",
"whiteBalance",
".",
"value",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"getWhiteBalanceFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"WhiteBalanceT",
"getWhiteBalance",
"(",
")",
"{",
"return",
"WhiteBalanceT",
".",
"get",
"(",
"getWhiteBalanceFn",
".",
"call0",
"(",
")",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"writeColorLevelFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"void",
"writeColorLevel",
"(",
"int",
"value",
")",
"{",
"BoundaryException",
".",
"assertWithinBounds",
"(",
"value",
",",
"0",
",",
"100",
")",
";",
"writeColorLevelFn",
".",
"call1",
"(",
"value",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"getColorLevelFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"int",
"getColorLevel",
"(",
")",
"{",
"return",
"getColorLevelFn",
".",
"call0",
"(",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"writeExposureControlFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"void",
"writeExposureControl",
"(",
"ExposureT",
"value",
")",
"{",
"writeExposureControlFn",
".",
"call1",
"(",
"value",
".",
"value",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"getExposureControlFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"ExposureT",
"getExposureControl",
"(",
")",
"{",
"return",
"ExposureT",
".",
"get",
"(",
"getExposureControlFn",
".",
"call0",
"(",
")",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"writeExposurePriorityFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"void",
"writeExposurePriority",
"(",
"ExposurePriorityT",
"value",
")",
"{",
"writeExposurePriorityFn",
".",
"call1",
"(",
"value",
".",
"value",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"getExposurePriorityFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"ExposurePriorityT",
"getExposurePriority",
"(",
")",
"{",
"return",
"ExposurePriorityT",
".",
"get",
"(",
"getExposurePriorityFn",
".",
"call0",
"(",
")",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"writeResolutionFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"void",
"writeResolution",
"(",
"ResolutionT",
"value",
")",
"{",
"writeResolutionFn",
".",
"call1",
"(",
"value",
".",
"value",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"getResolutionFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"ResolutionT",
"getResolution",
"(",
")",
"{",
"return",
"ResolutionT",
".",
"get",
"(",
"getResolutionFn",
".",
"call0",
"(",
")",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"writeCompressionFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"void",
"writeCompression",
"(",
"int",
"value",
")",
"{",
"BoundaryException",
".",
"assertWithinBounds",
"(",
"value",
",",
"0",
",",
"100",
")",
";",
"writeCompressionFn",
".",
"call1",
"(",
"value",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"getCompressionFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"int",
"getCompression",
"(",
")",
"{",
"return",
"getCompressionFn",
".",
"call0",
"(",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"writeRotationFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"void",
"writeRotation",
"(",
"RotationT",
"value",
")",
"{",
"writeRotationFn",
".",
"call1",
"(",
"value",
".",
"value",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"getRotationFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"RotationT",
"getRotation",
"(",
")",
"{",
"return",
"RotationT",
".",
"get",
"(",
"getRotationFn",
".",
"call0",
"(",
")",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"freshImageFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"boolean",
"freshImage",
"(",
")",
"{",
"return",
"freshImageFn",
".",
"call0",
"(",
")",
"==",
"0",
"?",
"false",
":",
"true",
";",
"}",
"private",
"static",
"final",
"Function",
"getMaxFPSFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"int",
"getMaxFPS",
"(",
")",
"{",
"return",
"getMaxFPSFn",
".",
"call0",
"(",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"writeMaxFPSFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"void",
"writeMaxFPS",
"(",
"int",
"value",
")",
"{",
"writeMaxFPSFn",
".",
"call1",
"(",
"value",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"deleteInstanceFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"static",
"{",
"VM",
".",
"addShutdownHook",
"(",
"new",
"Thread",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"deleteInstanceFn",
".",
"call0",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"</s>"
] |
7,460 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"camera",
";",
"public",
"class",
"AxisCameraException",
"extends",
"Exception",
"{",
"public",
"AxisCameraException",
"(",
"String",
"msg",
")",
"{",
"super",
"(",
"msg",
")",
";",
"}",
"}",
"</s>"
] |
7,461 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"public",
"interface",
"IDashboard",
"{",
"public",
"byte",
"[",
"]",
"getBytes",
"(",
")",
";",
"public",
"int",
"getBytesLength",
"(",
")",
";",
"public",
"void",
"flush",
"(",
")",
";",
"}",
"</s>"
] |
7,462 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
".",
"tDIO",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"IInputOutput",
";",
"public",
"class",
"DigitalOutput",
"extends",
"DigitalSource",
"implements",
"IInputOutput",
"{",
"private",
"int",
"m_channel",
";",
"private",
"int",
"m_pwmGenerator",
";",
"private",
"DigitalModule",
"m_module",
";",
"private",
"void",
"initDigitalOutput",
"(",
"int",
"slot",
",",
"int",
"channel",
")",
"{",
"m_channel",
"=",
"channel",
";",
"m_pwmGenerator",
"=",
"~",
"0",
";",
"m_module",
"=",
"DigitalModule",
".",
"getInstance",
"(",
"slot",
")",
";",
"m_module",
".",
"allocateDIO",
"(",
"m_channel",
",",
"false",
")",
";",
"}",
"public",
"DigitalOutput",
"(",
"int",
"slot",
",",
"int",
"channel",
")",
"{",
"initDigitalOutput",
"(",
"slot",
",",
"channel",
")",
";",
"}",
"public",
"DigitalOutput",
"(",
"int",
"channel",
")",
"{",
"initDigitalOutput",
"(",
"getDefaultDigitalModule",
"(",
")",
",",
"channel",
")",
";",
"}",
"protected",
"void",
"free",
"(",
")",
"{",
"disablePWM",
"(",
")",
";",
"m_module",
".",
"freeDIO",
"(",
"m_channel",
")",
";",
"}",
"public",
"void",
"set",
"(",
"boolean",
"value",
")",
"{",
"m_module",
".",
"setDIO",
"(",
"m_channel",
",",
"value",
")",
";",
"}",
"public",
"int",
"getChannel",
"(",
")",
"{",
"return",
"m_channel",
";",
"}",
"public",
"void",
"pulse",
"(",
"double",
"length",
")",
"{",
"m_module",
".",
"pulse",
"(",
"m_channel",
",",
"(",
"char",
")",
"(",
"1e9",
"*",
"length",
"/",
"(",
"tDIO",
".",
"readLoopTiming",
"(",
")",
"*",
"25",
")",
")",
")",
";",
"}",
"public",
"boolean",
"isPulsing",
"(",
")",
"{",
"return",
"m_module",
".",
"isPulsing",
"(",
"m_channel",
")",
";",
"}",
"public",
"void",
"setPWMRate",
"(",
"double",
"rate",
")",
"{",
"m_module",
".",
"setDO_PWMRate",
"(",
"rate",
")",
";",
"}",
"public",
"void",
"enablePWM",
"(",
"double",
"initialDutyCycle",
")",
"{",
"if",
"(",
"m_pwmGenerator",
"!=",
"~",
"0",
")",
"return",
";",
"m_pwmGenerator",
"=",
"m_module",
".",
"allocateDO_PWM",
"(",
")",
";",
"m_module",
".",
"setDO_PWMDutyCycle",
"(",
"m_pwmGenerator",
",",
"initialDutyCycle",
")",
";",
"m_module",
".",
"setDO_PWMOutputChannel",
"(",
"m_pwmGenerator",
",",
"m_channel",
")",
";",
"}",
"public",
"void",
"disablePWM",
"(",
")",
"{",
"m_module",
".",
"setDO_PWMOutputChannel",
"(",
"m_pwmGenerator",
",",
"kDigitalChannels",
")",
";",
"m_module",
".",
"freeDO_PWM",
"(",
"m_pwmGenerator",
")",
";",
"m_pwmGenerator",
"=",
"~",
"0",
";",
"}",
"public",
"void",
"updateDutyCycle",
"(",
"double",
"dutyCycle",
")",
"{",
"m_module",
".",
"setDO_PWMDutyCycle",
"(",
"m_pwmGenerator",
",",
"dutyCycle",
")",
";",
"}",
"public",
"int",
"getChannelForRouting",
"(",
")",
"{",
"return",
"DigitalModule",
".",
"remapDigitalChannel",
"(",
"getChannel",
"(",
")",
"-",
"1",
")",
";",
"}",
"public",
"int",
"getModuleForRouting",
"(",
")",
"{",
"return",
"DigitalModule",
".",
"slotToIndex",
"(",
"m_module",
".",
"getSlot",
"(",
")",
")",
";",
"}",
"public",
"boolean",
"getAnalogTriggerForRouting",
"(",
")",
"{",
"return",
"false",
";",
"}",
"}",
"</s>"
] |
7,463 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
".",
"tDIO",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"IDeviceController",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"AllocationException",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"CheckedAllocationException",
";",
"public",
"class",
"Relay",
"extends",
"SensorBase",
"implements",
"IDeviceController",
"{",
"public",
"class",
"InvalidValueException",
"extends",
"RuntimeException",
"{",
"public",
"InvalidValueException",
"(",
"String",
"message",
")",
"{",
"super",
"(",
"message",
")",
";",
"}",
"}",
"public",
"static",
"class",
"Value",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"int",
"kOff_val",
"=",
"0",
";",
"static",
"final",
"int",
"kOn_val",
"=",
"1",
";",
"static",
"final",
"int",
"kForward_val",
"=",
"2",
";",
"static",
"final",
"int",
"kReverse_val",
"=",
"3",
";",
"public",
"static",
"final",
"Value",
"kOff",
"=",
"new",
"Value",
"(",
"kOff_val",
")",
";",
"public",
"static",
"final",
"Value",
"kOn",
"=",
"new",
"Value",
"(",
"kOn_val",
")",
";",
"public",
"static",
"final",
"Value",
"kForward",
"=",
"new",
"Value",
"(",
"kForward_val",
")",
";",
"public",
"static",
"final",
"Value",
"kReverse",
"=",
"new",
"Value",
"(",
"kReverse_val",
")",
";",
"private",
"Value",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"static",
"class",
"Direction",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"int",
"kBoth_val",
"=",
"0",
";",
"static",
"final",
"int",
"kForward_val",
"=",
"1",
";",
"static",
"final",
"int",
"kReverse_val",
"=",
"2",
";",
"public",
"static",
"final",
"Direction",
"kBoth",
"=",
"new",
"Direction",
"(",
"kBoth_val",
")",
";",
"public",
"static",
"final",
"Direction",
"kForward",
"=",
"new",
"Direction",
"(",
"kForward_val",
")",
";",
"public",
"static",
"final",
"Direction",
"kReverse",
"=",
"new",
"Direction",
"(",
"kReverse_val",
")",
";",
"private",
"Direction",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"private",
"int",
"m_channel",
";",
"private",
"Direction",
"m_direction",
";",
"private",
"DigitalModule",
"m_module",
";",
"private",
"static",
"Resource",
"relayChannels",
"=",
"new",
"Resource",
"(",
"tDIO",
".",
"kNumSystems",
"*",
"kRelayChannels",
")",
";",
"private",
"void",
"initRelay",
"(",
"final",
"int",
"slot",
")",
"{",
"SensorBase",
".",
"checkRelayModule",
"(",
"slot",
")",
";",
"SensorBase",
".",
"checkRelayChannel",
"(",
"m_channel",
")",
";",
"try",
"{",
"if",
"(",
"m_direction",
"==",
"Direction",
".",
"kBoth",
"||",
"m_direction",
"==",
"Direction",
".",
"kForward",
")",
"{",
"relayChannels",
".",
"allocate",
"(",
"(",
"DigitalModule",
".",
"slotToIndex",
"(",
"slot",
")",
"*",
"kRelayChannels",
"+",
"m_channel",
"-",
"1",
")",
"*",
"2",
")",
";",
"}",
"if",
"(",
"m_direction",
"==",
"Direction",
".",
"kBoth",
"||",
"m_direction",
"==",
"Direction",
".",
"kReverse",
")",
"{",
"relayChannels",
".",
"allocate",
"(",
"(",
"DigitalModule",
".",
"slotToIndex",
"(",
"slot",
")",
"*",
"kRelayChannels",
"+",
"m_channel",
"-",
"1",
")",
"*",
"2",
"+",
"1",
")",
";",
"}",
"}",
"catch",
"(",
"CheckedAllocationException",
"e",
")",
"{",
"throw",
"new",
"AllocationException",
"(",
"\"\"",
"+",
"m_channel",
"+",
"\"",
"on",
"module",
"\"",
"+",
"slot",
"+",
"\"\"",
")",
";",
"}",
"m_module",
"=",
"DigitalModule",
".",
"getInstance",
"(",
"slot",
")",
";",
"m_module",
".",
"setRelayForward",
"(",
"m_channel",
",",
"false",
")",
";",
"m_module",
".",
"setRelayReverse",
"(",
"m_channel",
",",
"false",
")",
";",
"}",
"public",
"Relay",
"(",
"final",
"int",
"slot",
",",
"final",
"int",
"channel",
",",
"Direction",
"direction",
")",
"{",
"if",
"(",
"direction",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"m_channel",
"=",
"channel",
";",
"m_direction",
"=",
"direction",
";",
"initRelay",
"(",
"slot",
")",
";",
"}",
"public",
"Relay",
"(",
"final",
"int",
"channel",
",",
"Direction",
"direction",
")",
"{",
"if",
"(",
"direction",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"m_channel",
"=",
"channel",
";",
"m_direction",
"=",
"direction",
";",
"initRelay",
"(",
"getDefaultDigitalModule",
"(",
")",
")",
";",
"}",
"public",
"Relay",
"(",
"final",
"int",
"slot",
",",
"final",
"int",
"channel",
")",
"{",
"m_channel",
"=",
"channel",
";",
"m_direction",
"=",
"Direction",
".",
"kBoth",
";",
"initRelay",
"(",
"slot",
")",
";",
"}",
"public",
"Relay",
"(",
"final",
"int",
"channel",
")",
"{",
"m_channel",
"=",
"channel",
";",
"m_direction",
"=",
"Direction",
".",
"kBoth",
";",
"initRelay",
"(",
"getDefaultDigitalModule",
"(",
")",
")",
";",
"}",
"protected",
"void",
"free",
"(",
")",
"{",
"m_module",
".",
"setRelayForward",
"(",
"m_channel",
",",
"false",
")",
";",
"m_module",
".",
"setRelayReverse",
"(",
"m_channel",
",",
"false",
")",
";",
"if",
"(",
"m_direction",
"==",
"Direction",
".",
"kBoth",
"||",
"m_direction",
"==",
"Direction",
".",
"kForward",
")",
"{",
"relayChannels",
".",
"free",
"(",
"(",
"DigitalModule",
".",
"slotToIndex",
"(",
"m_module",
".",
"getSlot",
"(",
")",
")",
"*",
"kRelayChannels",
"+",
"m_channel",
"-",
"1",
")",
"*",
"2",
")",
";",
"}",
"if",
"(",
"m_direction",
"==",
"Direction",
".",
"kBoth",
"||",
"m_direction",
"==",
"Direction",
".",
"kReverse",
")",
"{",
"relayChannels",
".",
"free",
"(",
"(",
"DigitalModule",
".",
"slotToIndex",
"(",
"m_module",
".",
"getSlot",
"(",
")",
")",
"*",
"kRelayChannels",
"+",
"m_channel",
"-",
"1",
")",
"*",
"2",
"+",
"1",
")",
";",
"}",
"}",
"public",
"void",
"set",
"(",
"Value",
"value",
")",
"{",
"switch",
"(",
"value",
".",
"value",
")",
"{",
"case",
"Value",
".",
"kOff_val",
":",
"if",
"(",
"m_direction",
"==",
"Direction",
".",
"kBoth",
"||",
"m_direction",
"==",
"Direction",
".",
"kForward",
")",
"{",
"m_module",
".",
"setRelayForward",
"(",
"m_channel",
",",
"false",
")",
";",
"}",
"if",
"(",
"m_direction",
"==",
"Direction",
".",
"kBoth",
"||",
"m_direction",
"==",
"Direction",
".",
"kReverse",
")",
"{",
"m_module",
".",
"setRelayReverse",
"(",
"m_channel",
",",
"false",
")",
";",
"}",
"break",
";",
"case",
"Value",
".",
"kOn_val",
":",
"if",
"(",
"m_direction",
"==",
"Direction",
".",
"kBoth",
")",
"throw",
"new",
"InvalidValueException",
"(",
"\"\"",
")",
";",
"if",
"(",
"m_direction",
"==",
"Direction",
".",
"kForward",
")",
"{",
"m_module",
".",
"setRelayForward",
"(",
"m_channel",
",",
"true",
")",
";",
"}",
"else",
"if",
"(",
"m_direction",
"==",
"Direction",
".",
"kReverse",
")",
"{",
"m_module",
".",
"setRelayReverse",
"(",
"m_channel",
",",
"true",
")",
";",
"}",
"break",
";",
"case",
"Value",
".",
"kForward_val",
":",
"if",
"(",
"m_direction",
"==",
"Direction",
".",
"kReverse",
")",
"throw",
"new",
"InvalidValueException",
"(",
"\"\"",
")",
";",
"if",
"(",
"m_direction",
"==",
"Direction",
".",
"kBoth",
"||",
"m_direction",
"==",
"Direction",
".",
"kForward",
")",
"{",
"m_module",
".",
"setRelayForward",
"(",
"m_channel",
",",
"true",
")",
";",
"}",
"if",
"(",
"m_direction",
"==",
"Direction",
".",
"kBoth",
")",
"{",
"m_module",
".",
"setRelayReverse",
"(",
"m_channel",
",",
"false",
")",
";",
"}",
"break",
";",
"case",
"Value",
".",
"kReverse_val",
":",
"if",
"(",
"m_direction",
"==",
"Direction",
".",
"kForward",
")",
"throw",
"new",
"InvalidValueException",
"(",
"\"\"",
")",
";",
"if",
"(",
"m_direction",
"==",
"Direction",
".",
"kBoth",
")",
"{",
"m_module",
".",
"setRelayForward",
"(",
"m_channel",
",",
"false",
")",
";",
"}",
"if",
"(",
"m_direction",
"==",
"Direction",
".",
"kBoth",
"||",
"m_direction",
"==",
"Direction",
".",
"kReverse",
")",
"{",
"m_module",
".",
"setRelayReverse",
"(",
"m_channel",
",",
"true",
")",
";",
"}",
"break",
";",
"default",
":",
"}",
"}",
"public",
"void",
"setDirection",
"(",
"Direction",
"direction",
")",
"{",
"if",
"(",
"direction",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"if",
"(",
"m_direction",
"==",
"direction",
")",
"{",
"return",
";",
"}",
"free",
"(",
")",
";",
"m_direction",
"=",
"direction",
";",
"initRelay",
"(",
"m_module",
".",
"getSlot",
"(",
")",
")",
";",
"}",
"}",
"</s>"
] |
7,464 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"can",
".",
"*",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"communication",
".",
"Semaphore",
";",
"public",
"class",
"CANJaguar",
"implements",
"MotorSafety",
",",
"PIDOutput",
",",
"SpeedController",
"{",
"public",
"static",
"final",
"int",
"kControllerRate",
"=",
"1000",
";",
"public",
"static",
"final",
"double",
"kApproxBusVoltage",
"=",
"12.0",
";",
"public",
"static",
"class",
"ControlMode",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"int",
"kPercentVbus_val",
"=",
"0",
";",
"static",
"final",
"int",
"kCurrent_val",
"=",
"1",
";",
"static",
"final",
"int",
"kSpeed_val",
"=",
"2",
";",
"static",
"final",
"int",
"kPosition_val",
"=",
"3",
";",
"static",
"final",
"int",
"kVoltage_val",
"=",
"4",
";",
"public",
"static",
"final",
"ControlMode",
"kPercentVbus",
"=",
"new",
"ControlMode",
"(",
"kPercentVbus_val",
")",
";",
"public",
"static",
"final",
"ControlMode",
"kCurrent",
"=",
"new",
"ControlMode",
"(",
"kCurrent_val",
")",
";",
"public",
"static",
"final",
"ControlMode",
"kSpeed",
"=",
"new",
"ControlMode",
"(",
"kSpeed_val",
")",
";",
"public",
"static",
"final",
"ControlMode",
"kPosition",
"=",
"new",
"ControlMode",
"(",
"kPosition_val",
")",
";",
"public",
"static",
"final",
"ControlMode",
"kVoltage",
"=",
"new",
"ControlMode",
"(",
"kVoltage_val",
")",
";",
"private",
"ControlMode",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"static",
"class",
"Faults",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"int",
"kCurrentFault_val",
"=",
"1",
";",
"static",
"final",
"int",
"kTemperatureFault_val",
"=",
"2",
";",
"static",
"final",
"int",
"kBusVoltageFault_val",
"=",
"4",
";",
"static",
"final",
"int",
"kGateDriverFault_val",
"=",
"8",
";",
"public",
"static",
"final",
"Faults",
"kCurrentFault",
"=",
"new",
"Faults",
"(",
"kCurrentFault_val",
")",
";",
"public",
"static",
"final",
"Faults",
"kTemperatureFault",
"=",
"new",
"Faults",
"(",
"kTemperatureFault_val",
")",
";",
"public",
"static",
"final",
"Faults",
"kBusVoltageFault",
"=",
"new",
"Faults",
"(",
"kBusVoltageFault_val",
")",
";",
"public",
"static",
"final",
"Faults",
"kGateDriverFault",
"=",
"new",
"Faults",
"(",
"kGateDriverFault_val",
")",
";",
"private",
"Faults",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"static",
"class",
"Limits",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"int",
"kForwardLimit_val",
"=",
"1",
";",
"static",
"final",
"int",
"kReverseLimit_val",
"=",
"2",
";",
"public",
"static",
"final",
"Limits",
"kForwardLimit",
"=",
"new",
"Limits",
"(",
"kForwardLimit_val",
")",
";",
"public",
"static",
"final",
"Limits",
"kReverseLimit",
"=",
"new",
"Limits",
"(",
"kReverseLimit_val",
")",
";",
"private",
"Limits",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"static",
"class",
"PositionReference",
"{",
"public",
"final",
"byte",
"value",
";",
"static",
"final",
"byte",
"kQuadEncoder_val",
"=",
"0",
";",
"static",
"final",
"byte",
"kPotentiometer_val",
"=",
"1",
";",
"static",
"final",
"byte",
"kNone_val",
"=",
"(",
"byte",
")",
"0xFF",
";",
"public",
"static",
"final",
"PositionReference",
"kQuadEncoder",
"=",
"new",
"PositionReference",
"(",
"kQuadEncoder_val",
")",
";",
"public",
"static",
"final",
"PositionReference",
"kPotentiometer",
"=",
"new",
"PositionReference",
"(",
"kPotentiometer_val",
")",
";",
"public",
"static",
"final",
"PositionReference",
"kNone",
"=",
"new",
"PositionReference",
"(",
"kNone_val",
")",
";",
"private",
"PositionReference",
"(",
"byte",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"static",
"class",
"SpeedReference",
"{",
"public",
"final",
"byte",
"value",
";",
"static",
"final",
"byte",
"kEncoder_val",
"=",
"0",
";",
"static",
"final",
"byte",
"kInvEncoder_val",
"=",
"2",
";",
"static",
"final",
"byte",
"kQuadEncoder_val",
"=",
"3",
";",
"static",
"final",
"byte",
"kNone_val",
"=",
"(",
"byte",
")",
"0xFF",
";",
"public",
"static",
"final",
"SpeedReference",
"kEncoder",
"=",
"new",
"SpeedReference",
"(",
"kEncoder_val",
")",
";",
"public",
"static",
"final",
"SpeedReference",
"kInvEncoder",
"=",
"new",
"SpeedReference",
"(",
"kInvEncoder_val",
")",
";",
"public",
"static",
"final",
"SpeedReference",
"kQuadEncoder",
"=",
"new",
"SpeedReference",
"(",
"kQuadEncoder_val",
")",
";",
"public",
"static",
"final",
"SpeedReference",
"kNone",
"=",
"new",
"SpeedReference",
"(",
"kNone_val",
")",
";",
"private",
"SpeedReference",
"(",
"byte",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"static",
"class",
"NeutralMode",
"{",
"public",
"final",
"byte",
"value",
";",
"static",
"final",
"byte",
"kJumper_val",
"=",
"0",
";",
"static",
"final",
"byte",
"kBrake_val",
"=",
"1",
";",
"static",
"final",
"byte",
"kCoast_val",
"=",
"2",
";",
"public",
"static",
"final",
"NeutralMode",
"kJumper",
"=",
"new",
"NeutralMode",
"(",
"kJumper_val",
")",
";",
"public",
"static",
"final",
"NeutralMode",
"kBrake",
"=",
"new",
"NeutralMode",
"(",
"kBrake_val",
")",
";",
"public",
"static",
"final",
"NeutralMode",
"kCoast",
"=",
"new",
"NeutralMode",
"(",
"kCoast_val",
")",
";",
"private",
"NeutralMode",
"(",
"byte",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"static",
"class",
"LimitMode",
"{",
"public",
"final",
"byte",
"value",
";",
"static",
"final",
"byte",
"kSwitchInputsOnly_val",
"=",
"0",
";",
"static",
"final",
"byte",
"kSoftPositionLimit_val",
"=",
"1",
";",
"public",
"static",
"final",
"LimitMode",
"kSwitchInputsOnly",
"=",
"new",
"LimitMode",
"(",
"kSwitchInputsOnly_val",
")",
";",
"public",
"static",
"final",
"LimitMode",
"kSoftPostionLimits",
"=",
"new",
"LimitMode",
"(",
"kSoftPositionLimit_val",
")",
";",
"private",
"LimitMode",
"(",
"byte",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"private",
"final",
"Object",
"m_transactionMutex",
"=",
"new",
"Object",
"(",
")",
";",
"private",
"byte",
"m_deviceNumber",
";",
"private",
"ControlMode",
"m_controlMode",
";",
"private",
"double",
"m_maxOutputVoltage",
";",
"private",
"MotorSafetyHelper",
"m_safetyHelper",
";",
"private",
"static",
"final",
"byte",
"[",
"]",
"kNoData",
"=",
"new",
"byte",
"[",
"0",
"]",
";",
"private",
"final",
"static",
"int",
"swap16",
"(",
"int",
"x",
")",
"{",
"return",
"(",
"(",
"(",
"(",
"x",
")",
">>>",
"8",
")",
"&",
"0x00FF",
")",
"|",
"(",
"(",
"(",
"x",
")",
"<<",
"8",
")",
"&",
"0xFF00",
")",
")",
";",
"}",
"private",
"final",
"static",
"long",
"swap32",
"(",
"long",
"x",
")",
"{",
"return",
"(",
"(",
"(",
"(",
"x",
")",
">>",
"24",
")",
"&",
"0x000000FF",
")",
"|",
"(",
"(",
"(",
"x",
")",
">>",
"8",
")",
"&",
"0x0000FF00",
")",
"|",
"(",
"(",
"(",
"x",
")",
"<<",
"8",
")",
"&",
"0x00FF0000",
")",
"|",
"(",
"(",
"(",
"x",
")",
"<<",
"24",
")",
"&",
"0xFF000000",
")",
")",
";",
"}",
"private",
"final",
"static",
"int",
"swap16",
"(",
"int",
"x",
",",
"byte",
"[",
"]",
"buffer",
")",
"{",
"buffer",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"x",
";",
"buffer",
"[",
"1",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"x",
">>>",
"8",
")",
"&",
"0x00FF",
")",
";",
"return",
"(",
"(",
"(",
"(",
"x",
")",
">>>",
"8",
")",
"&",
"0x00FF",
")",
"|",
"(",
"(",
"(",
"x",
")",
"<<",
"8",
")",
"&",
"0xFF00",
")",
")",
";",
"}",
"private",
"final",
"static",
"long",
"swap32",
"(",
"long",
"x",
",",
"byte",
"[",
"]",
"buffer",
")",
"{",
"buffer",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"x",
";",
"buffer",
"[",
"1",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"x",
">>>",
"8",
")",
"&",
"0x00FF",
")",
";",
"buffer",
"[",
"2",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"x",
">>>",
"16",
")",
"&",
"0x00FF",
")",
";",
"buffer",
"[",
"3",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"x",
">>>",
"24",
")",
"&",
"0x00FF",
")",
";",
"return",
"(",
"(",
"(",
"(",
"x",
")",
">>",
"24",
")",
"&",
"0x000000FF",
")",
"|",
"(",
"(",
"(",
"x",
")",
">>",
"8",
")",
"&",
"0x0000FF00",
")",
"|",
"(",
"(",
"(",
"x",
")",
"<<",
"8",
")",
"&",
"0x00FF0000",
")",
"|",
"(",
"(",
"(",
"x",
")",
"<<",
"24",
")",
"&",
"0xFF000000",
")",
")",
";",
"}",
"private",
"final",
"static",
"int",
"swap16",
"(",
"byte",
"[",
"]",
"buffer",
")",
"{",
"return",
"(",
"(",
"(",
"(",
"buffer",
"[",
"1",
"]",
")",
">>>",
"8",
")",
"&",
"0x00FF",
")",
"|",
"(",
"(",
"(",
"buffer",
"[",
"0",
"]",
")",
"<<",
"8",
")",
"&",
"0xFF00",
")",
")",
";",
"}",
"private",
"final",
"static",
"long",
"swap32",
"(",
"byte",
"[",
"]",
"buffer",
")",
"{",
"return",
"(",
"(",
"(",
"(",
"buffer",
"[",
"3",
"]",
")",
">>",
"24",
")",
"&",
"0x000000FF",
")",
"|",
"(",
"(",
"(",
"buffer",
"[",
"2",
"]",
")",
">>",
"8",
")",
"&",
"0x0000FF00",
")",
"|",
"(",
"(",
"(",
"buffer",
"[",
"1",
"]",
")",
"<<",
"8",
")",
"&",
"0x00FF0000",
")",
"|",
"(",
"(",
"(",
"buffer",
"[",
"0",
"]",
")",
"<<",
"24",
")",
"&",
"0xFF000000",
")",
")",
";",
"}",
"private",
"static",
"final",
"void",
"pack16",
"(",
"short",
"data",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
")",
"{",
"buffer",
"[",
"offset",
"]",
"=",
"(",
"byte",
")",
"(",
"data",
"&",
"0xFF",
")",
";",
"buffer",
"[",
"offset",
"+",
"1",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"data",
">>>",
"8",
")",
"&",
"0xFF",
")",
";",
"}",
"private",
"static",
"final",
"void",
"pack32",
"(",
"int",
"data",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
")",
"{",
"buffer",
"[",
"offset",
"]",
"=",
"(",
"byte",
")",
"(",
"data",
"&",
"0xFF",
")",
";",
"buffer",
"[",
"offset",
"+",
"1",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"data",
">>>",
"8",
")",
"&",
"0xFF",
")",
";",
"buffer",
"[",
"offset",
"+",
"2",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"data",
">>>",
"16",
")",
"&",
"0xFF",
")",
";",
"buffer",
"[",
"offset",
"+",
"3",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"data",
">>>",
"24",
")",
"&",
"0xFF",
")",
";",
"}",
"private",
"static",
"final",
"short",
"unpack16",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
")",
"{",
"return",
"(",
"short",
")",
"(",
"(",
"(",
"int",
")",
"buffer",
"[",
"offset",
"]",
"&",
"0xFF",
")",
"|",
"(",
"short",
")",
"(",
"(",
"buffer",
"[",
"offset",
"+",
"1",
"]",
"<<",
"8",
")",
")",
"&",
"0xFF00",
")",
";",
"}",
"private",
"static",
"final",
"int",
"unpack32",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
")",
"{",
"return",
"(",
"(",
"int",
")",
"buffer",
"[",
"offset",
"]",
"&",
"0xFF",
")",
"|",
"(",
"(",
"buffer",
"[",
"offset",
"+",
"1",
"]",
"<<",
"8",
")",
"&",
"0xFF00",
")",
"|",
"(",
"(",
"buffer",
"[",
"offset",
"+",
"2",
"]",
"<<",
"16",
")",
"&",
"0xFF0000",
")",
"|",
"(",
"(",
"buffer",
"[",
"offset",
"+",
"3",
"]",
"<<",
"24",
")",
"&",
"0xFF000000",
")",
";",
"}",
"private",
"static",
"final",
"int",
"kFullMessageIDMask",
"=",
"0x1FFFFFC0",
";",
"private",
"void",
"initCANJaguar",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"if",
"(",
"m_deviceNumber",
"<",
"1",
"||",
"m_deviceNumber",
">",
"63",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"\"",
"+",
"m_deviceNumber",
"+",
"\"\"",
")",
";",
"}",
"int",
"fwVer",
"=",
"getFirmwareVersion",
"(",
")",
";",
"if",
"(",
"fwVer",
">=",
"CANJaguarVersionException",
".",
"kMinRDKFirmwareVersion",
"||",
"fwVer",
"<",
"CANJaguarVersionException",
".",
"kMinLegalFIRSTFirmwareVersion",
")",
"{",
"throw",
"new",
"CANJaguarVersionException",
"(",
"m_deviceNumber",
",",
"fwVer",
")",
";",
"}",
"switch",
"(",
"m_controlMode",
".",
"value",
")",
"{",
"case",
"ControlMode",
".",
"kPercentVbus_val",
":",
"case",
"ControlMode",
".",
"kVoltage_val",
":",
"enableControl",
"(",
")",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"m_safetyHelper",
"=",
"new",
"MotorSafetyHelper",
"(",
"this",
")",
";",
"}",
"public",
"CANJaguar",
"(",
"int",
"deviceNumber",
")",
"throws",
"CANTimeoutException",
"{",
"m_deviceNumber",
"=",
"(",
"byte",
")",
"deviceNumber",
";",
"m_controlMode",
"=",
"ControlMode",
".",
"kPercentVbus",
";",
"m_maxOutputVoltage",
"=",
"kApproxBusVoltage",
";",
"initCANJaguar",
"(",
")",
";",
"}",
"public",
"CANJaguar",
"(",
"int",
"deviceNumber",
",",
"ControlMode",
"controlMode",
")",
"throws",
"CANTimeoutException",
"{",
"m_deviceNumber",
"=",
"(",
"byte",
")",
"deviceNumber",
";",
"m_controlMode",
"=",
"controlMode",
";",
"m_maxOutputVoltage",
"=",
"kApproxBusVoltage",
";",
"initCANJaguar",
"(",
")",
";",
"}",
"public",
"void",
"setX",
"(",
"double",
"outputValue",
")",
"throws",
"CANTimeoutException",
"{",
"setX",
"(",
"outputValue",
",",
"(",
"byte",
")",
"0",
")",
";",
"}",
"public",
"void",
"set",
"(",
"double",
"outputValue",
")",
"{",
"set",
"(",
"outputValue",
",",
"(",
"byte",
")",
"0",
")",
";",
"}",
"public",
"void",
"setX",
"(",
"double",
"outputValue",
",",
"byte",
"syncGroup",
")",
"throws",
"CANTimeoutException",
"{",
"int",
"messageID",
"=",
"0",
";",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
"=",
"0",
";",
"if",
"(",
"!",
"m_safetyHelper",
".",
"isAlive",
"(",
")",
")",
"{",
"enableControl",
"(",
")",
";",
"}",
"switch",
"(",
"m_controlMode",
".",
"value",
")",
"{",
"case",
"ControlMode",
".",
"kPercentVbus_val",
":",
"messageID",
"=",
"JaguarCANProtocol",
".",
"LM_API_VOLT_T_SET",
";",
"if",
"(",
"outputValue",
">",
"1.0",
")",
"outputValue",
"=",
"1.0",
";",
"if",
"(",
"outputValue",
"<",
"-",
"1.0",
")",
"outputValue",
"=",
"-",
"1.0",
";",
"packPercentage",
"(",
"dataBuffer",
",",
"outputValue",
")",
";",
"dataSize",
"=",
"2",
";",
"break",
";",
"case",
"ControlMode",
".",
"kSpeed_val",
":",
"{",
"messageID",
"=",
"JaguarCANProtocol",
".",
"LM_API_SPD_T_SET",
";",
"dataSize",
"=",
"packFXP16_16",
"(",
"dataBuffer",
",",
"outputValue",
")",
";",
"}",
"break",
";",
"case",
"ControlMode",
".",
"kPosition_val",
":",
"{",
"messageID",
"=",
"JaguarCANProtocol",
".",
"LM_API_POS_T_SET",
";",
"dataSize",
"=",
"packFXP16_16",
"(",
"dataBuffer",
",",
"outputValue",
")",
";",
"}",
"break",
";",
"case",
"ControlMode",
".",
"kCurrent_val",
":",
"{",
"messageID",
"=",
"JaguarCANProtocol",
".",
"LM_API_ICTRL_T_SET",
";",
"dataSize",
"=",
"packFXP8_8",
"(",
"dataBuffer",
",",
"outputValue",
")",
";",
"}",
"break",
";",
"case",
"ControlMode",
".",
"kVoltage_val",
":",
"{",
"messageID",
"=",
"JaguarCANProtocol",
".",
"LM_API_VCOMP_T_SET",
";",
"dataSize",
"=",
"packFXP8_8",
"(",
"dataBuffer",
",",
"outputValue",
")",
";",
"}",
"break",
";",
"default",
":",
"return",
";",
"}",
"if",
"(",
"syncGroup",
"!=",
"0",
")",
"{",
"dataBuffer",
"[",
"dataSize",
"]",
"=",
"syncGroup",
";",
"dataSize",
"++",
";",
"}",
"setTransaction",
"(",
"messageID",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"m_safetyHelper",
".",
"feed",
"(",
")",
";",
"}",
"public",
"void",
"set",
"(",
"double",
"outputValue",
",",
"byte",
"syncGroup",
")",
"{",
"try",
"{",
"setX",
"(",
"outputValue",
",",
"syncGroup",
")",
";",
"}",
"catch",
"(",
"CANTimeoutException",
"e",
")",
"{",
"}",
"}",
"public",
"double",
"getX",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
"=",
"0",
";",
"switch",
"(",
"m_controlMode",
".",
"value",
")",
"{",
"case",
"ControlMode",
".",
"kPercentVbus_val",
":",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_VOLT_SET",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"2",
")",
"{",
"return",
"unpackPercentage",
"(",
"dataBuffer",
")",
";",
"}",
"break",
";",
"case",
"ControlMode",
".",
"kSpeed_val",
":",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_SPD_SET",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"4",
")",
"{",
"return",
"unpackFXP16_16",
"(",
"dataBuffer",
")",
";",
"}",
"break",
";",
"case",
"ControlMode",
".",
"kPosition_val",
":",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_POS_SET",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"4",
")",
"{",
"return",
"unpackFXP16_16",
"(",
"dataBuffer",
")",
";",
"}",
"break",
";",
"case",
"ControlMode",
".",
"kCurrent_val",
":",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_ICTRL_SET",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"2",
")",
"{",
"return",
"unpackFXP8_8",
"(",
"dataBuffer",
")",
";",
"}",
"break",
";",
"case",
"ControlMode",
".",
"kVoltage_val",
":",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_VCOMP_SET",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"2",
")",
"{",
"return",
"unpackFXP8_8",
"(",
"dataBuffer",
")",
";",
"}",
"break",
";",
"}",
"return",
"0.0",
";",
"}",
"public",
"double",
"get",
"(",
")",
"{",
"try",
"{",
"return",
"getX",
"(",
")",
";",
"}",
"catch",
"(",
"CANTimeoutException",
"e",
")",
"{",
"return",
"0.0",
";",
"}",
"}",
"public",
"void",
"disable",
"(",
")",
"{",
"try",
"{",
"disableControl",
"(",
")",
";",
"}",
"catch",
"(",
"CANTimeoutException",
"e",
")",
"{",
"}",
"}",
"public",
"void",
"pidWrite",
"(",
"double",
"output",
")",
"{",
"if",
"(",
"m_controlMode",
"==",
"ControlMode",
".",
"kPercentVbus",
")",
"{",
"set",
"(",
"output",
")",
";",
"}",
"else",
"{",
"}",
"}",
"byte",
"packPercentage",
"(",
"byte",
"[",
"]",
"buffer",
",",
"double",
"value",
")",
"{",
"short",
"intValue",
"=",
"(",
"short",
")",
"(",
"value",
"*",
"32767.0",
")",
";",
"swap16",
"(",
"intValue",
",",
"buffer",
")",
";",
"return",
"2",
";",
"}",
"byte",
"packFXP8_8",
"(",
"byte",
"[",
"]",
"buffer",
",",
"double",
"value",
")",
"{",
"short",
"intValue",
"=",
"(",
"short",
")",
"(",
"value",
"*",
"256.0",
")",
";",
"swap16",
"(",
"intValue",
",",
"buffer",
")",
";",
"return",
"2",
";",
"}",
"byte",
"packFXP16_16",
"(",
"byte",
"[",
"]",
"buffer",
",",
"double",
"value",
")",
"{",
"int",
"intValue",
"=",
"(",
"int",
")",
"(",
"value",
"*",
"65536.0",
")",
";",
"swap32",
"(",
"intValue",
",",
"buffer",
")",
";",
"return",
"4",
";",
"}",
"byte",
"packINT16",
"(",
"byte",
"[",
"]",
"buffer",
",",
"short",
"value",
")",
"{",
"swap16",
"(",
"value",
",",
"buffer",
")",
";",
"return",
"2",
";",
"}",
"byte",
"packINT32",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"value",
")",
"{",
"swap32",
"(",
"value",
",",
"buffer",
")",
";",
"return",
"4",
";",
"}",
"double",
"unpackPercentage",
"(",
"byte",
"[",
"]",
"buffer",
")",
"{",
"return",
"unpack16",
"(",
"buffer",
",",
"0",
")",
"/",
"32767.0",
";",
"}",
"double",
"unpackFXP8_8",
"(",
"byte",
"[",
"]",
"buffer",
")",
"{",
"return",
"unpack16",
"(",
"buffer",
",",
"0",
")",
"/",
"256.0",
";",
"}",
"double",
"unpackFXP16_16",
"(",
"byte",
"[",
"]",
"buffer",
")",
"{",
"return",
"unpack32",
"(",
"buffer",
",",
"0",
")",
"/",
"65536.0",
";",
"}",
"int",
"unpackINT16",
"(",
"byte",
"[",
"]",
"buffer",
")",
"{",
"return",
"unpack16",
"(",
"buffer",
",",
"0",
")",
";",
"}",
"long",
"unpackINT32",
"(",
"byte",
"[",
"]",
"buffer",
")",
"{",
"return",
"unpack32",
"(",
"buffer",
",",
"0",
")",
";",
"}",
"private",
"static",
"final",
"byte",
"[",
"]",
"sendTrustedDataBuffer",
"=",
"new",
"byte",
"[",
"JaguarCANDriver",
".",
"kMaxMessageDataSize",
"]",
";",
"protected",
"static",
"void",
"sendMessage",
"(",
"int",
"messageID",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"dataSize",
")",
"throws",
"CANTimeoutException",
"{",
"final",
"int",
"[",
"]",
"kTrustedMessages",
"=",
"{",
"JaguarCANProtocol",
".",
"LM_API_VOLT_T_EN",
",",
"JaguarCANProtocol",
".",
"LM_API_VOLT_T_SET",
",",
"JaguarCANProtocol",
".",
"LM_API_SPD_T_EN",
",",
"JaguarCANProtocol",
".",
"LM_API_SPD_T_SET",
",",
"JaguarCANProtocol",
".",
"LM_API_VCOMP_T_EN",
",",
"JaguarCANProtocol",
".",
"LM_API_VCOMP_T_SET",
",",
"JaguarCANProtocol",
".",
"LM_API_POS_T_EN",
",",
"JaguarCANProtocol",
".",
"LM_API_POS_T_SET",
",",
"JaguarCANProtocol",
".",
"LM_API_ICTRL_T_EN",
",",
"JaguarCANProtocol",
".",
"LM_API_ICTRL_T_SET",
"}",
";",
"byte",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"kTrustedMessages",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"(",
"kFullMessageIDMask",
"&",
"messageID",
")",
"==",
"kTrustedMessages",
"[",
"i",
"]",
")",
"{",
"sendTrustedDataBuffer",
"[",
"0",
"]",
"=",
"0",
";",
"sendTrustedDataBuffer",
"[",
"1",
"]",
"=",
"0",
";",
"if",
"(",
"dataSize",
">",
"JaguarCANDriver",
".",
"kMaxMessageDataSize",
"-",
"2",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"\"",
")",
";",
"}",
"byte",
"j",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"dataSize",
";",
"j",
"++",
")",
"{",
"sendTrustedDataBuffer",
"[",
"j",
"+",
"2",
"]",
"=",
"data",
"[",
"j",
"]",
";",
"}",
"JaguarCANDriver",
".",
"sendMessage",
"(",
"messageID",
",",
"sendTrustedDataBuffer",
",",
"dataSize",
"+",
"2",
")",
";",
"return",
";",
"}",
"}",
"JaguarCANDriver",
".",
"sendMessage",
"(",
"messageID",
",",
"data",
",",
"dataSize",
")",
";",
"}",
"protected",
"static",
"byte",
"receiveMessage",
"(",
"int",
"messageID",
",",
"byte",
"[",
"]",
"data",
",",
"double",
"timeout",
")",
"throws",
"CANTimeoutException",
"{",
"JaguarCANDriver",
"canDriver",
"=",
"new",
"JaguarCANDriver",
"(",
")",
";",
"byte",
"dataSize",
"=",
"canDriver",
".",
"receiveMessage",
"(",
"messageID",
",",
"data",
",",
"timeout",
")",
";",
"return",
"dataSize",
";",
"}",
"protected",
"static",
"byte",
"receiveMessage",
"(",
"int",
"messageID",
",",
"byte",
"[",
"]",
"data",
")",
"throws",
"CANTimeoutException",
"{",
"return",
"receiveMessage",
"(",
"messageID",
",",
"data",
",",
"0.01",
")",
";",
"}",
"protected",
"byte",
"setTransaction",
"(",
"int",
"messageID",
",",
"byte",
"[",
"]",
"data",
",",
"byte",
"dataSize",
")",
"throws",
"CANTimeoutException",
"{",
"int",
"ackMessageID",
"=",
"JaguarCANProtocol",
".",
"LM_API_ACK",
"|",
"m_deviceNumber",
";",
"synchronized",
"(",
"m_transactionMutex",
")",
"{",
"try",
"{",
"receiveMessage",
"(",
"ackMessageID",
",",
"kNoData",
",",
"0.0",
")",
";",
"}",
"catch",
"(",
"CANTimeoutException",
"e",
")",
"{",
"}",
"sendMessage",
"(",
"messageID",
"|",
"m_deviceNumber",
",",
"data",
",",
"dataSize",
")",
";",
"dataSize",
"=",
"receiveMessage",
"(",
"ackMessageID",
",",
"kNoData",
")",
";",
"}",
"return",
"dataSize",
";",
"}",
"protected",
"byte",
"getTransaction",
"(",
"int",
"messageID",
",",
"byte",
"[",
"]",
"data",
")",
"throws",
"CANTimeoutException",
"{",
"int",
"targetedMessageID",
"=",
"messageID",
"|",
"m_deviceNumber",
";",
"byte",
"dataSize",
"=",
"0",
";",
"synchronized",
"(",
"m_transactionMutex",
")",
"{",
"sendMessage",
"(",
"targetedMessageID",
",",
"kNoData",
",",
"0",
")",
";",
"targetedMessageID",
"&=",
"0x1FFFFFFF",
";",
"dataSize",
"=",
"receiveMessage",
"(",
"targetedMessageID",
",",
"data",
")",
";",
"}",
"return",
"dataSize",
";",
"}",
"public",
"void",
"setSpeedReference",
"(",
"SpeedReference",
"reference",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"dataBuffer",
"[",
"0",
"]",
"=",
"reference",
".",
"value",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_SPD_REF",
",",
"dataBuffer",
",",
"(",
"byte",
")",
"1",
")",
";",
"}",
"public",
"SpeedReference",
"getSpeedReference",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
"=",
"0",
";",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_SPD_REF",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"1",
")",
"{",
"switch",
"(",
"dataBuffer",
"[",
"0",
"]",
")",
"{",
"case",
"SpeedReference",
".",
"kEncoder_val",
":",
"return",
"SpeedReference",
".",
"kEncoder",
";",
"case",
"SpeedReference",
".",
"kInvEncoder_val",
":",
"return",
"SpeedReference",
".",
"kInvEncoder",
";",
"case",
"SpeedReference",
".",
"kQuadEncoder_val",
":",
"return",
"SpeedReference",
".",
"kQuadEncoder",
";",
"case",
"SpeedReference",
".",
"kNone_val",
":",
"return",
"SpeedReference",
".",
"kNone",
";",
"}",
"}",
"return",
"SpeedReference",
".",
"kNone",
";",
"}",
"public",
"void",
"setPositionReference",
"(",
"PositionReference",
"reference",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"dataBuffer",
"[",
"0",
"]",
"=",
"reference",
".",
"value",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_POS_REF",
",",
"dataBuffer",
",",
"(",
"byte",
")",
"1",
")",
";",
"}",
"public",
"PositionReference",
"getPositionReference",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
"=",
"0",
";",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_POS_REF",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"1",
")",
"{",
"switch",
"(",
"dataBuffer",
"[",
"0",
"]",
")",
"{",
"case",
"PositionReference",
".",
"kPotentiometer_val",
":",
"return",
"PositionReference",
".",
"kPotentiometer",
";",
"case",
"PositionReference",
".",
"kQuadEncoder_val",
":",
"return",
"PositionReference",
".",
"kQuadEncoder",
";",
"case",
"PositionReference",
".",
"kNone_val",
":",
"return",
"PositionReference",
".",
"kNone",
";",
"}",
"}",
"return",
"PositionReference",
".",
"kNone",
";",
"}",
"public",
"void",
"setPID",
"(",
"double",
"p",
",",
"double",
"i",
",",
"double",
"d",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
";",
"switch",
"(",
"m_controlMode",
".",
"value",
")",
"{",
"case",
"ControlMode",
".",
"kPercentVbus_val",
":",
"case",
"ControlMode",
".",
"kVoltage_val",
":",
"break",
";",
"case",
"ControlMode",
".",
"kSpeed_val",
":",
"dataSize",
"=",
"packFXP16_16",
"(",
"dataBuffer",
",",
"p",
")",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_SPD_PC",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"dataSize",
"=",
"packFXP16_16",
"(",
"dataBuffer",
",",
"i",
")",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_SPD_IC",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"dataSize",
"=",
"packFXP16_16",
"(",
"dataBuffer",
",",
"d",
")",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_SPD_DC",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"break",
";",
"case",
"ControlMode",
".",
"kPosition_val",
":",
"dataSize",
"=",
"packFXP16_16",
"(",
"dataBuffer",
",",
"p",
")",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_POS_PC",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"dataSize",
"=",
"packFXP16_16",
"(",
"dataBuffer",
",",
"i",
")",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_POS_IC",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"dataSize",
"=",
"packFXP16_16",
"(",
"dataBuffer",
",",
"d",
")",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_POS_DC",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"break",
";",
"case",
"ControlMode",
".",
"kCurrent_val",
":",
"dataSize",
"=",
"packFXP16_16",
"(",
"dataBuffer",
",",
"p",
")",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_ICTRL_PC",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"dataSize",
"=",
"packFXP16_16",
"(",
"dataBuffer",
",",
"i",
")",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_ICTRL_IC",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"dataSize",
"=",
"packFXP16_16",
"(",
"dataBuffer",
",",
"d",
")",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_ICTRL_DC",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"break",
";",
"}",
"}",
"public",
"double",
"getP",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
"=",
"0",
";",
"switch",
"(",
"m_controlMode",
".",
"value",
")",
"{",
"case",
"ControlMode",
".",
"kPercentVbus_val",
":",
"case",
"ControlMode",
".",
"kVoltage_val",
":",
"break",
";",
"case",
"ControlMode",
".",
"kSpeed_val",
":",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_SPD_PC",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"4",
")",
"{",
"return",
"unpackFXP16_16",
"(",
"dataBuffer",
")",
";",
"}",
"break",
";",
"case",
"ControlMode",
".",
"kPosition_val",
":",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_POS_PC",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"4",
")",
"{",
"return",
"unpackFXP16_16",
"(",
"dataBuffer",
")",
";",
"}",
"break",
";",
"case",
"ControlMode",
".",
"kCurrent_val",
":",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_ICTRL_PC",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"4",
")",
"{",
"return",
"unpackFXP16_16",
"(",
"dataBuffer",
")",
";",
"}",
"break",
";",
"}",
"return",
"0.0",
";",
"}",
"public",
"double",
"getI",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
"=",
"0",
";",
"switch",
"(",
"m_controlMode",
".",
"value",
")",
"{",
"case",
"ControlMode",
".",
"kPercentVbus_val",
":",
"case",
"ControlMode",
".",
"kVoltage_val",
":",
"break",
";",
"case",
"ControlMode",
".",
"kSpeed_val",
":",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_SPD_IC",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"4",
")",
"{",
"return",
"unpackFXP16_16",
"(",
"dataBuffer",
")",
";",
"}",
"break",
";",
"case",
"ControlMode",
".",
"kPosition_val",
":",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_POS_IC",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"4",
")",
"{",
"return",
"unpackFXP16_16",
"(",
"dataBuffer",
")",
";",
"}",
"break",
";",
"case",
"ControlMode",
".",
"kCurrent_val",
":",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_ICTRL_IC",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"4",
")",
"{",
"return",
"unpackFXP16_16",
"(",
"dataBuffer",
")",
";",
"}",
"break",
";",
"}",
"return",
"0.0",
";",
"}",
"public",
"double",
"getD",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
"=",
"0",
";",
"switch",
"(",
"m_controlMode",
".",
"value",
")",
"{",
"case",
"ControlMode",
".",
"kPercentVbus_val",
":",
"case",
"ControlMode",
".",
"kVoltage_val",
":",
"break",
";",
"case",
"ControlMode",
".",
"kSpeed_val",
":",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_SPD_DC",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"4",
")",
"{",
"return",
"unpackFXP16_16",
"(",
"dataBuffer",
")",
";",
"}",
"break",
";",
"case",
"ControlMode",
".",
"kPosition_val",
":",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_POS_DC",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"4",
")",
"{",
"return",
"unpackFXP16_16",
"(",
"dataBuffer",
")",
";",
"}",
"break",
";",
"case",
"ControlMode",
".",
"kCurrent_val",
":",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_ICTRL_DC",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"4",
")",
"{",
"return",
"unpackFXP16_16",
"(",
"dataBuffer",
")",
";",
"}",
"break",
";",
"}",
"return",
"0.0",
";",
"}",
"public",
"void",
"enableControl",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"enableControl",
"(",
"0.0",
")",
";",
"}",
"public",
"void",
"enableControl",
"(",
"double",
"encoderInitialPosition",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
"=",
"0",
";",
"switch",
"(",
"m_controlMode",
".",
"value",
")",
"{",
"case",
"ControlMode",
".",
"kPercentVbus_val",
":",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_VOLT_T_EN",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"break",
";",
"case",
"ControlMode",
".",
"kSpeed_val",
":",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_SPD_T_EN",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"break",
";",
"case",
"ControlMode",
".",
"kPosition_val",
":",
"dataSize",
"=",
"packFXP16_16",
"(",
"dataBuffer",
",",
"encoderInitialPosition",
")",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_POS_T_EN",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"break",
";",
"case",
"ControlMode",
".",
"kCurrent_val",
":",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_ICTRL_T_EN",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"break",
";",
"case",
"ControlMode",
".",
"kVoltage_val",
":",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_VCOMP_T_EN",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"break",
";",
"}",
"}",
"public",
"void",
"disableControl",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
"=",
"0",
";",
"switch",
"(",
"m_controlMode",
".",
"value",
")",
"{",
"case",
"ControlMode",
".",
"kPercentVbus_val",
":",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_VOLT_DIS",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"break",
";",
"case",
"ControlMode",
".",
"kSpeed_val",
":",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_SPD_DIS",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"break",
";",
"case",
"ControlMode",
".",
"kPosition_val",
":",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_POS_DIS",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"break",
";",
"case",
"ControlMode",
".",
"kCurrent_val",
":",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_ICTRL_DIS",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"break",
";",
"case",
"ControlMode",
".",
"kVoltage_val",
":",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_VCOMP_DIS",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"break",
";",
"}",
"}",
"public",
"void",
"changeControlMode",
"(",
"ControlMode",
"controlMode",
")",
"throws",
"CANTimeoutException",
"{",
"disableControl",
"(",
")",
";",
"m_controlMode",
"=",
"controlMode",
";",
"}",
"public",
"ControlMode",
"getControlMode",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
"=",
"0",
";",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_STATUS_CMODE",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"1",
")",
"{",
"switch",
"(",
"dataBuffer",
"[",
"0",
"]",
")",
"{",
"case",
"ControlMode",
".",
"kPercentVbus_val",
":",
"return",
"ControlMode",
".",
"kPercentVbus",
";",
"case",
"ControlMode",
".",
"kCurrent_val",
":",
"return",
"ControlMode",
".",
"kCurrent",
";",
"case",
"ControlMode",
".",
"kSpeed_val",
":",
"return",
"ControlMode",
".",
"kSpeed",
";",
"case",
"ControlMode",
".",
"kPosition_val",
":",
"return",
"ControlMode",
".",
"kPosition",
";",
"case",
"ControlMode",
".",
"kVoltage_val",
":",
"return",
"ControlMode",
".",
"kVoltage",
";",
"}",
"}",
"return",
"ControlMode",
".",
"kPercentVbus",
";",
"}",
"public",
"double",
"getBusVoltage",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
"=",
"0",
";",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_STATUS_VOLTBUS",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"2",
")",
"{",
"return",
"unpackFXP8_8",
"(",
"dataBuffer",
")",
";",
"}",
"return",
"0.0",
";",
"}",
"public",
"double",
"getOutputVoltage",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
"=",
"0",
";",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_STATUS_VOUT",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"2",
")",
"{",
"return",
"unpackFXP8_8",
"(",
"dataBuffer",
")",
";",
"}",
"return",
"0.0",
";",
"}",
"public",
"double",
"getOutputCurrent",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
";",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_STATUS_CURRENT",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"2",
")",
"{",
"return",
"unpackFXP8_8",
"(",
"dataBuffer",
")",
";",
"}",
"return",
"0.0",
";",
"}",
"public",
"double",
"getTemperature",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
";",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_STATUS_TEMP",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"2",
")",
"{",
"return",
"unpackFXP8_8",
"(",
"dataBuffer",
")",
";",
"}",
"return",
"0.0",
";",
"}",
"public",
"double",
"getPosition",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
";",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_STATUS_POS",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"4",
")",
"{",
"return",
"unpackFXP16_16",
"(",
"dataBuffer",
")",
";",
"}",
"return",
"0.0",
";",
"}",
"public",
"double",
"getSpeed",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
";",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_STATUS_SPD",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"4",
")",
"{",
"return",
"unpackFXP16_16",
"(",
"dataBuffer",
")",
";",
"}",
"return",
"0.0",
";",
"}",
"public",
"boolean",
"getForwardLimitOK",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
";",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_STATUS_LIMIT",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"1",
")",
"{",
"return",
"(",
"dataBuffer",
"[",
"0",
"]",
"&",
"Limits",
".",
"kForwardLimit_val",
")",
"!=",
"0",
";",
"}",
"return",
"false",
";",
"}",
"public",
"boolean",
"getReverseLimitOK",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
";",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_STATUS_LIMIT",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"1",
")",
"{",
"return",
"(",
"dataBuffer",
"[",
"0",
"]",
"&",
"Limits",
".",
"kReverseLimit_val",
")",
"!=",
"0",
";",
"}",
"return",
"false",
";",
"}",
"public",
"short",
"getFaults",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
";",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_STATUS_FAULT",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"2",
")",
"{",
"return",
"(",
"short",
")",
"unpackINT16",
"(",
"dataBuffer",
")",
";",
"}",
"return",
"0",
";",
"}",
"public",
"boolean",
"getPowerCycled",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
";",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_STATUS_POWER",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"1",
")",
"{",
"boolean",
"powerCycled",
"=",
"dataBuffer",
"[",
"0",
"]",
"!=",
"0",
";",
"if",
"(",
"powerCycled",
")",
"{",
"dataBuffer",
"[",
"0",
"]",
"=",
"1",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_STATUS_POWER",
",",
"dataBuffer",
",",
"(",
"byte",
")",
"1",
")",
";",
"}",
"return",
"powerCycled",
";",
"}",
"return",
"false",
";",
"}",
"public",
"void",
"setVoltageRampRate",
"(",
"double",
"rampRate",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
";",
"switch",
"(",
"m_controlMode",
".",
"value",
")",
"{",
"case",
"ControlMode",
".",
"kPercentVbus_val",
":",
"dataSize",
"=",
"packPercentage",
"(",
"dataBuffer",
",",
"rampRate",
"/",
"(",
"m_maxOutputVoltage",
"*",
"kControllerRate",
")",
")",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_VOLT_SET_RAMP",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"break",
";",
"case",
"ControlMode",
".",
"kVoltage_val",
":",
"dataSize",
"=",
"packFXP8_8",
"(",
"dataBuffer",
",",
"rampRate",
"/",
"kControllerRate",
")",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_VCOMP_IN_RAMP",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"break",
";",
"default",
":",
"return",
";",
"}",
"}",
"public",
"int",
"getFirmwareVersion",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
";",
"dataSize",
"=",
"getTransaction",
"(",
"0x80000000",
"|",
"JaguarCANProtocol",
".",
"CAN_MSGID_API_FIRMVER",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"4",
")",
"{",
"return",
"(",
"int",
")",
"unpackINT32",
"(",
"dataBuffer",
")",
";",
"}",
"return",
"0",
";",
"}",
"public",
"byte",
"getHardwareVersion",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
";",
"dataSize",
"=",
"getTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_HWVER",
",",
"dataBuffer",
")",
";",
"if",
"(",
"dataSize",
"==",
"1",
"+",
"1",
")",
"{",
"if",
"(",
"dataBuffer",
"[",
"0",
"]",
"==",
"m_deviceNumber",
")",
"{",
"return",
"dataBuffer",
"[",
"1",
"]",
";",
"}",
"}",
"return",
"JaguarCANProtocol",
".",
"LM_HWVER_JAG_1_0",
";",
"}",
"public",
"void",
"configNeutralMode",
"(",
"NeutralMode",
"mode",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"dataBuffer",
"[",
"0",
"]",
"=",
"mode",
".",
"value",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_CFG_BRAKE_COAST",
",",
"dataBuffer",
",",
"(",
"byte",
")",
"1",
")",
";",
"}",
"public",
"void",
"configEncoderCodesPerRev",
"(",
"int",
"codesPerRev",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
";",
"dataSize",
"=",
"packINT16",
"(",
"dataBuffer",
",",
"(",
"short",
")",
"codesPerRev",
")",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_CFG_ENC_LINES",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"}",
"public",
"void",
"configPotentiometerTurns",
"(",
"int",
"turns",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
";",
"dataSize",
"=",
"packINT16",
"(",
"dataBuffer",
",",
"(",
"short",
")",
"turns",
")",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_CFG_POT_TURNS",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"}",
"public",
"void",
"configSoftPositionLimits",
"(",
"double",
"forwardLimitPosition",
",",
"double",
"reverseLimitPosition",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
";",
"dataSize",
"=",
"packFXP16_16",
"(",
"dataBuffer",
",",
"forwardLimitPosition",
")",
";",
"dataBuffer",
"[",
"dataSize",
"++",
"]",
"=",
"(",
"forwardLimitPosition",
">",
"reverseLimitPosition",
")",
"?",
"(",
"byte",
")",
"1",
":",
"(",
"byte",
")",
"0",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_CFG_LIMIT_FWD",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"dataSize",
"=",
"packFXP16_16",
"(",
"dataBuffer",
",",
"reverseLimitPosition",
")",
";",
"dataBuffer",
"[",
"dataSize",
"++",
"]",
"=",
"forwardLimitPosition",
"<=",
"reverseLimitPosition",
"?",
"(",
"byte",
")",
"1",
":",
"(",
"byte",
")",
"0",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_CFG_LIMIT_REV",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"dataBuffer",
"[",
"0",
"]",
"=",
"LimitMode",
".",
"kSoftPositionLimit_val",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_CFG_LIMIT_MODE",
",",
"dataBuffer",
",",
"(",
"byte",
")",
"1",
")",
";",
"}",
"public",
"void",
"disableSoftPositionLimits",
"(",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"dataBuffer",
"[",
"0",
"]",
"=",
"LimitMode",
".",
"kSwitchInputsOnly_val",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_CFG_LIMIT_MODE",
",",
"dataBuffer",
",",
"(",
"byte",
")",
"1",
")",
";",
"}",
"public",
"void",
"configMaxOutputVoltage",
"(",
"double",
"voltage",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
";",
"m_maxOutputVoltage",
"=",
"voltage",
";",
"dataSize",
"=",
"packFXP8_8",
"(",
"dataBuffer",
",",
"voltage",
")",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_CFG_MAX_VOUT",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"}",
"public",
"void",
"configFaultTime",
"(",
"double",
"faultTime",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"byte",
"dataSize",
";",
"dataSize",
"=",
"packINT16",
"(",
"dataBuffer",
",",
"(",
"short",
")",
"(",
"faultTime",
"*",
"1000.0",
")",
")",
";",
"setTransaction",
"(",
"JaguarCANProtocol",
".",
"LM_API_CFG_FAULT_TIME",
",",
"dataBuffer",
",",
"dataSize",
")",
";",
"}",
"public",
"static",
"void",
"updateSyncGroup",
"(",
"byte",
"syncGroup",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"[",
"]",
"dataBuffer",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"dataBuffer",
"[",
"0",
"]",
"=",
"syncGroup",
";",
"sendMessage",
"(",
"JaguarCANProtocol",
".",
"CAN_MSGID_API_SYNC",
",",
"dataBuffer",
",",
"1",
")",
";",
"}",
"public",
"void",
"setExpiration",
"(",
"double",
"timeout",
")",
"{",
"m_safetyHelper",
".",
"setExpiration",
"(",
"timeout",
")",
";",
"}",
"public",
"double",
"getExpiration",
"(",
")",
"{",
"return",
"m_safetyHelper",
".",
"getExpiration",
"(",
")",
";",
"}",
"public",
"boolean",
"isAlive",
"(",
")",
"{",
"return",
"m_safetyHelper",
".",
"isAlive",
"(",
")",
";",
"}",
"public",
"boolean",
"isSafetyEnabled",
"(",
")",
"{",
"return",
"m_safetyHelper",
".",
"isSafetyEnabled",
"(",
")",
";",
"}",
"public",
"void",
"setSafetyEnabled",
"(",
"boolean",
"enabled",
")",
"{",
"m_safetyHelper",
".",
"setSafetyEnabled",
"(",
"enabled",
")",
";",
"}",
"public",
"void",
"stopMotor",
"(",
")",
"{",
"try",
"{",
"disableControl",
"(",
")",
";",
"}",
"catch",
"(",
"CANTimeoutException",
"e",
")",
"{",
"}",
"}",
"}",
"</s>"
] |
7,465 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"public",
"class",
"Module",
"extends",
"SensorBase",
"{",
"protected",
"static",
"Module",
"[",
"]",
"m_modules",
"=",
"new",
"Module",
"[",
"SensorBase",
".",
"kChassisSlots",
"]",
";",
"protected",
"int",
"m_slot",
";",
"protected",
"Module",
"(",
"final",
"int",
"slot",
")",
"{",
"m_slot",
"=",
"slot",
";",
"}",
"public",
"int",
"getSlot",
"(",
")",
"{",
"return",
"m_slot",
";",
"}",
"}",
"</s>"
] |
7,466 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"communication",
".",
"FRCControl",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"IInputOutput",
";",
"public",
"class",
"DriverStationLCD",
"extends",
"SensorBase",
"implements",
"IInputOutput",
"{",
"private",
"static",
"DriverStationLCD",
"m_instance",
";",
"public",
"static",
"final",
"int",
"kSyncTimeout_ms",
"=",
"20",
";",
"public",
"static",
"final",
"int",
"kFullDisplayTextCommand",
"=",
"0x9FFF",
";",
"public",
"static",
"final",
"int",
"kLineLength",
"=",
"21",
";",
"public",
"static",
"class",
"Line",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"int",
"kMain6_val",
"=",
"0",
";",
"static",
"final",
"int",
"kUser2_val",
"=",
"1",
";",
"static",
"final",
"int",
"kUser3_val",
"=",
"2",
";",
"static",
"final",
"int",
"kUser4_val",
"=",
"3",
";",
"static",
"final",
"int",
"kUser5_val",
"=",
"4",
";",
"static",
"final",
"int",
"kUser6_val",
"=",
"5",
";",
"public",
"static",
"final",
"Line",
"kMain6",
"=",
"new",
"Line",
"(",
"kMain6_val",
")",
";",
"public",
"static",
"final",
"Line",
"kUser2",
"=",
"new",
"Line",
"(",
"kUser2_val",
")",
";",
"public",
"static",
"final",
"Line",
"kUser3",
"=",
"new",
"Line",
"(",
"kUser3_val",
")",
";",
"public",
"static",
"final",
"Line",
"kUser4",
"=",
"new",
"Line",
"(",
"kUser4_val",
")",
";",
"public",
"static",
"final",
"Line",
"kUser5",
"=",
"new",
"Line",
"(",
"kUser5_val",
")",
";",
"public",
"static",
"final",
"Line",
"kUser6",
"=",
"new",
"Line",
"(",
"kUser6_val",
")",
";",
"private",
"Line",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"byte",
"[",
"]",
"m_textBuffer",
";",
"public",
"static",
"synchronized",
"DriverStationLCD",
"getInstance",
"(",
")",
"{",
"if",
"(",
"m_instance",
"==",
"null",
")",
"m_instance",
"=",
"new",
"DriverStationLCD",
"(",
")",
";",
"return",
"m_instance",
";",
"}",
"private",
"DriverStationLCD",
"(",
")",
"{",
"m_textBuffer",
"=",
"new",
"byte",
"[",
"FRCControl",
".",
"USER_DS_LCD_DATA_SIZE",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"FRCControl",
".",
"USER_DS_LCD_DATA_SIZE",
";",
"i",
"++",
")",
"{",
"m_textBuffer",
"[",
"i",
"]",
"=",
"'",
"'",
";",
"}",
"m_textBuffer",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"(",
"kFullDisplayTextCommand",
">>",
"8",
")",
";",
"m_textBuffer",
"[",
"1",
"]",
"=",
"(",
"byte",
")",
"kFullDisplayTextCommand",
";",
"}",
"public",
"synchronized",
"void",
"updateLCD",
"(",
")",
"{",
"FRCControl",
".",
"setUserDsLcdData",
"(",
"m_textBuffer",
",",
"FRCControl",
".",
"USER_DS_LCD_DATA_SIZE",
",",
"kSyncTimeout_ms",
")",
";",
"}",
"public",
"void",
"println",
"(",
"Line",
"line",
",",
"int",
"startingColumn",
",",
"String",
"text",
")",
"{",
"int",
"start",
"=",
"startingColumn",
"-",
"1",
";",
"int",
"maxLength",
"=",
"kLineLength",
"-",
"start",
";",
"if",
"(",
"startingColumn",
"<",
"1",
"||",
"startingColumn",
">",
"kLineLength",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"\"",
"+",
"kLineLength",
"+",
"\",",
"inclusive\"",
")",
";",
"}",
"int",
"length",
"=",
"text",
".",
"length",
"(",
")",
";",
"int",
"finalLength",
"=",
"(",
"length",
"<",
"maxLength",
"?",
"length",
":",
"maxLength",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"finalLength",
";",
"i",
"++",
")",
"{",
"m_textBuffer",
"[",
"i",
"+",
"start",
"+",
"line",
".",
"value",
"*",
"kLineLength",
"+",
"2",
"]",
"=",
"(",
"byte",
")",
"text",
".",
"charAt",
"(",
"i",
")",
";",
"}",
"}",
"}",
"public",
"void",
"println",
"(",
"Line",
"line",
",",
"int",
"startingColumn",
",",
"StringBuffer",
"text",
")",
"{",
"int",
"start",
"=",
"startingColumn",
"-",
"1",
";",
"int",
"maxLength",
"=",
"kLineLength",
"-",
"start",
";",
"if",
"(",
"startingColumn",
"<",
"1",
"||",
"startingColumn",
">",
"kLineLength",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"\"",
"+",
"kLineLength",
"+",
"\",",
"inclusive\"",
")",
";",
"}",
"int",
"length",
"=",
"text",
".",
"length",
"(",
")",
";",
"int",
"finalLength",
"=",
"(",
"length",
"<",
"maxLength",
"?",
"length",
":",
"maxLength",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"finalLength",
";",
"i",
"++",
")",
"{",
"m_textBuffer",
"[",
"i",
"+",
"start",
"+",
"line",
".",
"value",
"*",
"kLineLength",
"+",
"2",
"]",
"=",
"(",
"byte",
")",
"text",
".",
"charAt",
"(",
"i",
")",
";",
"}",
"}",
"}",
"}",
"</s>"
] |
7,467 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"ISensor",
";",
"public",
"class",
"Gyro",
"extends",
"SensorBase",
"implements",
"PIDSource",
",",
"ISensor",
"{",
"static",
"final",
"int",
"kOversampleBits",
"=",
"10",
";",
"static",
"final",
"int",
"kAverageBits",
"=",
"0",
";",
"static",
"final",
"double",
"kSamplesPerSecond",
"=",
"50.0",
";",
"static",
"final",
"double",
"kCalibrationSampleTime",
"=",
"5.0",
";",
"static",
"final",
"double",
"kDefaultVoltsPerDegreePerSecond",
"=",
"0.007",
";",
"AnalogChannel",
"m_analog",
";",
"double",
"m_voltsPerDegreePerSecond",
";",
"double",
"m_offset",
";",
"boolean",
"m_channelAllocated",
";",
"AccumulatorResult",
"result",
";",
"private",
"void",
"initGyro",
"(",
")",
"{",
"result",
"=",
"new",
"AccumulatorResult",
"(",
")",
";",
"if",
"(",
"m_analog",
"==",
"null",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"m_voltsPerDegreePerSecond",
"=",
"kDefaultVoltsPerDegreePerSecond",
";",
"m_analog",
".",
"setAverageBits",
"(",
"kAverageBits",
")",
";",
"m_analog",
".",
"setOversampleBits",
"(",
"kOversampleBits",
")",
";",
"double",
"sampleRate",
"=",
"kSamplesPerSecond",
"*",
"(",
"1",
"<<",
"(",
"kAverageBits",
"+",
"kOversampleBits",
")",
")",
";",
"m_analog",
".",
"getModule",
"(",
")",
".",
"setSampleRate",
"(",
"sampleRate",
")",
";",
"Timer",
".",
"delay",
"(",
"1.0",
")",
";",
"m_analog",
".",
"initAccumulator",
"(",
")",
";",
"Timer",
".",
"delay",
"(",
"kCalibrationSampleTime",
")",
";",
"m_analog",
".",
"getAccumulatorOutput",
"(",
"result",
")",
";",
"int",
"center",
"=",
"(",
"int",
")",
"(",
"(",
"double",
")",
"result",
".",
"value",
"/",
"(",
"double",
")",
"result",
".",
"count",
"+",
".5",
")",
";",
"m_offset",
"=",
"(",
"(",
"double",
")",
"result",
".",
"value",
"/",
"(",
"double",
")",
"result",
".",
"count",
")",
"-",
"(",
"double",
")",
"center",
";",
"m_analog",
".",
"setAccumulatorCenter",
"(",
"center",
")",
";",
"m_analog",
".",
"setAccumulatorDeadband",
"(",
"0",
")",
";",
"m_analog",
".",
"resetAccumulator",
"(",
")",
";",
"}",
"public",
"Gyro",
"(",
"int",
"slot",
",",
"int",
"channel",
")",
"{",
"m_analog",
"=",
"new",
"AnalogChannel",
"(",
"slot",
",",
"channel",
")",
";",
"m_channelAllocated",
"=",
"true",
";",
"initGyro",
"(",
")",
";",
"}",
"public",
"Gyro",
"(",
"int",
"channel",
")",
"{",
"m_analog",
"=",
"new",
"AnalogChannel",
"(",
"channel",
")",
";",
"m_channelAllocated",
"=",
"true",
";",
"initGyro",
"(",
")",
";",
"}",
"public",
"Gyro",
"(",
"AnalogChannel",
"channel",
")",
"{",
"m_analog",
"=",
"channel",
";",
"if",
"(",
"m_analog",
"==",
"null",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"else",
"{",
"m_channelAllocated",
"=",
"false",
";",
"initGyro",
"(",
")",
";",
"}",
"}",
"public",
"void",
"reset",
"(",
")",
"{",
"if",
"(",
"m_analog",
"!=",
"null",
")",
"{",
"m_analog",
".",
"resetAccumulator",
"(",
")",
";",
"}",
"}",
"protected",
"void",
"free",
"(",
")",
"{",
"if",
"(",
"m_analog",
"!=",
"null",
"&&",
"m_channelAllocated",
")",
"{",
"m_analog",
".",
"free",
"(",
")",
";",
"}",
"m_analog",
"=",
"null",
";",
"}",
"public",
"double",
"getAngle",
"(",
")",
"{",
"if",
"(",
"m_analog",
"==",
"null",
")",
"{",
"return",
"0.0",
";",
"}",
"else",
"{",
"m_analog",
".",
"getAccumulatorOutput",
"(",
"result",
")",
";",
"long",
"value",
"=",
"result",
".",
"value",
"-",
"(",
"long",
")",
"(",
"result",
".",
"count",
"*",
"m_offset",
")",
";",
"double",
"scaledValue",
"=",
"value",
"*",
"1e-9",
"*",
"m_analog",
".",
"getLSBWeight",
"(",
")",
"*",
"(",
"1",
"<<",
"m_analog",
".",
"getAverageBits",
"(",
")",
")",
"/",
"(",
"m_analog",
".",
"getModule",
"(",
")",
".",
"getSampleRate",
"(",
")",
"*",
"m_voltsPerDegreePerSecond",
")",
";",
"return",
"scaledValue",
";",
"}",
"}",
"public",
"void",
"setSensitivity",
"(",
"double",
"voltsPerDegreePerSecond",
")",
"{",
"m_voltsPerDegreePerSecond",
"=",
"voltsPerDegreePerSecond",
";",
"}",
"public",
"double",
"pidGet",
"(",
")",
"{",
"return",
"getAngle",
"(",
")",
";",
"}",
"}",
"</s>"
] |
7,468 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"public",
"interface",
"CounterBase",
"{",
"public",
"static",
"class",
"EncodingType",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"int",
"k1X_val",
"=",
"0",
";",
"static",
"final",
"int",
"k2X_val",
"=",
"1",
";",
"static",
"final",
"int",
"k4X_val",
"=",
"2",
";",
"public",
"static",
"final",
"EncodingType",
"k1X",
"=",
"new",
"EncodingType",
"(",
"k1X_val",
")",
";",
"public",
"static",
"final",
"EncodingType",
"k2X",
"=",
"new",
"EncodingType",
"(",
"k2X_val",
")",
";",
"public",
"static",
"final",
"EncodingType",
"k4X",
"=",
"new",
"EncodingType",
"(",
"k4X_val",
")",
";",
"private",
"EncodingType",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"void",
"start",
"(",
")",
";",
"int",
"get",
"(",
")",
";",
"void",
"reset",
"(",
")",
";",
"void",
"stop",
"(",
")",
";",
"double",
"getPeriod",
"(",
")",
";",
"void",
"setMaxPeriod",
"(",
"double",
"maxPeriod",
")",
";",
"boolean",
"getStopped",
"(",
")",
";",
"boolean",
"getDirection",
"(",
")",
";",
"}",
"</s>"
] |
7,469 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"visa",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"Function",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"NativeLibrary",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"Pointer",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"ptr",
".",
"IntByReference",
";",
"public",
"class",
"Visa",
"{",
"private",
"static",
"int",
"status",
";",
"private",
"static",
"final",
"IntByReference",
"pValue",
"=",
"new",
"IntByReference",
"(",
"0",
")",
";",
"public",
"static",
"final",
"int",
"VI_ATTR_ASRL_BAUD",
"=",
"(",
"0x3FFF0021",
")",
";",
"public",
"static",
"final",
"int",
"VI_ATTR_ASRL_DATA_BITS",
"=",
"(",
"0x3FFF0022",
")",
";",
"public",
"static",
"final",
"int",
"VI_ATTR_ASRL_PARITY",
"=",
"(",
"0x3FFF0023",
")",
";",
"public",
"static",
"final",
"int",
"VI_ATTR_ASRL_STOP_BITS",
"=",
"(",
"0x3FFF0024",
")",
";",
"public",
"static",
"final",
"int",
"VI_ATTR_ASRL_FLOW_CNTRL",
"=",
"(",
"0x3FFF0025",
")",
";",
"public",
"static",
"final",
"int",
"VI_ATTR_TERMCHAR_EN",
"=",
"(",
"0x3FFF0038",
")",
";",
"public",
"static",
"final",
"int",
"VI_ATTR_TERMCHAR",
"=",
"(",
"0x3FFF0018",
")",
";",
"public",
"static",
"final",
"int",
"VI_ATTR_ASRL_END_IN",
"=",
"(",
"0x3FFF00B3",
")",
";",
"public",
"static",
"final",
"int",
"VI_ASRL_END_TERMCHAR",
"=",
"2",
";",
"public",
"static",
"final",
"int",
"VI_ASRL_END_NONE",
"=",
"0",
";",
"public",
"static",
"final",
"int",
"VI_ATTR_ASRL_AVAIL_NUM",
"=",
"(",
"0x3FFF00AC",
")",
";",
"public",
"static",
"final",
"int",
"VI_SUCCESS_TERM_CHAR",
"=",
"(",
"0x3FFF0005",
")",
";",
"public",
"static",
"final",
"int",
"VI_SUCCESS_MAX_CNT",
"=",
"(",
"0x3FFF0006",
")",
";",
"public",
"static",
"final",
"int",
"VI_ATTR_TMO_VALUE",
"=",
"(",
"0x3FFF001A",
")",
";",
"public",
"static",
"final",
"int",
"VI_ATTR_WR_BUF_OPER_MODE",
"=",
"(",
"0x3FFF002D",
")",
";",
"public",
"static",
"final",
"int",
"VI_WRITE_BUF",
"=",
"2",
";",
"private",
"static",
"final",
"Function",
"viOpenDefaultRMFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"synchronized",
"static",
"int",
"viOpenDefaultRM",
"(",
")",
"throws",
"VisaException",
"{",
"status",
"=",
"viOpenDefaultRMFn",
".",
"call1",
"(",
"pValue",
".",
"getPointer",
"(",
")",
")",
";",
"assertCleanStatus",
"(",
"\"\"",
")",
";",
"return",
"pValue",
".",
"getValue",
"(",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"viOpenFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"viOpen\"",
")",
";",
"public",
"synchronized",
"static",
"int",
"viOpen",
"(",
"int",
"sesn",
",",
"String",
"name",
",",
"int",
"mode",
",",
"int",
"timeout",
")",
"throws",
"VisaException",
"{",
"Pointer",
"pName",
"=",
"new",
"Pointer",
"(",
"name",
".",
"length",
"(",
")",
")",
";",
"pName",
".",
"setBytes",
"(",
"0",
",",
"name",
".",
"getBytes",
"(",
")",
",",
"0",
",",
"name",
".",
"length",
"(",
")",
")",
";",
"status",
"=",
"viOpenFn",
".",
"call5",
"(",
"sesn",
",",
"pName",
",",
"mode",
",",
"timeout",
",",
"pValue",
".",
"getPointer",
"(",
")",
")",
";",
"assertCleanStatus",
"(",
"\"viOpen\"",
")",
";",
"pName",
".",
"free",
"(",
")",
";",
"return",
"pValue",
".",
"getValue",
"(",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"viSetAttributeFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"static",
"void",
"viSetAttribute",
"(",
"int",
"vi",
",",
"int",
"attrName",
",",
"int",
"attrValue",
")",
"throws",
"VisaException",
"{",
"status",
"=",
"viSetAttributeFn",
".",
"call3",
"(",
"vi",
",",
"attrName",
",",
"attrValue",
")",
";",
"assertCleanStatus",
"(",
"\"\"",
")",
";",
"}",
"public",
"static",
"void",
"viSetAttribute",
"(",
"int",
"vi",
",",
"int",
"attrName",
",",
"boolean",
"attrValue",
")",
"throws",
"VisaException",
"{",
"status",
"=",
"viSetAttributeFn",
".",
"call3",
"(",
"vi",
",",
"attrName",
",",
"attrValue",
"?",
"1",
":",
"0",
")",
";",
"assertCleanStatus",
"(",
"\"\"",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"viCloseFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"viClose\"",
")",
";",
"public",
"static",
"void",
"viClose",
"(",
"int",
"vi",
")",
"{",
"viCloseFn",
".",
"call1",
"(",
"vi",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"viGetAttributeFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"synchronized",
"static",
"int",
"viGetAttribute",
"(",
"int",
"vi",
",",
"int",
"attrName",
")",
"throws",
"VisaException",
"{",
"status",
"=",
"viGetAttributeFn",
".",
"call3",
"(",
"vi",
",",
"attrName",
",",
"pValue",
".",
"getPointer",
"(",
")",
")",
";",
"assertCleanStatus",
"(",
"\"\"",
")",
";",
"return",
"pValue",
".",
"getValue",
"(",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"viVPrintfFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"viVPrintf\"",
")",
";",
"public",
"static",
"void",
"viVPrintf",
"(",
"int",
"vi",
",",
"String",
"write",
")",
"throws",
"VisaException",
"{",
"Pointer",
"string",
"=",
"new",
"Pointer",
"(",
"write",
".",
"length",
"(",
")",
")",
";",
"string",
".",
"setBytes",
"(",
"0",
",",
"write",
".",
"getBytes",
"(",
")",
",",
"0",
",",
"write",
".",
"length",
"(",
")",
")",
";",
"status",
"=",
"viVPrintfFn",
".",
"call2",
"(",
"vi",
",",
"string",
")",
";",
"string",
".",
"free",
"(",
")",
";",
"assertCleanStatus",
"(",
"\"viPrintf\"",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"viBufReadFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"viBufRead\"",
")",
";",
"public",
"static",
"byte",
"[",
"]",
"viBufRead",
"(",
"int",
"vi",
",",
"int",
"cnt",
")",
"throws",
"VisaException",
"{",
"Pointer",
"bytes",
"=",
"new",
"Pointer",
"(",
"cnt",
")",
";",
"status",
"=",
"viBufReadFn",
".",
"call2",
"(",
"vi",
",",
"bytes",
")",
";",
"switch",
"(",
"status",
")",
"{",
"case",
"VI_SUCCESS_TERM_CHAR",
":",
"case",
"VI_SUCCESS_MAX_CNT",
":",
"status",
"=",
"0",
";",
"break",
";",
"default",
":",
"assertCleanStatus",
"(",
"\"viBufRead\"",
")",
";",
"}",
"byte",
"[",
"]",
"toReturn",
"=",
"new",
"byte",
"[",
"cnt",
"]",
";",
"bytes",
".",
"getBytes",
"(",
"0",
",",
"toReturn",
",",
"0",
",",
"cnt",
")",
";",
"bytes",
".",
"free",
"(",
")",
";",
"return",
"toReturn",
";",
"}",
"private",
"static",
"final",
"Function",
"viBufWriteFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"viBufWrite\"",
")",
";",
"public",
"synchronized",
"static",
"int",
"viBufWrite",
"(",
"int",
"vi",
",",
"byte",
"[",
"]",
"buf",
",",
"int",
"cnt",
")",
"throws",
"VisaException",
"{",
"Pointer",
"string",
"=",
"new",
"Pointer",
"(",
"buf",
".",
"length",
")",
";",
"string",
".",
"setBytes",
"(",
"0",
",",
"buf",
",",
"0",
",",
"buf",
".",
"length",
")",
";",
"status",
"=",
"viBufWriteFn",
".",
"call4",
"(",
"vi",
",",
"string",
",",
"cnt",
",",
"pValue",
".",
"getPointer",
"(",
")",
")",
";",
"assertCleanStatus",
"(",
"\"viBufWrite\"",
")",
";",
"string",
".",
"free",
"(",
")",
";",
"return",
"pValue",
".",
"getValue",
"(",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"viFlushFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"viFlush\"",
")",
";",
"public",
"static",
"void",
"viFlush",
"(",
"int",
"vi",
",",
"int",
"mask",
")",
"throws",
"VisaException",
"{",
"status",
"=",
"viFlushFn",
".",
"call2",
"(",
"vi",
",",
"mask",
")",
";",
"assertCleanStatus",
"(",
"\"viFlush\"",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"viClearFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"viClear\"",
")",
";",
"public",
"static",
"void",
"viClear",
"(",
"int",
"vi",
")",
"throws",
"VisaException",
"{",
"viClearFn",
".",
"call1",
"(",
"vi",
")",
";",
"assertCleanStatus",
"(",
"\"viClear\"",
")",
";",
"}",
"protected",
"static",
"final",
"void",
"assertCleanStatus",
"(",
"String",
"function",
")",
"throws",
"VisaException",
"{",
"if",
"(",
"status",
"<",
"0",
")",
"{",
"throw",
"new",
"VisaException",
"(",
"function",
",",
"status",
")",
";",
"}",
"else",
"if",
"(",
"status",
"!=",
"0",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"VisaException",
".",
"makeMessage",
"(",
"function",
",",
"status",
")",
")",
";",
"status",
"=",
"0",
";",
"}",
"}",
"private",
"Visa",
"(",
")",
"{",
"}",
"}",
"</s>"
] |
7,470 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"visa",
";",
"public",
"class",
"VisaException",
"extends",
"Exception",
"{",
"public",
"VisaException",
"(",
"String",
"function",
",",
"int",
"errorCode",
")",
"{",
"super",
"(",
"makeMessage",
"(",
"function",
",",
"errorCode",
")",
")",
";",
"}",
"public",
"static",
"String",
"makeMessage",
"(",
"String",
"function",
",",
"int",
"errorCode",
")",
"{",
"return",
"lookUpCode",
"(",
"errorCode",
")",
"+",
"\"\"",
"+",
"function",
";",
"}",
"public",
"static",
"String",
"lookUpCode",
"(",
"int",
"errorCode",
")",
"{",
"switch",
"(",
"errorCode",
")",
"{",
"case",
"-",
"1073807360",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807346",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807345",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807344",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807343",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807342",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807341",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807339",
":",
"return",
"\"VI_ERROR_TMO\"",
";",
"case",
"-",
"1073807338",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807333",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807332",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807331",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807330",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807329",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807328",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807327",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807322",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807321",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807320",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807319",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807318",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807315",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807313",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807312",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807308",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807307",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807306",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807305",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807304",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807303",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807302",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807301",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807300",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807299",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807298",
":",
"return",
"\"VI_ERROR_IO\"",
";",
"case",
"-",
"1073807297",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807295",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807294",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807290",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807286",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807282",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807279",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807278",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807276",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807275",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807273",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807271",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807265",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807264",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807263",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807257",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807256",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807254",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807253",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807252",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807250",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807248",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807247",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807246",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807242",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807240",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807239",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807237",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807232",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807231",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807229",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807215",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807204",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807203",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807202",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807201",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807200",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807199",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807198",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807197",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807196",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807195",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807194",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807193",
":",
"return",
"\"\"",
";",
"case",
"-",
"1073807192",
":",
"return",
"\"\"",
";",
"default",
":",
"return",
"\"\"",
";",
"}",
"}",
"}",
"</s>"
] |
7,471 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
".",
"tSolenoid",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"IDeviceController",
";",
"public",
"abstract",
"class",
"SolenoidBase",
"extends",
"SensorBase",
"implements",
"IDeviceController",
"{",
"protected",
"int",
"m_chassisSlot",
";",
"protected",
"static",
"Resource",
"m_allocated",
"=",
"new",
"Resource",
"(",
"tSolenoid",
".",
"kDO7_0_NumElements",
"*",
"kSolenoidChannels",
")",
";",
"private",
"static",
"tSolenoid",
"m_fpgaSolenoidModule",
";",
"private",
"static",
"int",
"m_refCount",
";",
"public",
"SolenoidBase",
"(",
"final",
"int",
"slot",
")",
"{",
"m_chassisSlot",
"=",
"slot",
";",
"checkSolenoidModule",
"(",
"m_chassisSlot",
")",
";",
"m_refCount",
"++",
";",
"if",
"(",
"m_refCount",
"==",
"1",
")",
"{",
"m_fpgaSolenoidModule",
"=",
"new",
"tSolenoid",
"(",
")",
";",
"}",
"}",
"protected",
"synchronized",
"void",
"free",
"(",
")",
"{",
"if",
"(",
"m_refCount",
"==",
"1",
")",
"{",
"m_fpgaSolenoidModule",
".",
"Release",
"(",
")",
";",
"m_fpgaSolenoidModule",
"=",
"null",
";",
"}",
"m_refCount",
"--",
";",
"}",
"protected",
"int",
"slotToIndex",
"(",
"final",
"int",
"slot",
")",
"{",
"return",
"8",
"-",
"slot",
";",
"}",
"protected",
"synchronized",
"void",
"set",
"(",
"int",
"value",
",",
"int",
"mask",
")",
"{",
"byte",
"currentValue",
"=",
"(",
"byte",
")",
"tSolenoid",
".",
"readDO7_0",
"(",
"slotToIndex",
"(",
"m_chassisSlot",
")",
")",
";",
"currentValue",
"=",
"(",
"byte",
")",
"(",
"currentValue",
"&",
"~",
"mask",
")",
";",
"currentValue",
"=",
"(",
"byte",
")",
"(",
"currentValue",
"|",
"(",
"value",
"&",
"mask",
")",
")",
";",
"tSolenoid",
".",
"writeDO7_0",
"(",
"slotToIndex",
"(",
"m_chassisSlot",
")",
",",
"currentValue",
")",
";",
"}",
"public",
"byte",
"getAll",
"(",
")",
"{",
"return",
"(",
"byte",
")",
"tSolenoid",
".",
"readDO7_0",
"(",
"slotToIndex",
"(",
"m_chassisSlot",
")",
")",
";",
"}",
"}",
"</s>"
] |
7,472 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"IDeviceController",
";",
"public",
"class",
"Jaguar",
"extends",
"SafePWM",
"implements",
"SpeedController",
",",
"IDeviceController",
"{",
"private",
"void",
"initJaguar",
"(",
")",
"{",
"setBounds",
"(",
"251",
",",
"135",
",",
"128",
",",
"120",
",",
"4",
")",
";",
"setPeriodMultiplier",
"(",
"PeriodMultiplier",
".",
"k1X",
")",
";",
"setRaw",
"(",
"m_centerPwm",
")",
";",
"}",
"public",
"Jaguar",
"(",
"final",
"int",
"channel",
")",
"{",
"super",
"(",
"channel",
")",
";",
"initJaguar",
"(",
")",
";",
"}",
"public",
"Jaguar",
"(",
"final",
"int",
"slot",
",",
"final",
"int",
"channel",
")",
"{",
"super",
"(",
"slot",
",",
"channel",
")",
";",
"initJaguar",
"(",
")",
";",
"}",
"public",
"void",
"set",
"(",
"double",
"speed",
",",
"byte",
"syncGroup",
")",
"{",
"setSpeed",
"(",
"speed",
")",
";",
"}",
"public",
"void",
"set",
"(",
"double",
"speed",
")",
"{",
"setSpeed",
"(",
"speed",
")",
";",
"}",
"public",
"double",
"get",
"(",
")",
"{",
"return",
"getSpeed",
"(",
")",
";",
"}",
"public",
"void",
"pidWrite",
"(",
"double",
"output",
")",
"{",
"set",
"(",
"output",
")",
";",
"}",
"}",
"</s>"
] |
7,473 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"IDevice",
";",
"public",
"class",
"Servo",
"extends",
"PWM",
"implements",
"IDevice",
"{",
"private",
"static",
"final",
"double",
"kMaxServoAngle",
"=",
"170.0",
";",
"private",
"static",
"final",
"double",
"kMinServoAngle",
"=",
"0.0",
";",
"private",
"void",
"initServo",
"(",
")",
"{",
"setBounds",
"(",
"245",
",",
"0",
",",
"0",
",",
"0",
",",
"11",
")",
";",
"setPeriodMultiplier",
"(",
"PeriodMultiplier",
".",
"k4X",
")",
";",
"}",
"public",
"Servo",
"(",
"final",
"int",
"channel",
")",
"{",
"super",
"(",
"channel",
")",
";",
"initServo",
"(",
")",
";",
"}",
"public",
"Servo",
"(",
"final",
"int",
"slot",
",",
"final",
"int",
"channel",
")",
"{",
"super",
"(",
"slot",
",",
"channel",
")",
";",
"initServo",
"(",
")",
";",
"}",
"public",
"void",
"set",
"(",
"double",
"value",
")",
"{",
"setPosition",
"(",
"value",
")",
";",
"}",
"public",
"double",
"get",
"(",
")",
"{",
"return",
"getPosition",
"(",
")",
";",
"}",
"public",
"void",
"setAngle",
"(",
"double",
"degrees",
")",
"{",
"if",
"(",
"degrees",
"<",
"kMinServoAngle",
")",
"{",
"degrees",
"=",
"kMinServoAngle",
";",
"}",
"else",
"if",
"(",
"degrees",
">",
"kMaxServoAngle",
")",
"{",
"degrees",
"=",
"kMaxServoAngle",
";",
"}",
"setPosition",
"(",
"(",
"(",
"degrees",
"-",
"kMinServoAngle",
")",
")",
"/",
"getServoAngleRange",
"(",
")",
")",
";",
"}",
"public",
"double",
"getAngle",
"(",
")",
"{",
"return",
"getPosition",
"(",
")",
"*",
"getServoAngleRange",
"(",
")",
"+",
"kMinServoAngle",
";",
"}",
"private",
"double",
"getServoAngleRange",
"(",
")",
"{",
"return",
"kMaxServoAngle",
"-",
"kMinServoAngle",
";",
"}",
"}",
"</s>"
] |
7,474 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"image",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"Structure",
";",
"public",
"class",
"RegionOfInterest",
"extends",
"Structure",
"{",
"public",
"void",
"read",
"(",
")",
"{",
"}",
"public",
"void",
"write",
"(",
")",
"{",
"}",
"public",
"int",
"size",
"(",
")",
"{",
"return",
"0",
";",
"}",
"}",
"</s>"
] |
7,475 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"image",
";",
"public",
"class",
"RGBImage",
"extends",
"ColorImage",
"{",
"public",
"RGBImage",
"(",
")",
"throws",
"NIVisionException",
"{",
"super",
"(",
"NIVision",
".",
"ImageType",
".",
"imaqImageRGB",
")",
";",
"}",
"RGBImage",
"(",
"RGBImage",
"sourceImage",
")",
"{",
"super",
"(",
"sourceImage",
")",
";",
"}",
"public",
"RGBImage",
"(",
"String",
"fileName",
")",
"throws",
"NIVisionException",
"{",
"super",
"(",
"NIVision",
".",
"ImageType",
".",
"imaqImageRGB",
")",
";",
"NIVision",
".",
"readFile",
"(",
"image",
",",
"fileName",
")",
";",
"}",
"}",
"</s>"
] |
7,476 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"image",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"Pointer",
";",
"public",
"abstract",
"class",
"Image",
"{",
"public",
"final",
"Pointer",
"image",
";",
"static",
"final",
"int",
"DEFAULT_BORDER_SIZE",
"=",
"3",
";",
"Image",
"(",
"NIVision",
".",
"ImageType",
"type",
")",
"throws",
"NIVisionException",
"{",
"image",
"=",
"NIVision",
".",
"imaqCreateImage",
"(",
"type",
",",
"DEFAULT_BORDER_SIZE",
")",
";",
"}",
"Image",
"(",
"Image",
"sourceImage",
")",
"{",
"image",
"=",
"sourceImage",
".",
"image",
";",
"}",
"public",
"void",
"write",
"(",
"String",
"fileName",
")",
"throws",
"NIVisionException",
"{",
"NIVision",
".",
"writeFile",
"(",
"image",
",",
"fileName",
")",
";",
"}",
"public",
"void",
"free",
"(",
")",
"throws",
"NIVisionException",
"{",
"NIVision",
".",
"dispose",
"(",
"image",
")",
";",
"}",
"public",
"int",
"getHeight",
"(",
")",
"throws",
"NIVisionException",
"{",
"return",
"NIVision",
".",
"getHeight",
"(",
"image",
")",
";",
"}",
"public",
"int",
"getWidth",
"(",
")",
"throws",
"NIVisionException",
"{",
"return",
"NIVision",
".",
"getWidth",
"(",
"image",
")",
";",
"}",
"}",
"</s>"
] |
7,477 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"image",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"Structure",
";",
"public",
"class",
"CurveOptions",
"extends",
"Structure",
"{",
"int",
"m_extractionMode",
";",
"int",
"m_threshold",
";",
"int",
"m_filterSize",
";",
"int",
"m_minLength",
";",
"int",
"m_rowStepSize",
";",
"int",
"m_columnStepSize",
";",
"int",
"m_maxEndPointGap",
";",
"int",
"m_onlyClosed",
";",
"int",
"m_subPixelAccuracy",
";",
"public",
"CurveOptions",
"(",
"int",
"m_extractionMode",
",",
"int",
"m_threshold",
",",
"int",
"m_filterSize",
",",
"int",
"m_minLength",
",",
"int",
"m_rowStepSize",
",",
"int",
"m_columnStepSize",
",",
"int",
"m_maxEndPointGap",
",",
"int",
"m_onlyClosed",
",",
"int",
"m_subPixelAccuracy",
")",
"{",
"this",
".",
"m_extractionMode",
"=",
"m_extractionMode",
";",
"this",
".",
"m_threshold",
"=",
"m_threshold",
";",
"this",
".",
"m_filterSize",
"=",
"m_filterSize",
";",
"this",
".",
"m_minLength",
"=",
"m_minLength",
";",
"this",
".",
"m_rowStepSize",
"=",
"m_rowStepSize",
";",
"this",
".",
"m_columnStepSize",
"=",
"m_columnStepSize",
";",
"this",
".",
"m_maxEndPointGap",
"=",
"m_maxEndPointGap",
";",
"this",
".",
"m_onlyClosed",
"=",
"m_onlyClosed",
";",
"this",
".",
"m_subPixelAccuracy",
"=",
"m_subPixelAccuracy",
";",
"allocateMemory",
"(",
")",
";",
"write",
"(",
")",
";",
"}",
"public",
"void",
"read",
"(",
")",
"{",
"}",
"public",
"void",
"write",
"(",
")",
"{",
"backingNativeMemory",
".",
"setInt",
"(",
"0",
",",
"m_extractionMode",
")",
";",
"backingNativeMemory",
".",
"setInt",
"(",
"4",
",",
"m_threshold",
")",
";",
"backingNativeMemory",
".",
"setInt",
"(",
"8",
",",
"m_filterSize",
")",
";",
"backingNativeMemory",
".",
"setInt",
"(",
"12",
",",
"m_minLength",
")",
";",
"backingNativeMemory",
".",
"setInt",
"(",
"16",
",",
"m_rowStepSize",
")",
";",
"backingNativeMemory",
".",
"setInt",
"(",
"20",
",",
"m_columnStepSize",
")",
";",
"backingNativeMemory",
".",
"setInt",
"(",
"24",
",",
"m_maxEndPointGap",
")",
";",
"backingNativeMemory",
".",
"setInt",
"(",
"28",
",",
"m_onlyClosed",
")",
";",
"backingNativeMemory",
".",
"setInt",
"(",
"32",
",",
"m_subPixelAccuracy",
")",
";",
"}",
"public",
"int",
"size",
"(",
")",
"{",
"return",
"36",
";",
"}",
"public",
"void",
"free",
"(",
")",
"{",
"release",
"(",
")",
";",
"}",
"}",
"</s>"
] |
7,478 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"image",
";",
"public",
"abstract",
"class",
"ColorImage",
"extends",
"Image",
"{",
"ColorImage",
"(",
"NIVision",
".",
"ImageType",
"type",
")",
"throws",
"NIVisionException",
"{",
"super",
"(",
"type",
")",
";",
"}",
"ColorImage",
"(",
"ColorImage",
"sourceImage",
")",
"{",
"super",
"(",
"sourceImage",
")",
";",
"}",
"private",
"BinaryImage",
"threshold",
"(",
"NIVision",
".",
"ColorMode",
"colorMode",
",",
"int",
"low1",
",",
"int",
"high1",
",",
"int",
"low2",
",",
"int",
"high2",
",",
"int",
"low3",
",",
"int",
"high3",
")",
"throws",
"NIVisionException",
"{",
"BinaryImage",
"res",
"=",
"new",
"BinaryImage",
"(",
")",
";",
"NIVision",
".",
"Range",
"range1",
"=",
"new",
"NIVision",
".",
"Range",
"(",
"low1",
",",
"high1",
")",
";",
"NIVision",
".",
"Range",
"range2",
"=",
"new",
"NIVision",
".",
"Range",
"(",
"low2",
",",
"high2",
")",
";",
"NIVision",
".",
"Range",
"range3",
"=",
"new",
"NIVision",
".",
"Range",
"(",
"low3",
",",
"high3",
")",
";",
"try",
"{",
"NIVision",
".",
"colorThreshold",
"(",
"res",
".",
"image",
",",
"image",
",",
"colorMode",
",",
"range1",
".",
"getPointer",
"(",
")",
",",
"range2",
".",
"getPointer",
"(",
")",
",",
"range3",
".",
"getPointer",
"(",
")",
")",
";",
"}",
"catch",
"(",
"NIVisionException",
"e",
")",
"{",
"res",
".",
"free",
"(",
")",
";",
"throw",
"e",
";",
"}",
"finally",
"{",
"range1",
".",
"free",
"(",
")",
";",
"range2",
".",
"free",
"(",
")",
";",
"range3",
".",
"free",
"(",
")",
";",
"}",
"return",
"res",
";",
"}",
"public",
"BinaryImage",
"thresholdRGB",
"(",
"int",
"redLow",
",",
"int",
"redHigh",
",",
"int",
"greenLow",
",",
"int",
"greenHigh",
",",
"int",
"blueLow",
",",
"int",
"blueHigh",
")",
"throws",
"NIVisionException",
"{",
"return",
"threshold",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_RGB",
",",
"redLow",
",",
"redHigh",
",",
"greenLow",
",",
"greenHigh",
",",
"blueLow",
",",
"blueHigh",
")",
";",
"}",
"public",
"BinaryImage",
"thresholdHSL",
"(",
"int",
"hueLow",
",",
"int",
"hueHigh",
",",
"int",
"saturationLow",
",",
"int",
"saturationHigh",
",",
"int",
"luminenceLow",
",",
"int",
"luminenceHigh",
")",
"throws",
"NIVisionException",
"{",
"return",
"threshold",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSL",
",",
"hueLow",
",",
"hueHigh",
",",
"saturationLow",
",",
"saturationHigh",
",",
"luminenceLow",
",",
"luminenceHigh",
")",
";",
"}",
"public",
"BinaryImage",
"thresholdHSV",
"(",
"int",
"hueLow",
",",
"int",
"hueHigh",
",",
"int",
"saturationLow",
",",
"int",
"saturationHigh",
",",
"int",
"valueLow",
",",
"int",
"valueHigh",
")",
"throws",
"NIVisionException",
"{",
"return",
"threshold",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSV",
",",
"hueLow",
",",
"hueHigh",
",",
"saturationLow",
",",
"saturationHigh",
",",
"valueLow",
",",
"valueHigh",
")",
";",
"}",
"public",
"BinaryImage",
"thresholdHSI",
"(",
"int",
"hueLow",
",",
"int",
"hueHigh",
",",
"int",
"saturationLow",
",",
"int",
"saturationHigh",
",",
"int",
"intansityLow",
",",
"int",
"intensityHigh",
")",
"throws",
"NIVisionException",
"{",
"return",
"threshold",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSI",
",",
"hueLow",
",",
"hueHigh",
",",
"saturationLow",
",",
"saturationHigh",
",",
"intansityLow",
",",
"intensityHigh",
")",
";",
"}",
"MonoImage",
"extractFirstColorPlane",
"(",
"NIVision",
".",
"ColorMode",
"mode",
")",
"throws",
"NIVisionException",
"{",
"MonoImage",
"result",
"=",
"new",
"MonoImage",
"(",
")",
";",
"try",
"{",
"NIVision",
".",
"extractColorPlanes",
"(",
"image",
",",
"mode",
",",
"result",
".",
"image",
",",
"null",
",",
"null",
")",
";",
"}",
"catch",
"(",
"NIVisionException",
"e",
")",
"{",
"result",
".",
"free",
"(",
")",
";",
"throw",
"e",
";",
"}",
"return",
"result",
";",
"}",
"MonoImage",
"extractSecondColorPlane",
"(",
"NIVision",
".",
"ColorMode",
"mode",
")",
"throws",
"NIVisionException",
"{",
"MonoImage",
"result",
"=",
"new",
"MonoImage",
"(",
")",
";",
"try",
"{",
"NIVision",
".",
"extractColorPlanes",
"(",
"image",
",",
"mode",
",",
"null",
",",
"result",
".",
"image",
",",
"null",
")",
";",
"}",
"catch",
"(",
"NIVisionException",
"e",
")",
"{",
"result",
".",
"free",
"(",
")",
";",
"throw",
"e",
";",
"}",
"return",
"result",
";",
"}",
"MonoImage",
"extractThirdColorPlane",
"(",
"NIVision",
".",
"ColorMode",
"mode",
")",
"throws",
"NIVisionException",
"{",
"MonoImage",
"result",
"=",
"new",
"MonoImage",
"(",
")",
";",
"try",
"{",
"NIVision",
".",
"extractColorPlanes",
"(",
"image",
",",
"mode",
",",
"null",
",",
"null",
",",
"result",
".",
"image",
")",
";",
"}",
"catch",
"(",
"NIVisionException",
"e",
")",
"{",
"result",
".",
"free",
"(",
")",
";",
"throw",
"e",
";",
"}",
"return",
"result",
";",
"}",
"public",
"MonoImage",
"getRedPlane",
"(",
")",
"throws",
"NIVisionException",
"{",
"return",
"extractFirstColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_RGB",
")",
";",
"}",
"public",
"MonoImage",
"getGreenPlane",
"(",
")",
"throws",
"NIVisionException",
"{",
"return",
"extractSecondColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_RGB",
")",
";",
"}",
"public",
"MonoImage",
"getBluePlane",
"(",
")",
"throws",
"NIVisionException",
"{",
"return",
"extractThirdColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_RGB",
")",
";",
"}",
"public",
"MonoImage",
"getHSLHuePlane",
"(",
")",
"throws",
"NIVisionException",
"{",
"return",
"extractFirstColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSL",
")",
";",
"}",
"public",
"MonoImage",
"getHSVHuePlane",
"(",
")",
"throws",
"NIVisionException",
"{",
"return",
"extractFirstColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSV",
")",
";",
"}",
"public",
"MonoImage",
"getHSIHuePlane",
"(",
")",
"throws",
"NIVisionException",
"{",
"return",
"extractFirstColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSI",
")",
";",
"}",
"public",
"MonoImage",
"getHSLSaturationPlane",
"(",
")",
"throws",
"NIVisionException",
"{",
"return",
"extractSecondColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSL",
")",
";",
"}",
"public",
"MonoImage",
"getHSVSaturationPlane",
"(",
")",
"throws",
"NIVisionException",
"{",
"return",
"extractSecondColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSV",
")",
";",
"}",
"public",
"MonoImage",
"getHSISaturationPlane",
"(",
")",
"throws",
"NIVisionException",
"{",
"return",
"extractSecondColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSI",
")",
";",
"}",
"public",
"MonoImage",
"getLuminancePlane",
"(",
")",
"throws",
"NIVisionException",
"{",
"return",
"extractThirdColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSL",
")",
";",
"}",
"public",
"MonoImage",
"getValuePlane",
"(",
")",
"throws",
"NIVisionException",
"{",
"return",
"extractThirdColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSV",
")",
";",
"}",
"public",
"MonoImage",
"getIntensityPlane",
"(",
")",
"throws",
"NIVisionException",
"{",
"return",
"extractThirdColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSI",
")",
";",
"}",
"ColorImage",
"replaceFirstColorPlane",
"(",
"NIVision",
".",
"ColorMode",
"mode",
",",
"MonoImage",
"plane",
")",
"throws",
"NIVisionException",
"{",
"NIVision",
".",
"replaceColorPlanes",
"(",
"image",
",",
"image",
",",
"mode",
",",
"plane",
".",
"image",
",",
"null",
",",
"null",
")",
";",
"return",
"this",
";",
"}",
"ColorImage",
"replaceSecondColorPlane",
"(",
"NIVision",
".",
"ColorMode",
"mode",
",",
"MonoImage",
"plane",
")",
"throws",
"NIVisionException",
"{",
"NIVision",
".",
"replaceColorPlanes",
"(",
"image",
",",
"image",
",",
"mode",
",",
"null",
",",
"plane",
".",
"image",
",",
"null",
")",
";",
"return",
"this",
";",
"}",
"ColorImage",
"replaceThirdColorPlane",
"(",
"NIVision",
".",
"ColorMode",
"mode",
",",
"MonoImage",
"plane",
")",
"throws",
"NIVisionException",
"{",
"NIVision",
".",
"replaceColorPlanes",
"(",
"image",
",",
"image",
",",
"mode",
",",
"null",
",",
"null",
",",
"plane",
".",
"image",
")",
";",
"return",
"this",
";",
"}",
"public",
"ColorImage",
"replaceRedPlane",
"(",
"MonoImage",
"plane",
")",
"throws",
"NIVisionException",
"{",
"return",
"replaceFirstColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_RGB",
",",
"plane",
")",
";",
"}",
"public",
"ColorImage",
"replaceGreenPlane",
"(",
"MonoImage",
"plane",
")",
"throws",
"NIVisionException",
"{",
"return",
"replaceSecondColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_RGB",
",",
"plane",
")",
";",
"}",
"public",
"ColorImage",
"replaceBluePlane",
"(",
"MonoImage",
"plane",
")",
"throws",
"NIVisionException",
"{",
"return",
"replaceThirdColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_RGB",
",",
"plane",
")",
";",
"}",
"public",
"ColorImage",
"replaceHSLHuePlane",
"(",
"MonoImage",
"plane",
")",
"throws",
"NIVisionException",
"{",
"return",
"replaceFirstColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSL",
",",
"plane",
")",
";",
"}",
"public",
"ColorImage",
"replaceHSVHuePlane",
"(",
"MonoImage",
"plane",
")",
"throws",
"NIVisionException",
"{",
"return",
"replaceFirstColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSV",
",",
"plane",
")",
";",
"}",
"public",
"ColorImage",
"replaceHSIHuePlane",
"(",
"MonoImage",
"plane",
")",
"throws",
"NIVisionException",
"{",
"return",
"replaceFirstColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSI",
",",
"plane",
")",
";",
"}",
"public",
"ColorImage",
"replaceHSLSaturationPlane",
"(",
"MonoImage",
"plane",
")",
"throws",
"NIVisionException",
"{",
"return",
"replaceSecondColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSL",
",",
"plane",
")",
";",
"}",
"public",
"ColorImage",
"replaceHSVSaturationPlane",
"(",
"MonoImage",
"plane",
")",
"throws",
"NIVisionException",
"{",
"return",
"replaceSecondColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSV",
",",
"plane",
")",
";",
"}",
"public",
"ColorImage",
"replaceHSISaturationPlane",
"(",
"MonoImage",
"plane",
")",
"throws",
"NIVisionException",
"{",
"return",
"replaceSecondColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSI",
",",
"plane",
")",
";",
"}",
"public",
"ColorImage",
"replaceLuminancePlane",
"(",
"MonoImage",
"plane",
")",
"throws",
"NIVisionException",
"{",
"return",
"replaceThirdColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSL",
",",
"plane",
")",
";",
"}",
"public",
"ColorImage",
"replaceValuePlane",
"(",
"MonoImage",
"plane",
")",
"throws",
"NIVisionException",
"{",
"return",
"replaceThirdColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSV",
",",
"plane",
")",
";",
"}",
"public",
"ColorImage",
"replaceIntensityPlane",
"(",
"MonoImage",
"plane",
")",
"throws",
"NIVisionException",
"{",
"return",
"replaceThirdColorPlane",
"(",
"NIVision",
".",
"ColorMode",
".",
"IMAQ_HSI",
",",
"plane",
")",
";",
"}",
"public",
"ColorImage",
"colorEqualize",
"(",
")",
"throws",
"NIVisionException",
"{",
"NIVision",
".",
"colorEqualize",
"(",
"image",
",",
"image",
",",
"true",
")",
";",
"return",
"this",
";",
"}",
"public",
"ColorImage",
"luminanceEqualize",
"(",
")",
"throws",
"NIVisionException",
"{",
"NIVision",
".",
"colorEqualize",
"(",
"image",
",",
"image",
",",
"false",
")",
";",
"return",
"this",
";",
"}",
"}",
"</s>"
] |
7,479 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"image",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"Pointer",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"Structure",
";",
"public",
"class",
"EllipseMatch",
"{",
"static",
"final",
"int",
"ellipseMatchSize",
"=",
"40",
";",
"public",
"double",
"m_xPos",
";",
"public",
"double",
"m_yPos",
";",
"public",
"double",
"m_rotation",
";",
"public",
"double",
"m_majorRadius",
";",
"public",
"double",
"m_minorRadius",
";",
"public",
"double",
"m_score",
";",
"private",
"class",
"EllipseMatchStructure",
"extends",
"Structure",
"{",
"public",
"EllipseMatchStructure",
"(",
"int",
"address",
")",
"{",
"useMemory",
"(",
"new",
"Pointer",
"(",
"address",
",",
"ellipseMatchSize",
")",
")",
";",
"read",
"(",
")",
";",
"}",
"public",
"void",
"read",
"(",
")",
"{",
"m_xPos",
"=",
"backingNativeMemory",
".",
"getFloat",
"(",
"0",
")",
";",
"m_yPos",
"=",
"backingNativeMemory",
".",
"getFloat",
"(",
"4",
")",
";",
"m_rotation",
"=",
"backingNativeMemory",
".",
"getDouble",
"(",
"8",
")",
";",
"m_majorRadius",
"=",
"backingNativeMemory",
".",
"getDouble",
"(",
"16",
")",
";",
"m_minorRadius",
"=",
"backingNativeMemory",
".",
"getDouble",
"(",
"24",
")",
";",
"m_score",
"=",
"backingNativeMemory",
".",
"getDouble",
"(",
"32",
")",
";",
"}",
"public",
"void",
"write",
"(",
")",
"{",
"}",
"public",
"int",
"size",
"(",
")",
"{",
"return",
"ellipseMatchSize",
";",
"}",
"}",
"EllipseMatch",
"(",
"int",
"address",
")",
"{",
"new",
"EllipseMatchStructure",
"(",
"address",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"\"",
"+",
"\"",
"Pos",
"x:",
"\"",
"+",
"m_xPos",
"+",
"\"",
"y:",
"\"",
"+",
"m_yPos",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"m_majorRadius",
"+",
"\"",
"minor:",
"\"",
"+",
"m_minorRadius",
"+",
"\"n\"",
"+",
"\"",
"Rotation:",
"\"",
"+",
"m_rotation",
"+",
"\"",
"Score:",
"\"",
"+",
"m_score",
"+",
"\"n\"",
";",
"}",
"protected",
"static",
"EllipseMatch",
"[",
"]",
"getMatchesFromMemory",
"(",
"int",
"address",
",",
"int",
"number",
")",
"{",
"if",
"(",
"address",
"==",
"0",
")",
"{",
"return",
"new",
"EllipseMatch",
"[",
"0",
"]",
";",
"}",
"EllipseMatch",
"[",
"]",
"toReturn",
"=",
"new",
"EllipseMatch",
"[",
"number",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"number",
";",
"i",
"++",
")",
"{",
"toReturn",
"[",
"i",
"]",
"=",
"new",
"EllipseMatch",
"(",
"address",
"+",
"i",
"*",
"ellipseMatchSize",
")",
";",
"}",
"return",
"toReturn",
";",
"}",
"}",
"</s>"
] |
7,480 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"image",
";",
"public",
"class",
"MonoImage",
"extends",
"Image",
"{",
"public",
"MonoImage",
"(",
")",
"throws",
"NIVisionException",
"{",
"super",
"(",
"NIVision",
".",
"ImageType",
".",
"imaqImageU8",
")",
";",
"}",
"MonoImage",
"(",
"MonoImage",
"sourceImage",
")",
"{",
"super",
"(",
"sourceImage",
")",
";",
"}",
"public",
"EllipseMatch",
"[",
"]",
"detectEllipses",
"(",
"EllipseDescriptor",
"ellipseDescriptor",
",",
"CurveOptions",
"curveOptions",
",",
"ShapeDetectionOptions",
"shapeDetectionOptions",
",",
"RegionOfInterest",
"roi",
")",
"throws",
"NIVisionException",
"{",
"return",
"NIVision",
".",
"detectEllipses",
"(",
"this",
",",
"ellipseDescriptor",
",",
"curveOptions",
",",
"shapeDetectionOptions",
",",
"roi",
")",
";",
"}",
"public",
"EllipseMatch",
"[",
"]",
"detectEllipses",
"(",
"EllipseDescriptor",
"ellipseDescriptor",
")",
"throws",
"NIVisionException",
"{",
"return",
"NIVision",
".",
"detectEllipses",
"(",
"this",
",",
"ellipseDescriptor",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}",
"}",
"</s>"
] |
7,481 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"image",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"Structure",
";",
"public",
"class",
"ShapeDetectionOptions",
"extends",
"Structure",
"{",
"int",
"mode",
";",
"int",
"angleRanges",
";",
"int",
"numAngleRanges",
";",
"float",
"scaleRangeMin",
";",
"float",
"scaleRangeMax",
";",
"double",
"minMatchScore",
";",
"public",
"static",
"final",
"int",
"IMAQ_GEOMETRIC_MATCH_SHIFT_INVARIANT",
"=",
"0",
";",
"public",
"static",
"final",
"int",
"IMAQ_GEOMETRIC_MATCH_ROTATION_INVARIANT",
"=",
"1",
";",
"public",
"static",
"final",
"int",
"IMAQ_GEOMETRIC_MATCH_SCALE_INVARIANT",
"=",
"2",
";",
"public",
"static",
"final",
"int",
"IMAQ_GEOMETRIC_MATCH_OCCLUSION_INVARIANT",
"=",
"4",
";",
"public",
"ShapeDetectionOptions",
"(",
"int",
"mode",
",",
"int",
"angleRanges",
",",
"int",
"numAngleRanges",
",",
"float",
"scaleRangeMin",
",",
"float",
"scaleRangeMax",
",",
"double",
"minMatchScore",
")",
"{",
"this",
".",
"mode",
"=",
"mode",
";",
"this",
".",
"angleRanges",
"=",
"angleRanges",
";",
"this",
".",
"numAngleRanges",
"=",
"numAngleRanges",
";",
"this",
".",
"scaleRangeMin",
"=",
"scaleRangeMin",
";",
"this",
".",
"scaleRangeMax",
"=",
"scaleRangeMax",
";",
"this",
".",
"minMatchScore",
"=",
"minMatchScore",
";",
"allocateMemory",
"(",
")",
";",
"write",
"(",
")",
";",
"}",
"public",
"void",
"read",
"(",
")",
"{",
"mode",
"=",
"backingNativeMemory",
".",
"getInt",
"(",
"0",
")",
";",
"angleRanges",
"=",
"backingNativeMemory",
".",
"getInt",
"(",
"4",
")",
";",
"numAngleRanges",
"=",
"backingNativeMemory",
".",
"getInt",
"(",
"8",
")",
";",
"scaleRangeMin",
"=",
"backingNativeMemory",
".",
"getFloat",
"(",
"12",
")",
";",
"scaleRangeMax",
"=",
"backingNativeMemory",
".",
"getFloat",
"(",
"16",
")",
";",
"minMatchScore",
"=",
"backingNativeMemory",
".",
"getDouble",
"(",
"20",
")",
";",
"}",
"public",
"void",
"write",
"(",
")",
"{",
"backingNativeMemory",
".",
"setInt",
"(",
"0",
",",
"mode",
")",
";",
"backingNativeMemory",
".",
"setInt",
"(",
"4",
",",
"angleRanges",
")",
";",
"backingNativeMemory",
".",
"setInt",
"(",
"8",
",",
"numAngleRanges",
")",
";",
"backingNativeMemory",
".",
"setFloat",
"(",
"12",
",",
"scaleRangeMin",
")",
";",
"backingNativeMemory",
".",
"setFloat",
"(",
"16",
",",
"scaleRangeMax",
")",
";",
"backingNativeMemory",
".",
"setDouble",
"(",
"20",
",",
"minMatchScore",
")",
";",
"}",
"public",
"int",
"size",
"(",
")",
"{",
"return",
"28",
";",
"}",
"public",
"void",
"free",
"(",
")",
"{",
"release",
"(",
")",
";",
"}",
"}",
"</s>"
] |
7,482 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"image",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"Structure",
";",
"public",
"class",
"EllipseDescriptor",
"extends",
"Structure",
"{",
"double",
"m_minMajorRadius",
";",
"double",
"m_maxMajorRadius",
";",
"double",
"m_minMinorRadius",
";",
"double",
"m_maxMinorRadius",
";",
"public",
"EllipseDescriptor",
"(",
"double",
"m_minMajorRadius",
",",
"double",
"m_maxMajorRadius",
",",
"double",
"m_minMinorRadius",
",",
"double",
"m_maxMinorRadius",
")",
"{",
"this",
".",
"m_minMajorRadius",
"=",
"m_minMajorRadius",
";",
"this",
".",
"m_maxMajorRadius",
"=",
"m_maxMajorRadius",
";",
"this",
".",
"m_minMinorRadius",
"=",
"m_minMinorRadius",
";",
"this",
".",
"m_maxMinorRadius",
"=",
"m_maxMinorRadius",
";",
"allocateMemory",
"(",
")",
";",
"write",
"(",
")",
";",
"}",
"public",
"void",
"free",
"(",
")",
"{",
"release",
"(",
")",
";",
"}",
"public",
"void",
"read",
"(",
")",
"{",
"m_minMajorRadius",
"=",
"backingNativeMemory",
".",
"getDouble",
"(",
"0",
")",
";",
"m_maxMajorRadius",
"=",
"backingNativeMemory",
".",
"getDouble",
"(",
"8",
")",
";",
"m_minMinorRadius",
"=",
"backingNativeMemory",
".",
"getDouble",
"(",
"16",
")",
";",
"m_maxMinorRadius",
"=",
"backingNativeMemory",
".",
"getDouble",
"(",
"24",
")",
";",
"}",
"public",
"void",
"write",
"(",
")",
"{",
"backingNativeMemory",
".",
"setDouble",
"(",
"0",
",",
"m_minMajorRadius",
")",
";",
"backingNativeMemory",
".",
"setDouble",
"(",
"8",
",",
"m_maxMajorRadius",
")",
";",
"backingNativeMemory",
".",
"setDouble",
"(",
"16",
",",
"m_minMinorRadius",
")",
";",
"backingNativeMemory",
".",
"setDouble",
"(",
"24",
",",
"m_maxMinorRadius",
")",
";",
"}",
"public",
"int",
"size",
"(",
")",
"{",
"return",
"32",
";",
"}",
"}",
"</s>"
] |
7,483 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"image",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"Pointer",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"SortedVector",
";",
"public",
"class",
"BinaryImage",
"extends",
"MonoImage",
"{",
"private",
"int",
"numParticles",
"=",
"-",
"1",
";",
"BinaryImage",
"(",
")",
"throws",
"NIVisionException",
"{",
"}",
"BinaryImage",
"(",
"BinaryImage",
"sourceImage",
")",
"{",
"super",
"(",
"sourceImage",
")",
";",
"}",
"public",
"int",
"getNumberParticles",
"(",
")",
"throws",
"NIVisionException",
"{",
"if",
"(",
"numParticles",
"<",
"0",
")",
"numParticles",
"=",
"NIVision",
".",
"countParticles",
"(",
"image",
")",
";",
"return",
"numParticles",
";",
"}",
"private",
"class",
"ParticleSizeReport",
"{",
"final",
"int",
"index",
";",
"final",
"double",
"size",
";",
"public",
"ParticleSizeReport",
"(",
"int",
"index",
")",
"throws",
"NIVisionException",
"{",
"if",
"(",
"(",
"!",
"(",
"index",
"<",
"BinaryImage",
".",
"this",
".",
"getNumberParticles",
"(",
")",
")",
")",
"||",
"index",
"<",
"0",
")",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"this",
".",
"index",
"=",
"index",
";",
"size",
"=",
"ParticleAnalysisReport",
".",
"getParticleToImagePercent",
"(",
"BinaryImage",
".",
"this",
",",
"index",
")",
";",
"}",
"public",
"ParticleAnalysisReport",
"getParticleAnalysisReport",
"(",
")",
"throws",
"NIVisionException",
"{",
"return",
"new",
"ParticleAnalysisReport",
"(",
"BinaryImage",
".",
"this",
",",
"index",
")",
";",
"}",
"}",
"public",
"ParticleAnalysisReport",
"getParticleAnalysisReport",
"(",
"int",
"index",
")",
"throws",
"NIVisionException",
"{",
"if",
"(",
"!",
"(",
"index",
"<",
"getNumberParticles",
"(",
")",
")",
")",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"return",
"new",
"ParticleAnalysisReport",
"(",
"this",
",",
"index",
")",
";",
"}",
"public",
"ParticleAnalysisReport",
"[",
"]",
"getOrderedParticleAnalysisReports",
"(",
"int",
"size",
")",
"throws",
"NIVisionException",
"{",
"if",
"(",
"size",
">",
"getNumberParticles",
"(",
")",
")",
"size",
"=",
"getNumberParticles",
"(",
")",
";",
"ParticleSizeReport",
"[",
"]",
"reports",
"=",
"new",
"ParticleSizeReport",
"[",
"size",
"]",
";",
"SortedVector",
"sorter",
"=",
"new",
"SortedVector",
"(",
"new",
"SortedVector",
".",
"Comparator",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"Object",
"object1",
",",
"Object",
"object2",
")",
"{",
"ParticleSizeReport",
"p1",
"=",
"(",
"ParticleSizeReport",
")",
"object1",
";",
"ParticleSizeReport",
"p2",
"=",
"(",
"ParticleSizeReport",
")",
"object2",
";",
"if",
"(",
"p1",
".",
"size",
"<",
"p2",
".",
"size",
")",
"return",
"-",
"1",
";",
"else",
"if",
"(",
"p1",
".",
"size",
">",
"p2",
".",
"size",
")",
"return",
"1",
";",
"return",
"0",
";",
"}",
"}",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"getNumberParticles",
"(",
")",
";",
"i",
"++",
")",
"sorter",
".",
"addElement",
"(",
"new",
"ParticleSizeReport",
"(",
"i",
")",
")",
";",
"sorter",
".",
"setSize",
"(",
"size",
")",
";",
"sorter",
".",
"copyInto",
"(",
"reports",
")",
";",
"ParticleAnalysisReport",
"[",
"]",
"finalReports",
"=",
"new",
"ParticleAnalysisReport",
"[",
"reports",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"finalReports",
".",
"length",
";",
"i",
"++",
")",
"finalReports",
"[",
"i",
"]",
"=",
"reports",
"[",
"i",
"]",
".",
"getParticleAnalysisReport",
"(",
")",
";",
"return",
"finalReports",
";",
"}",
"public",
"ParticleAnalysisReport",
"[",
"]",
"getOrderedParticleAnalysisReports",
"(",
")",
"throws",
"NIVisionException",
"{",
"return",
"getOrderedParticleAnalysisReports",
"(",
"getNumberParticles",
"(",
")",
")",
";",
"}",
"public",
"void",
"write",
"(",
"String",
"fileName",
")",
"throws",
"NIVisionException",
"{",
"Pointer",
"colorTable",
"=",
"new",
"Pointer",
"(",
"1024",
")",
";",
"colorTable",
".",
"setByte",
"(",
"0",
",",
"(",
"byte",
")",
"0",
")",
";",
"colorTable",
".",
"setByte",
"(",
"1",
",",
"(",
"byte",
")",
"0",
")",
";",
"colorTable",
".",
"setByte",
"(",
"2",
",",
"(",
"byte",
")",
"0",
")",
";",
"colorTable",
".",
"setByte",
"(",
"3",
",",
"(",
"byte",
")",
"0",
")",
";",
"colorTable",
".",
"setByte",
"(",
"4",
",",
"(",
"byte",
")",
"0",
")",
";",
"colorTable",
".",
"setByte",
"(",
"5",
",",
"(",
"byte",
")",
"0",
")",
";",
"colorTable",
".",
"setByte",
"(",
"6",
",",
"(",
"byte",
")",
"255",
")",
";",
"colorTable",
".",
"setByte",
"(",
"7",
",",
"(",
"byte",
")",
"0",
")",
";",
"try",
"{",
"NIVision",
".",
"writeFile",
"(",
"image",
",",
"fileName",
",",
"colorTable",
")",
";",
"}",
"finally",
"{",
"colorTable",
".",
"free",
"(",
")",
";",
"}",
"}",
"}",
"</s>"
] |
7,484 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"image",
";",
"public",
"class",
"HSLImage",
"extends",
"ColorImage",
"{",
"public",
"HSLImage",
"(",
")",
"throws",
"NIVisionException",
"{",
"super",
"(",
"NIVision",
".",
"ImageType",
".",
"imaqImageHSL",
")",
";",
"}",
"HSLImage",
"(",
"HSLImage",
"sourceImage",
")",
"{",
"super",
"(",
"sourceImage",
")",
";",
"}",
"public",
"HSLImage",
"(",
"String",
"fileName",
")",
"throws",
"NIVisionException",
"{",
"super",
"(",
"NIVision",
".",
"ImageType",
".",
"imaqImageHSL",
")",
";",
"NIVision",
".",
"readFile",
"(",
"image",
",",
"fileName",
")",
";",
"}",
"}",
"</s>"
] |
7,485 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"image",
";",
"public",
"class",
"ParticleAnalysisReport",
"{",
"public",
"final",
"int",
"imageHeight",
";",
"public",
"final",
"int",
"imageWidth",
";",
"public",
"final",
"int",
"center_mass_x",
";",
"public",
"final",
"int",
"center_mass_y",
";",
"public",
"final",
"double",
"center_mass_x_normalized",
";",
"public",
"final",
"double",
"center_mass_y_normalized",
";",
"public",
"final",
"double",
"particleArea",
";",
"public",
"final",
"int",
"boundingRectLeft",
";",
"public",
"final",
"int",
"boundingRectTop",
";",
"public",
"final",
"int",
"boundingRectWidth",
";",
"public",
"final",
"int",
"boundingRectHeight",
";",
"public",
"final",
"double",
"particleToImagePercent",
";",
"public",
"final",
"double",
"particleQuality",
";",
"ParticleAnalysisReport",
"(",
"BinaryImage",
"image",
",",
"int",
"index",
")",
"throws",
"NIVisionException",
"{",
"imageHeight",
"=",
"image",
".",
"getHeight",
"(",
")",
";",
"imageWidth",
"=",
"image",
".",
"getWidth",
"(",
")",
";",
"center_mass_x",
"=",
"(",
"int",
")",
"NIVision",
".",
"MeasureParticle",
"(",
"image",
".",
"image",
",",
"index",
",",
"false",
",",
"NIVision",
".",
"MeasurementType",
".",
"IMAQ_MT_CENTER_OF_MASS_X",
")",
";",
"center_mass_y",
"=",
"(",
"int",
")",
"NIVision",
".",
"MeasureParticle",
"(",
"image",
".",
"image",
",",
"index",
",",
"false",
",",
"NIVision",
".",
"MeasurementType",
".",
"IMAQ_MT_CENTER_OF_MASS_Y",
")",
";",
"center_mass_x_normalized",
"=",
"(",
"2.0",
"*",
"center_mass_x",
"/",
"imageWidth",
")",
"-",
"1.0",
";",
"center_mass_y_normalized",
"=",
"(",
"2.0",
"*",
"center_mass_y",
"/",
"imageHeight",
")",
"-",
"1.0",
";",
"particleArea",
"=",
"NIVision",
".",
"MeasureParticle",
"(",
"image",
".",
"image",
",",
"index",
",",
"false",
",",
"NIVision",
".",
"MeasurementType",
".",
"IMAQ_MT_AREA",
")",
";",
"boundingRectLeft",
"=",
"(",
"int",
")",
"NIVision",
".",
"MeasureParticle",
"(",
"image",
".",
"image",
",",
"index",
",",
"false",
",",
"NIVision",
".",
"MeasurementType",
".",
"IMAQ_MT_BOUNDING_RECT_LEFT",
")",
";",
"boundingRectTop",
"=",
"(",
"int",
")",
"NIVision",
".",
"MeasureParticle",
"(",
"image",
".",
"image",
",",
"index",
",",
"false",
",",
"NIVision",
".",
"MeasurementType",
".",
"IMAQ_MT_BOUNDING_RECT_TOP",
")",
";",
"boundingRectWidth",
"=",
"(",
"int",
")",
"NIVision",
".",
"MeasureParticle",
"(",
"image",
".",
"image",
",",
"index",
",",
"false",
",",
"NIVision",
".",
"MeasurementType",
".",
"IMAQ_MT_BOUNDING_RECT_WIDTH",
")",
";",
"boundingRectHeight",
"=",
"(",
"int",
")",
"NIVision",
".",
"MeasureParticle",
"(",
"image",
".",
"image",
",",
"index",
",",
"false",
",",
"NIVision",
".",
"MeasurementType",
".",
"IMAQ_MT_BOUNDING_RECT_HEIGHT",
")",
";",
"particleToImagePercent",
"=",
"NIVision",
".",
"MeasureParticle",
"(",
"image",
".",
"image",
",",
"index",
",",
"false",
",",
"NIVision",
".",
"MeasurementType",
".",
"IMAQ_MT_AREA_BY_IMAGE_AREA",
")",
";",
"particleQuality",
"=",
"NIVision",
".",
"MeasureParticle",
"(",
"image",
".",
"image",
",",
"index",
",",
"false",
",",
"NIVision",
".",
"MeasurementType",
".",
"IMAQ_MT_AREA_BY_PARTICLE_AND_HOLES_AREA",
")",
";",
"}",
"static",
"double",
"getParticleToImagePercent",
"(",
"BinaryImage",
"image",
",",
"int",
"index",
")",
"throws",
"NIVisionException",
"{",
"return",
"NIVision",
".",
"MeasureParticle",
"(",
"image",
".",
"image",
",",
"index",
",",
"false",
",",
"NIVision",
".",
"MeasurementType",
".",
"IMAQ_MT_AREA_BY_IMAGE_AREA",
")",
";",
"}",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"\"",
"+",
"\"\"",
"+",
"imageHeight",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"imageWidth",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"center_mass_x",
"+",
"\"",
",",
"\"",
"+",
"center_mass_y",
"+",
"\"",
")n\"",
"+",
"\"\"",
"+",
"center_mass_x_normalized",
"+",
"\"",
",",
"\"",
"+",
"center_mass_y_normalized",
"+",
"\"",
")n\"",
"+",
"\"\"",
"+",
"particleArea",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"particleToImagePercent",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"boundingRectLeft",
"+",
"\"",
",",
"\"",
"+",
"boundingRectTop",
"+",
"\"",
")",
"\"",
"+",
"boundingRectWidth",
"+",
"\"*\"",
"+",
"boundingRectHeight",
"+",
"\"n\"",
"+",
"\"\"",
"+",
"particleQuality",
"+",
"\"n\"",
";",
"}",
"}",
"</s>"
] |
7,486 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"image",
";",
"public",
"class",
"NIVisionException",
"extends",
"Exception",
"{",
"public",
"NIVisionException",
"(",
"String",
"msg",
")",
"{",
"super",
"(",
"msg",
")",
";",
"}",
"public",
"NIVisionException",
"(",
"int",
"errorCode",
")",
"{",
"super",
"(",
"lookUpCode",
"(",
"errorCode",
")",
")",
";",
"}",
"private",
"static",
"String",
"lookUpCode",
"(",
"int",
"errorCode",
")",
"{",
"switch",
"(",
"errorCode",
")",
"{",
"case",
"0",
":",
"return",
"\"No",
"error.\"",
";",
"case",
"-",
"1074396160",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396159",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396158",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396157",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396156",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396155",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396154",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396153",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396152",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396151",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396150",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396149",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396148",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396147",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396146",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396145",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396144",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396143",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396142",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396141",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396140",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396139",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396138",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396137",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396136",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396135",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396134",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396133",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396132",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396130",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396129",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396128",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396127",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396126",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396125",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396124",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396123",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396122",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396121",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396120",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396119",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396118",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396117",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396116",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396115",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396114",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396113",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396112",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396111",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396110",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396109",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396108",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396107",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396106",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396105",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396104",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396103",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396102",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396101",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396100",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396099",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396098",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396097",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396096",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396095",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396094",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396093",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396092",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396091",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396090",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396089",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396088",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396087",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396086",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396085",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396084",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396083",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396082",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396081",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396080",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396079",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396077",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396076",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396075",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396074",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396073",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396072",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396071",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396070",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396069",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396068",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396067",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396066",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396065",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396064",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396063",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396062",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396061",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396060",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396059",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396058",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396057",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396056",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396055",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396054",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396053",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396052",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396051",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396050",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396049",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396048",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396047",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396046",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396045",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396044",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396043",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396042",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396041",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396040",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396039",
":",
"return",
"\"I/O",
"error.\"",
";",
"case",
"-",
"1074396038",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396037",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396036",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396035",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396034",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396033",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396032",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396026",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396025",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396024",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396023",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396022",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396021",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396020",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396019",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396018",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396017",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396016",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396015",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396014",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396013",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396012",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396011",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396010",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396009",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396008",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396007",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396006",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396005",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396004",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396003",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396002",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396001",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074396000",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395999",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395998",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395997",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395996",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395995",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395994",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395993",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395992",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395991",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395990",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395989",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395988",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395987",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395986",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395985",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395984",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395983",
":",
"return",
"\"Disk",
"full.\"",
";",
"case",
"-",
"1074395982",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395981",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395980",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395979",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395978",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395977",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395976",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395975",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395974",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395973",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395972",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395971",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395960",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395959",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395958",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395957",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395956",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395955",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395954",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395953",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395920",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395880",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395879",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395878",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395877",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395876",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395875",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395840",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395837",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395801",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395800",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395799",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395798",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395797",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395796",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395795",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395794",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395793",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395792",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395791",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395790",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395789",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395788",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395787",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395786",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395785",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395784",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395783",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395782",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395781",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395780",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395779",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395778",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395777",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395776",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395775",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395774",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395773",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395772",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395771",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395770",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395769",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395768",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395767",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395766",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395763",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395762",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395760",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395758",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395757",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395756",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395754",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395728",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395727",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395726",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395725",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395724",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395723",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395722",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395721",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395720",
":",
"return",
"\"Invalid",
"ROI.\"",
";",
"case",
"-",
"1074395719",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395718",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395717",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395716",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395715",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395714",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395713",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395712",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395711",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395710",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395709",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395708",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395707",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395706",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395705",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395704",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395703",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395702",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395701",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395700",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395656",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395655",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395654",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395653",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395652",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395651",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395650",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395649",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395648",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395647",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395646",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395645",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395644",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395643",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395642",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395641",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395640",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395639",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395638",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395637",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395636",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395635",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395634",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395633",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395632",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395631",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395630",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395629",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395628",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395627",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395626",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395625",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395624",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395623",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395622",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395621",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395620",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395619",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395618",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395617",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395616",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395615",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395614",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395613",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395612",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395611",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395610",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395609",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395608",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395607",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395606",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395605",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395604",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395603",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395602",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395601",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395600",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395598",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395597",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395596",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395595",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395594",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395593",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395592",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395591",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395590",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395589",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395588",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395587",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395586",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395585",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395584",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395583",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395582",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395581",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395580",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395579",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395578",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395577",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395576",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395575",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395574",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395573",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395572",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395571",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395570",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395569",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395568",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395567",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395566",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395565",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395564",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395563",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395562",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395561",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395560",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395559",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395558",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395557",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395556",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395555",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395554",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395553",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395552",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395551",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395550",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395549",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395410",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395409",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395408",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395407",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395406",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395405",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395404",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395403",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395402",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395401",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395400",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395399",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395397",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395395",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395394",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395393",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395392",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395391",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395390",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395389",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395388",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395387",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395386",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395385",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395384",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395383",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395382",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395381",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395380",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395379",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395378",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395377",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395376",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395375",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395374",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395373",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395372",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395371",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395370",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395369",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395368",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395367",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395366",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395365",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395364",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395363",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395362",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395361",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395360",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395357",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395356",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395355",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395354",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395353",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395352",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395351",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395350",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395349",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395348",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395347",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395346",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395345",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395343",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395340",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395336",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395335",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395334",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395333",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395332",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395331",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395330",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395329",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395328",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395327",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395326",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395325",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395324",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395323",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395322",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395321",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395320",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395319",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395318",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395317",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395316",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395313",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395312",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395311",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395310",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395309",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395308",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395307",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395306",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395305",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395304",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395303",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395302",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395301",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395300",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395299",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395298",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395297",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395296",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395295",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395294",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395293",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395292",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395291",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395290",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395287",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395286",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395285",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395284",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395283",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395282",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395281",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395280",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395279",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395278",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395277",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395276",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395275",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395270",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395269",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395268",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395267",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395265",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395263",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395262",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395261",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395260",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395258",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395257",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395256",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395253",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395252",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395251",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395250",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395249",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395248",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395247",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395246",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395245",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395244",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395243",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395242",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395241",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395240",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395239",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395238",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395237",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395235",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395234",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395233",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395212",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395211",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395210",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395203",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395201",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395200",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395179",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395178",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395175",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395174",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395173",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395172",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395171",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395170",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395169",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395168",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395167",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395166",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395165",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395164",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395163",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395162",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395161",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395160",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395159",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395158",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395156",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395155",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395153",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395152",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395151",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395150",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395149",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395148",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395147",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395146",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395145",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395144",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395143",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395142",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395141",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395140",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395139",
":",
"return",
"\"\"",
";",
"case",
"-",
"1074395138",
":",
"return",
"\"\"",
";",
"default",
":",
"return",
"\"\"",
";",
"}",
"}",
"}",
"</s>"
] |
7,487 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"image",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"BlockingFunction",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"Function",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"NativeLibrary",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"Pointer",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"Structure",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"TaskExecutor",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"ptr",
".",
"IntByReference",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"BoundaryException",
";",
"class",
"NIVision",
"{",
"static",
"final",
"TaskExecutor",
"taskExecutor",
"=",
"new",
"TaskExecutor",
"(",
"\"\"",
")",
";",
"private",
"static",
"final",
"BlockingFunction",
"imaqGetLastErrorFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getBlockingFunction",
"(",
"\"\"",
")",
";",
"static",
"{",
"imaqGetLastErrorFn",
".",
"setTaskExecutor",
"(",
"taskExecutor",
")",
";",
"}",
"protected",
"static",
"void",
"assertCleanStatus",
"(",
"int",
"code",
")",
"throws",
"NIVisionException",
"{",
"if",
"(",
"code",
"==",
"0",
")",
"{",
"throw",
"new",
"NIVisionException",
"(",
"imaqGetLastErrorFn",
".",
"call0",
"(",
")",
")",
";",
"}",
"}",
"private",
"static",
"final",
"BlockingFunction",
"Priv_ReadJPEGString_CFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getBlockingFunction",
"(",
"\"\"",
")",
";",
"static",
"{",
"Priv_ReadJPEGString_CFn",
".",
"setTaskExecutor",
"(",
"taskExecutor",
")",
";",
"}",
"public",
"static",
"void",
"readJpegString",
"(",
"Pointer",
"image",
",",
"Pointer",
"p",
")",
"{",
"Priv_ReadJPEGString_CFn",
".",
"call3",
"(",
"image",
",",
"p",
",",
"p",
".",
"getSize",
"(",
")",
")",
";",
"}",
"private",
"static",
"final",
"BlockingFunction",
"Priv_SetWriteFileAllowedFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getBlockingFunction",
"(",
"\"\"",
")",
";",
"static",
"{",
"Priv_SetWriteFileAllowedFn",
".",
"setTaskExecutor",
"(",
"taskExecutor",
")",
";",
"}",
"public",
"static",
"void",
"setWriteFileAllowed",
"(",
"boolean",
"val",
")",
"{",
"Priv_SetWriteFileAllowedFn",
".",
"call1",
"(",
"val",
"?",
"1",
":",
"0",
")",
";",
"}",
"public",
"static",
"class",
"ImageType",
"{",
"public",
"final",
"int",
"value",
";",
"public",
"static",
"final",
"ImageType",
"imaqImageU8",
"=",
"new",
"ImageType",
"(",
"0",
")",
";",
"public",
"static",
"final",
"ImageType",
"imaqImageU16",
"=",
"new",
"ImageType",
"(",
"7",
")",
";",
"public",
"static",
"final",
"ImageType",
"imaqImageI16",
"=",
"new",
"ImageType",
"(",
"1",
")",
";",
"public",
"static",
"final",
"ImageType",
"imaqImageSGL",
"=",
"new",
"ImageType",
"(",
"2",
")",
";",
"public",
"static",
"final",
"ImageType",
"imaqImageComplex",
"=",
"new",
"ImageType",
"(",
"3",
")",
";",
"public",
"static",
"final",
"ImageType",
"imaqImageRGB",
"=",
"new",
"ImageType",
"(",
"4",
")",
";",
"public",
"static",
"final",
"ImageType",
"imaqImageHSL",
"=",
"new",
"ImageType",
"(",
"5",
")",
";",
"public",
"static",
"final",
"ImageType",
"imaqImageRGBU64",
"=",
"new",
"ImageType",
"(",
"6",
")",
";",
"public",
"static",
"final",
"ImageType",
"imaqImageTypeSizeGuard",
"=",
"new",
"ImageType",
"(",
"0xFFFFFFFF",
")",
";",
"private",
"ImageType",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"static",
"class",
"ColorMode",
"{",
"public",
"final",
"int",
"value",
";",
"public",
"static",
"final",
"ColorMode",
"IMAQ_RGB",
"=",
"new",
"ColorMode",
"(",
"0",
")",
";",
"public",
"static",
"final",
"ColorMode",
"IMAQ_HSL",
"=",
"new",
"ColorMode",
"(",
"1",
")",
";",
"public",
"static",
"final",
"ColorMode",
"IMAQ_HSV",
"=",
"new",
"ColorMode",
"(",
"2",
")",
";",
"public",
"static",
"final",
"ColorMode",
"IMAQ_HSI",
"=",
"new",
"ColorMode",
"(",
"3",
")",
";",
"public",
"static",
"final",
"ColorMode",
"IMAQ_CIE",
"=",
"new",
"ColorMode",
"(",
"4",
")",
";",
"public",
"static",
"final",
"ColorMode",
"IMAQ_CIEXYZ",
"=",
"new",
"ColorMode",
"(",
"5",
")",
";",
"public",
"static",
"final",
"ColorMode",
"IMAQ_COLOR_MODE_SIZE_GUARD",
"=",
"new",
"ColorMode",
"(",
"0xFFFFFFFF",
")",
";",
"private",
"ColorMode",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"static",
"class",
"MeasurementType",
"{",
"public",
"final",
"int",
"value",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_CENTER_OF_MASS_X",
"=",
"new",
"MeasurementType",
"(",
"0",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_CENTER_OF_MASS_Y",
"=",
"new",
"MeasurementType",
"(",
"1",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_FIRST_PIXEL_X",
"=",
"new",
"MeasurementType",
"(",
"2",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_FIRST_PIXEL_Y",
"=",
"new",
"MeasurementType",
"(",
"3",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_BOUNDING_RECT_LEFT",
"=",
"new",
"MeasurementType",
"(",
"4",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_BOUNDING_RECT_TOP",
"=",
"new",
"MeasurementType",
"(",
"5",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_BOUNDING_RECT_RIGHT",
"=",
"new",
"MeasurementType",
"(",
"6",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_BOUNDING_RECT_BOTTOM",
"=",
"new",
"MeasurementType",
"(",
"7",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_MAX_FERET_DIAMETER_START_X",
"=",
"new",
"MeasurementType",
"(",
"8",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_MAX_FERET_DIAMETER_START_Y",
"=",
"new",
"MeasurementType",
"(",
"9",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_MAX_FERET_DIAMETER_END_X",
"=",
"new",
"MeasurementType",
"(",
"10",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_MAX_FERET_DIAMETER_END_Y",
"=",
"new",
"MeasurementType",
"(",
"11",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_MAX_HORIZ_SEGMENT_LENGTH_LEFT",
"=",
"new",
"MeasurementType",
"(",
"12",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_MAX_HORIZ_SEGMENT_LENGTH_RIGHT",
"=",
"new",
"MeasurementType",
"(",
"13",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_MAX_HORIZ_SEGMENT_LENGTH_ROW",
"=",
"new",
"MeasurementType",
"(",
"14",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_BOUNDING_RECT_WIDTH",
"=",
"new",
"MeasurementType",
"(",
"16",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_BOUNDING_RECT_HEIGHT",
"=",
"new",
"MeasurementType",
"(",
"17",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_BOUNDING_RECT_DIAGONAL",
"=",
"new",
"MeasurementType",
"(",
"18",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_PERIMETER",
"=",
"new",
"MeasurementType",
"(",
"19",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_CONVEX_HULL_PERIMETER",
"=",
"new",
"MeasurementType",
"(",
"20",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_HOLES_PERIMETER",
"=",
"new",
"MeasurementType",
"(",
"21",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_MAX_FERET_DIAMETER",
"=",
"new",
"MeasurementType",
"(",
"22",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_EQUIVALENT_ELLIPSE_MAJOR_AXIS",
"=",
"new",
"MeasurementType",
"(",
"23",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_EQUIVALENT_ELLIPSE_MINOR_AXIS",
"=",
"new",
"MeasurementType",
"(",
"24",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_EQUIVALENT_ELLIPSE_MINOR_AXIS_FERET",
"=",
"new",
"MeasurementType",
"(",
"25",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_EQUIVALENT_RECT_LONG_SIDE",
"=",
"new",
"MeasurementType",
"(",
"26",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_EQUIVALENT_RECT_SHORT_SIDE",
"=",
"new",
"MeasurementType",
"(",
"27",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_EQUIVALENT_RECT_DIAGONAL",
"=",
"new",
"MeasurementType",
"(",
"28",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_EQUIVALENT_RECT_SHORT_SIDE_FERET",
"=",
"new",
"MeasurementType",
"(",
"29",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_AVERAGE_HORIZ_SEGMENT_LENGTH",
"=",
"new",
"MeasurementType",
"(",
"30",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_AVERAGE_VERT_SEGMENT_LENGTH",
"=",
"new",
"MeasurementType",
"(",
"31",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_HYDRAULIC_RADIUS",
"=",
"new",
"MeasurementType",
"(",
"32",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_WADDEL_DISK_DIAMETER",
"=",
"new",
"MeasurementType",
"(",
"33",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_AREA",
"=",
"new",
"MeasurementType",
"(",
"35",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_HOLES_AREA",
"=",
"new",
"MeasurementType",
"(",
"36",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_PARTICLE_AND_HOLES_AREA",
"=",
"new",
"MeasurementType",
"(",
"37",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_CONVEX_HULL_AREA",
"=",
"new",
"MeasurementType",
"(",
"38",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_IMAGE_AREA",
"=",
"new",
"MeasurementType",
"(",
"39",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_NUMBER_OF_HOLES",
"=",
"new",
"MeasurementType",
"(",
"41",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_NUMBER_OF_HORIZ_SEGMENTS",
"=",
"new",
"MeasurementType",
"(",
"42",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_NUMBER_OF_VERT_SEGMENTS",
"=",
"new",
"MeasurementType",
"(",
"43",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_ORIENTATION",
"=",
"new",
"MeasurementType",
"(",
"45",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_MAX_FERET_DIAMETER_ORIENTATION",
"=",
"new",
"MeasurementType",
"(",
"46",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_AREA_BY_IMAGE_AREA",
"=",
"new",
"MeasurementType",
"(",
"48",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_AREA_BY_PARTICLE_AND_HOLES_AREA",
"=",
"new",
"MeasurementType",
"(",
"49",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_RATIO_OF_EQUIVALENT_ELLIPSE_AXES",
"=",
"new",
"MeasurementType",
"(",
"50",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_RATIO_OF_EQUIVALENT_RECT_SIDES",
"=",
"new",
"MeasurementType",
"(",
"51",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_ELONGATION_FACTOR",
"=",
"new",
"MeasurementType",
"(",
"53",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_COMPACTNESS_FACTOR",
"=",
"new",
"MeasurementType",
"(",
"54",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_HEYWOOD_CIRCULARITY_FACTOR",
"=",
"new",
"MeasurementType",
"(",
"55",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_TYPE_FACTOR",
"=",
"new",
"MeasurementType",
"(",
"56",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_SUM_X",
"=",
"new",
"MeasurementType",
"(",
"58",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_SUM_Y",
"=",
"new",
"MeasurementType",
"(",
"59",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_SUM_XX",
"=",
"new",
"MeasurementType",
"(",
"60",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_SUM_XY",
"=",
"new",
"MeasurementType",
"(",
"61",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_SUM_YY",
"=",
"new",
"MeasurementType",
"(",
"62",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_SUM_XXX",
"=",
"new",
"MeasurementType",
"(",
"63",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_SUM_XXY",
"=",
"new",
"MeasurementType",
"(",
"64",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_SUM_XYY",
"=",
"new",
"MeasurementType",
"(",
"65",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_SUM_YYY",
"=",
"new",
"MeasurementType",
"(",
"66",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_MOMENT_OF_INERTIA_XX",
"=",
"new",
"MeasurementType",
"(",
"68",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_MOMENT_OF_INERTIA_XY",
"=",
"new",
"MeasurementType",
"(",
"69",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_MOMENT_OF_INERTIA_YY",
"=",
"new",
"MeasurementType",
"(",
"70",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_MOMENT_OF_INERTIA_XXX",
"=",
"new",
"MeasurementType",
"(",
"71",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_MOMENT_OF_INERTIA_XXY",
"=",
"new",
"MeasurementType",
"(",
"72",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_MOMENT_OF_INERTIA_XYY",
"=",
"new",
"MeasurementType",
"(",
"73",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_MOMENT_OF_INERTIA_YYY",
"=",
"new",
"MeasurementType",
"(",
"74",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_NORM_MOMENT_OF_INERTIA_XX",
"=",
"new",
"MeasurementType",
"(",
"75",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_NORM_MOMENT_OF_INERTIA_XY",
"=",
"new",
"MeasurementType",
"(",
"76",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_NORM_MOMENT_OF_INERTIA_YY",
"=",
"new",
"MeasurementType",
"(",
"77",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_NORM_MOMENT_OF_INERTIA_XXX",
"=",
"new",
"MeasurementType",
"(",
"78",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_NORM_MOMENT_OF_INERTIA_XXY",
"=",
"new",
"MeasurementType",
"(",
"79",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_NORM_MOMENT_OF_INERTIA_XYY",
"=",
"new",
"MeasurementType",
"(",
"80",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_NORM_MOMENT_OF_INERTIA_YYY",
"=",
"new",
"MeasurementType",
"(",
"81",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_HU_MOMENT_1",
"=",
"new",
"MeasurementType",
"(",
"82",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_HU_MOMENT_2",
"=",
"new",
"MeasurementType",
"(",
"83",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_HU_MOMENT_3",
"=",
"new",
"MeasurementType",
"(",
"84",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_HU_MOMENT_4",
"=",
"new",
"MeasurementType",
"(",
"85",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_HU_MOMENT_5",
"=",
"new",
"MeasurementType",
"(",
"86",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_HU_MOMENT_6",
"=",
"new",
"MeasurementType",
"(",
"87",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MT_HU_MOMENT_7",
"=",
"new",
"MeasurementType",
"(",
"88",
")",
";",
"public",
"static",
"final",
"MeasurementType",
"IMAQ_MEASUREMENT_TYPE_SIZE_GUARD",
"=",
"new",
"MeasurementType",
"(",
"0xFFFFFFFF",
")",
";",
"private",
"MeasurementType",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"public",
"static",
"class",
"Range",
"extends",
"Structure",
"{",
"int",
"lower",
";",
"int",
"upper",
";",
"public",
"void",
"read",
"(",
")",
"{",
"lower",
"=",
"backingNativeMemory",
".",
"getInt",
"(",
"0",
")",
";",
"upper",
"=",
"backingNativeMemory",
".",
"getInt",
"(",
"4",
")",
";",
"}",
"public",
"void",
"write",
"(",
")",
"{",
"backingNativeMemory",
".",
"setInt",
"(",
"0",
",",
"lower",
")",
";",
"backingNativeMemory",
".",
"setInt",
"(",
"4",
",",
"upper",
")",
";",
"}",
"public",
"int",
"size",
"(",
")",
"{",
"return",
"8",
";",
"}",
"public",
"void",
"free",
"(",
")",
"{",
"release",
"(",
")",
";",
"}",
"public",
"Range",
"(",
"final",
"int",
"lower",
",",
"final",
"int",
"upper",
")",
"{",
"allocateMemory",
"(",
")",
";",
"set",
"(",
"lower",
",",
"upper",
")",
";",
"}",
"public",
"void",
"set",
"(",
"final",
"int",
"lower",
",",
"final",
"int",
"upper",
")",
"{",
"if",
"(",
"lower",
">",
"upper",
")",
"{",
"throw",
"new",
"BoundaryException",
"(",
"\"\"",
")",
";",
"}",
"this",
".",
"lower",
"=",
"lower",
";",
"this",
".",
"upper",
"=",
"upper",
";",
"write",
"(",
")",
";",
"}",
"public",
"int",
"getLower",
"(",
")",
"{",
"read",
"(",
")",
";",
"return",
"lower",
";",
"}",
"public",
"int",
"getUpper",
"(",
")",
"{",
"read",
"(",
")",
";",
"return",
"upper",
";",
"}",
"}",
"protected",
"static",
"final",
"BlockingFunction",
"imaqCreateImageFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getBlockingFunction",
"(",
"\"\"",
")",
";",
"static",
"{",
"imaqCreateImageFn",
".",
"setTaskExecutor",
"(",
"taskExecutor",
")",
";",
"}",
"public",
"static",
"Pointer",
"imaqCreateImage",
"(",
"ImageType",
"type",
",",
"int",
"borderSize",
")",
"throws",
"NIVisionException",
"{",
"int",
"toReturn",
"=",
"imaqCreateImageFn",
".",
"call2",
"(",
"type",
".",
"value",
",",
"borderSize",
")",
";",
"assertCleanStatus",
"(",
"toReturn",
")",
";",
"return",
"new",
"Pointer",
"(",
"toReturn",
",",
"0",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"imaqWriteFileFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"static",
"void",
"writeFile",
"(",
"Pointer",
"image",
",",
"String",
"fileName",
")",
"throws",
"NIVisionException",
"{",
"Pointer",
"p",
"=",
"new",
"Pointer",
"(",
"fileName",
".",
"length",
"(",
")",
"+",
"1",
")",
";",
"p",
".",
"setString",
"(",
"0",
",",
"fileName",
")",
";",
"setWriteFileAllowed",
"(",
"true",
")",
";",
"try",
"{",
"assertCleanStatus",
"(",
"imaqWriteFileFn",
".",
"call3",
"(",
"image",
",",
"p",
",",
"0",
")",
")",
";",
"}",
"finally",
"{",
"p",
".",
"free",
"(",
")",
";",
"}",
"}",
"public",
"static",
"void",
"writeFile",
"(",
"Pointer",
"image",
",",
"String",
"fileName",
",",
"Pointer",
"colorTable",
")",
"throws",
"NIVisionException",
"{",
"Pointer",
"p",
"=",
"new",
"Pointer",
"(",
"fileName",
".",
"length",
"(",
")",
"+",
"1",
")",
";",
"p",
".",
"setString",
"(",
"0",
",",
"fileName",
")",
";",
"setWriteFileAllowed",
"(",
"true",
")",
";",
"try",
"{",
"assertCleanStatus",
"(",
"imaqWriteFileFn",
".",
"call3",
"(",
"image",
",",
"p",
",",
"colorTable",
")",
")",
";",
"}",
"finally",
"{",
"p",
".",
"free",
"(",
")",
";",
"}",
"}",
"private",
"static",
"final",
"BlockingFunction",
"imaqReadFileFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getBlockingFunction",
"(",
"\"imaqReadFile\"",
")",
";",
"static",
"{",
"imaqReadFileFn",
".",
"setTaskExecutor",
"(",
"taskExecutor",
")",
";",
"}",
"public",
"static",
"void",
"readFile",
"(",
"Pointer",
"image",
",",
"String",
"fileName",
")",
"throws",
"NIVisionException",
"{",
"Pointer",
"p",
"=",
"new",
"Pointer",
"(",
"fileName",
".",
"length",
"(",
")",
"+",
"1",
")",
";",
"p",
".",
"setString",
"(",
"0",
",",
"fileName",
")",
";",
"try",
"{",
"assertCleanStatus",
"(",
"imaqReadFileFn",
".",
"call4",
"(",
"image",
",",
"p",
",",
"0",
",",
"0",
")",
")",
";",
"}",
"finally",
"{",
"p",
".",
"free",
"(",
")",
";",
"}",
"}",
"private",
"static",
"final",
"BlockingFunction",
"imaqColorThresholdFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getBlockingFunction",
"(",
"\"\"",
")",
";",
"static",
"{",
"imaqColorThresholdFn",
".",
"setTaskExecutor",
"(",
"taskExecutor",
")",
";",
"}",
"public",
"static",
"void",
"colorThreshold",
"(",
"Pointer",
"dest",
",",
"Pointer",
"source",
",",
"ColorMode",
"mode",
",",
"Pointer",
"plane1Range",
",",
"Pointer",
"plane2Range",
",",
"Pointer",
"plane3Range",
")",
"throws",
"NIVisionException",
"{",
"int",
"replaceValue",
"=",
"1",
";",
"assertCleanStatus",
"(",
"imaqColorThresholdFn",
".",
"call7",
"(",
"dest",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
",",
"source",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
",",
"replaceValue",
",",
"mode",
".",
"value",
",",
"plane1Range",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
",",
"plane2Range",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
",",
"plane3Range",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
")",
")",
";",
"}",
"private",
"static",
"final",
"BlockingFunction",
"imaqCountParticlesFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getBlockingFunction",
"(",
"\"\"",
")",
";",
"static",
"{",
"imaqCountParticlesFn",
".",
"setTaskExecutor",
"(",
"taskExecutor",
")",
";",
"}",
"public",
"static",
"int",
"countParticles",
"(",
"Pointer",
"image",
")",
"throws",
"NIVisionException",
"{",
"IntByReference",
"i",
"=",
"new",
"IntByReference",
"(",
"0",
")",
";",
"int",
"val",
";",
"try",
"{",
"assertCleanStatus",
"(",
"imaqCountParticlesFn",
".",
"call3",
"(",
"image",
",",
"1",
",",
"i",
".",
"getPointer",
"(",
")",
")",
")",
";",
"}",
"finally",
"{",
"val",
"=",
"i",
".",
"getValue",
"(",
")",
";",
"i",
".",
"free",
"(",
")",
";",
"}",
"return",
"val",
";",
"}",
"private",
"static",
"final",
"BlockingFunction",
"imaqMeasureParticleFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getBlockingFunction",
"(",
"\"\"",
")",
";",
"static",
"{",
"imaqMeasureParticleFn",
".",
"setTaskExecutor",
"(",
"taskExecutor",
")",
";",
"}",
"public",
"static",
"double",
"MeasureParticle",
"(",
"Pointer",
"image",
",",
"int",
"particleNum",
",",
"boolean",
"calibrated",
",",
"MeasurementType",
"type",
")",
"throws",
"NIVisionException",
"{",
"Pointer",
"l",
"=",
"new",
"Pointer",
"(",
"8",
")",
";",
"double",
"val",
";",
"try",
"{",
"assertCleanStatus",
"(",
"imaqMeasureParticleFn",
".",
"call5",
"(",
"image",
",",
"particleNum",
",",
"calibrated",
"?",
"1",
":",
"0",
",",
"type",
".",
"value",
",",
"l",
")",
")",
";",
"}",
"finally",
"{",
"val",
"=",
"l",
".",
"getDouble",
"(",
"0",
")",
";",
"l",
".",
"free",
"(",
")",
";",
"}",
"return",
"val",
";",
"}",
"private",
"static",
"final",
"BlockingFunction",
"imaqDisposeFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getBlockingFunction",
"(",
"\"imaqDispose\"",
")",
";",
"static",
"{",
"imaqDisposeFn",
".",
"setTaskExecutor",
"(",
"taskExecutor",
")",
";",
"}",
"public",
"static",
"void",
"dispose",
"(",
"Pointer",
"item",
")",
"throws",
"NIVisionException",
"{",
"assertCleanStatus",
"(",
"imaqDisposeFn",
".",
"call1",
"(",
"item",
")",
")",
";",
"}",
"private",
"static",
"final",
"BlockingFunction",
"imaqGetImageSizeFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getBlockingFunction",
"(",
"\"\"",
")",
";",
"static",
"{",
"imaqGetImageSizeFn",
".",
"setTaskExecutor",
"(",
"taskExecutor",
")",
";",
"}",
"public",
"static",
"int",
"getHeight",
"(",
"Pointer",
"image",
")",
"throws",
"NIVisionException",
"{",
"Pointer",
"i",
"=",
"new",
"Pointer",
"(",
"4",
")",
";",
"int",
"val",
";",
"try",
"{",
"assertCleanStatus",
"(",
"imaqGetImageSizeFn",
".",
"call3",
"(",
"image",
",",
"0",
",",
"i",
")",
")",
";",
"}",
"finally",
"{",
"val",
"=",
"i",
".",
"getInt",
"(",
"0",
")",
";",
"i",
".",
"free",
"(",
")",
";",
"}",
"return",
"val",
";",
"}",
"public",
"static",
"int",
"getWidth",
"(",
"Pointer",
"image",
")",
"throws",
"NIVisionException",
"{",
"Pointer",
"i",
"=",
"new",
"Pointer",
"(",
"4",
")",
";",
"int",
"val",
";",
"try",
"{",
"assertCleanStatus",
"(",
"imaqGetImageSizeFn",
".",
"call3",
"(",
"image",
",",
"i",
",",
"0",
")",
")",
";",
"}",
"finally",
"{",
"val",
"=",
"i",
".",
"getInt",
"(",
"0",
")",
";",
"i",
".",
"free",
"(",
")",
";",
"}",
"return",
"val",
";",
"}",
"private",
"static",
"final",
"BlockingFunction",
"imaqExtractColorPlanesFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getBlockingFunction",
"(",
"\"\"",
")",
";",
"static",
"{",
"imaqExtractColorPlanesFn",
".",
"setTaskExecutor",
"(",
"taskExecutor",
")",
";",
"}",
"public",
"static",
"void",
"extractColorPlanes",
"(",
"Pointer",
"source",
",",
"ColorMode",
"mode",
",",
"Pointer",
"plane1",
",",
"Pointer",
"plane2",
",",
"Pointer",
"plane3",
")",
"throws",
"NIVisionException",
"{",
"int",
"plane_1",
"=",
"0",
";",
"int",
"plane_2",
"=",
"0",
";",
"int",
"plane_3",
"=",
"0",
";",
"if",
"(",
"plane1",
"!=",
"null",
")",
"plane_1",
"=",
"plane1",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
";",
"if",
"(",
"plane2",
"!=",
"null",
")",
"plane_2",
"=",
"plane2",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
";",
"if",
"(",
"plane3",
"!=",
"null",
")",
"plane_3",
"=",
"plane3",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
";",
"assertCleanStatus",
"(",
"imaqExtractColorPlanesFn",
".",
"call5",
"(",
"source",
",",
"mode",
".",
"value",
",",
"plane_1",
",",
"plane_2",
",",
"plane_3",
")",
")",
";",
"}",
"private",
"static",
"final",
"BlockingFunction",
"imaqReplaceColorPlanesFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getBlockingFunction",
"(",
"\"\"",
")",
";",
"static",
"{",
"imaqReplaceColorPlanesFn",
".",
"setTaskExecutor",
"(",
"taskExecutor",
")",
";",
"}",
"public",
"static",
"void",
"replaceColorPlanes",
"(",
"Pointer",
"dest",
",",
"Pointer",
"source",
",",
"ColorMode",
"mode",
",",
"Pointer",
"plane1",
",",
"Pointer",
"plane2",
",",
"Pointer",
"plane3",
")",
"throws",
"NIVisionException",
"{",
"int",
"plane_1",
"=",
"0",
";",
"int",
"plane_2",
"=",
"0",
";",
"int",
"plane_3",
"=",
"0",
";",
"if",
"(",
"plane1",
"!=",
"null",
")",
"plane_1",
"=",
"plane1",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
";",
"if",
"(",
"plane2",
"!=",
"null",
")",
"plane_2",
"=",
"plane2",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
";",
"if",
"(",
"plane3",
"!=",
"null",
")",
"plane_3",
"=",
"plane3",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
";",
"assertCleanStatus",
"(",
"imaqReplaceColorPlanesFn",
".",
"call6",
"(",
"dest",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
",",
"source",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
",",
"mode",
".",
"value",
",",
"plane_1",
",",
"plane_2",
",",
"plane_3",
")",
")",
";",
"}",
"private",
"static",
"final",
"BlockingFunction",
"imaqColorEqualizeFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getBlockingFunction",
"(",
"\"\"",
")",
";",
"static",
"{",
"imaqColorEqualizeFn",
".",
"setTaskExecutor",
"(",
"taskExecutor",
")",
";",
"}",
"public",
"static",
"void",
"colorEqualize",
"(",
"Pointer",
"destination",
",",
"Pointer",
"source",
",",
"boolean",
"all",
")",
"throws",
"NIVisionException",
"{",
"assertCleanStatus",
"(",
"imaqColorEqualizeFn",
".",
"call3",
"(",
"destination",
",",
"source",
",",
"all",
"?",
"1",
":",
"0",
")",
")",
";",
"}",
"private",
"static",
"final",
"BlockingFunction",
"imaqDetectEllipsesFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getBlockingFunction",
"(",
"\"\"",
")",
";",
"static",
"{",
"imaqDetectEllipsesFn",
".",
"setTaskExecutor",
"(",
"NIVision",
".",
"taskExecutor",
")",
";",
"}",
"private",
"static",
"Pointer",
"numberOfEllipsesDetected",
"=",
"new",
"Pointer",
"(",
"4",
")",
";",
"public",
"static",
"EllipseMatch",
"[",
"]",
"detectEllipses",
"(",
"MonoImage",
"image",
",",
"EllipseDescriptor",
"ellipseDescriptor",
",",
"CurveOptions",
"curveOptions",
",",
"ShapeDetectionOptions",
"shapeDetectionOptions",
",",
"RegionOfInterest",
"roi",
")",
"throws",
"NIVisionException",
"{",
"int",
"curveOptionsPointer",
"=",
"0",
";",
"if",
"(",
"curveOptions",
"!=",
"null",
")",
"curveOptionsPointer",
"=",
"curveOptions",
".",
"getPointer",
"(",
")",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
";",
"int",
"shapeDetectionOptionsPointer",
"=",
"0",
";",
"if",
"(",
"shapeDetectionOptions",
"!=",
"null",
")",
"shapeDetectionOptionsPointer",
"=",
"shapeDetectionOptions",
".",
"getPointer",
"(",
")",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
";",
"int",
"roiPointer",
"=",
"0",
";",
"if",
"(",
"roi",
"!=",
"null",
")",
"roiPointer",
"=",
"roi",
".",
"getPointer",
"(",
")",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
";",
"int",
"returnedAddress",
"=",
"imaqDetectEllipsesFn",
".",
"call6",
"(",
"image",
".",
"image",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
",",
"ellipseDescriptor",
".",
"getPointer",
"(",
")",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
",",
"curveOptionsPointer",
",",
"shapeDetectionOptionsPointer",
",",
"roiPointer",
",",
"numberOfEllipsesDetected",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
")",
";",
"try",
"{",
"NIVision",
".",
"assertCleanStatus",
"(",
"returnedAddress",
")",
";",
"}",
"catch",
"(",
"NIVisionException",
"ex",
")",
"{",
"if",
"(",
"!",
"ex",
".",
"getMessage",
"(",
")",
".",
"equals",
"(",
"\"No",
"error.\"",
")",
")",
"throw",
"ex",
";",
"}",
"EllipseMatch",
"[",
"]",
"matches",
"=",
"EllipseMatch",
".",
"getMatchesFromMemory",
"(",
"returnedAddress",
",",
"numberOfEllipsesDetected",
".",
"getInt",
"(",
"0",
")",
")",
";",
"NIVision",
".",
"dispose",
"(",
"new",
"Pointer",
"(",
"returnedAddress",
",",
"0",
")",
")",
";",
"return",
"matches",
";",
"}",
"}",
"</s>"
] |
7,488 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"communication",
".",
"*",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"IInputOutput",
";",
"public",
"class",
"DriverStation",
"implements",
"IInputOutput",
"{",
"public",
"static",
"final",
"int",
"USER_CONTROL_DATA_SIZE",
"=",
"FRCControl",
".",
"USER_CONTROL_DATA_SIZE",
";",
"public",
"static",
"final",
"int",
"USER_STATUS_DATA_SIZE",
"=",
"FRCControl",
".",
"USER_STATUS_DATA_SIZE",
";",
"public",
"static",
"final",
"int",
"kBatterySlot",
"=",
"1",
";",
"public",
"static",
"final",
"int",
"kBatteryChannel",
"=",
"8",
";",
"public",
"static",
"final",
"int",
"kJoystickPorts",
"=",
"4",
";",
"public",
"static",
"final",
"int",
"kJoystickAxes",
"=",
"6",
";",
"public",
"static",
"final",
"double",
"kDSAnalogInScaling",
"=",
"5.0",
"/",
"1023.0",
";",
"public",
"static",
"class",
"Alliance",
"{",
"public",
"final",
"int",
"value",
";",
"public",
"final",
"String",
"name",
";",
"public",
"static",
"final",
"int",
"kRed_val",
"=",
"0",
";",
"public",
"static",
"final",
"int",
"kBlue_val",
"=",
"1",
";",
"public",
"static",
"final",
"int",
"kInvalid_val",
"=",
"2",
";",
"public",
"static",
"final",
"Alliance",
"kRed",
"=",
"new",
"Alliance",
"(",
"kRed_val",
",",
"\"Red\"",
")",
";",
"public",
"static",
"final",
"Alliance",
"kBlue",
"=",
"new",
"Alliance",
"(",
"kBlue_val",
",",
"\"Blue\"",
")",
";",
"public",
"static",
"final",
"Alliance",
"kInvalid",
"=",
"new",
"Alliance",
"(",
"kInvalid_val",
",",
"\"invalid\"",
")",
";",
"private",
"Alliance",
"(",
"int",
"value",
",",
"String",
"name",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"this",
".",
"name",
"=",
"name",
";",
"}",
"}",
"private",
"static",
"class",
"DriverStationTask",
"implements",
"Runnable",
"{",
"private",
"DriverStation",
"m_ds",
";",
"DriverStationTask",
"(",
"DriverStation",
"ds",
")",
"{",
"m_ds",
"=",
"ds",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"m_ds",
".",
"task",
"(",
")",
";",
"}",
"}",
"private",
"static",
"DriverStation",
"instance",
"=",
"new",
"DriverStation",
"(",
")",
";",
"private",
"FRCCommonControlData",
"m_controlData",
";",
"private",
"AnalogChannel",
"m_batteryChannel",
";",
"private",
"Thread",
"m_thread",
";",
"private",
"final",
"Object",
"m_semaphore",
";",
"private",
"int",
"m_digitalOut",
";",
"private",
"volatile",
"boolean",
"m_thread_keepalive",
"=",
"true",
";",
"private",
"final",
"Dashboard",
"m_dashboardDefaultHigh",
";",
"private",
"final",
"Dashboard",
"m_dashboardDefaultLow",
";",
"private",
"IDashboard",
"m_dashboardInUseHigh",
";",
"private",
"IDashboard",
"m_dashboardInUseLow",
";",
"private",
"int",
"m_updateNumber",
"=",
"0",
";",
"private",
"boolean",
"m_newControlData",
";",
"private",
"final",
"Semaphore",
"m_packetDataAvailableSem",
";",
"private",
"DriverStationEnhancedIO",
"m_enhancedIO",
"=",
"new",
"DriverStationEnhancedIO",
"(",
")",
";",
"public",
"static",
"DriverStation",
"getInstance",
"(",
")",
"{",
"return",
"DriverStation",
".",
"instance",
";",
"}",
"protected",
"DriverStation",
"(",
")",
"{",
"m_controlData",
"=",
"new",
"FRCCommonControlData",
"(",
")",
";",
"m_semaphore",
"=",
"new",
"Object",
"(",
")",
";",
"m_dashboardInUseHigh",
"=",
"m_dashboardDefaultHigh",
"=",
"new",
"Dashboard",
"(",
"m_semaphore",
")",
";",
"m_dashboardInUseLow",
"=",
"m_dashboardDefaultLow",
"=",
"new",
"Dashboard",
"(",
"m_semaphore",
")",
";",
"m_batteryChannel",
"=",
"new",
"AnalogChannel",
"(",
"kBatterySlot",
",",
"kBatteryChannel",
")",
";",
"Semaphore",
".",
"Options",
"options",
"=",
"new",
"Semaphore",
".",
"Options",
"(",
")",
";",
"options",
".",
"setPrioritySorted",
"(",
"true",
")",
";",
"m_packetDataAvailableSem",
"=",
"new",
"Semaphore",
"(",
"options",
",",
"false",
")",
";",
"FRCControl",
".",
"setNewDataSem",
"(",
"m_packetDataAvailableSem",
")",
";",
"m_thread",
"=",
"new",
"Thread",
"(",
"new",
"DriverStationTask",
"(",
"this",
")",
",",
"\"\"",
")",
";",
"m_thread",
".",
"setPriority",
"(",
"(",
"Thread",
".",
"NORM_PRIORITY",
"+",
"Thread",
".",
"MAX_PRIORITY",
")",
"/",
"2",
")",
";",
"m_thread",
".",
"start",
"(",
")",
";",
"}",
"public",
"void",
"release",
"(",
")",
"{",
"m_thread_keepalive",
"=",
"false",
";",
"}",
"private",
"void",
"task",
"(",
")",
"{",
"int",
"safetyCounter",
"=",
"0",
";",
"while",
"(",
"m_thread_keepalive",
")",
"{",
"try",
"{",
"m_packetDataAvailableSem",
".",
"takeForever",
"(",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"getData",
"(",
")",
";",
"m_enhancedIO",
".",
"updateData",
"(",
")",
";",
"setData",
"(",
")",
";",
"}",
"if",
"(",
"++",
"safetyCounter",
">=",
"5",
")",
"{",
"MotorSafetyHelper",
".",
"checkMotors",
"(",
")",
";",
"safetyCounter",
"=",
"0",
";",
"}",
"}",
"catch",
"(",
"SemaphoreException",
"ex",
")",
"{",
"}",
"}",
"}",
"protected",
"synchronized",
"void",
"getData",
"(",
")",
"{",
"FRCControl",
".",
"getCommonControlData",
"(",
"m_controlData",
",",
"Semaphore",
".",
"WAIT_FOREVER",
")",
";",
"m_newControlData",
"=",
"true",
";",
"}",
"protected",
"void",
"setData",
"(",
")",
"{",
"synchronized",
"(",
"m_semaphore",
")",
"{",
"FRCControl",
".",
"setStatusData",
"(",
"getBatteryVoltage",
"(",
")",
",",
"m_digitalOut",
",",
"m_updateNumber",
",",
"m_dashboardInUseHigh",
".",
"getBytes",
"(",
")",
",",
"m_dashboardInUseHigh",
".",
"getBytesLength",
"(",
")",
",",
"m_dashboardInUseLow",
".",
"getBytes",
"(",
")",
",",
"m_dashboardInUseLow",
".",
"getBytesLength",
"(",
")",
",",
"Semaphore",
".",
"WAIT_FOREVER",
")",
";",
"m_dashboardInUseHigh",
".",
"flush",
"(",
")",
";",
"m_dashboardInUseLow",
".",
"flush",
"(",
")",
";",
"}",
"}",
"public",
"double",
"getBatteryVoltage",
"(",
")",
"{",
"return",
"m_batteryChannel",
".",
"getAverageVoltage",
"(",
")",
"*",
"(",
"1680.0",
"/",
"1000.0",
")",
";",
"}",
"public",
"double",
"getStickAxis",
"(",
"int",
"stick",
",",
"int",
"axis",
")",
"{",
"if",
"(",
"axis",
"<",
"1",
"||",
"axis",
">",
"kJoystickAxes",
")",
"{",
"return",
"0.0",
";",
"}",
"int",
"value",
";",
"switch",
"(",
"stick",
")",
"{",
"case",
"1",
":",
"value",
"=",
"m_controlData",
".",
"stick0Axes",
"[",
"axis",
"-",
"1",
"]",
";",
"break",
";",
"case",
"2",
":",
"value",
"=",
"m_controlData",
".",
"stick1Axes",
"[",
"axis",
"-",
"1",
"]",
";",
"break",
";",
"case",
"3",
":",
"value",
"=",
"m_controlData",
".",
"stick2Axes",
"[",
"axis",
"-",
"1",
"]",
";",
"break",
";",
"case",
"4",
":",
"value",
"=",
"m_controlData",
".",
"stick3Axes",
"[",
"axis",
"-",
"1",
"]",
";",
"break",
";",
"default",
":",
"return",
"0.0",
";",
"}",
"double",
"result",
";",
"if",
"(",
"value",
"<",
"0",
")",
"{",
"result",
"=",
"(",
"(",
"double",
")",
"value",
")",
"/",
"128.0",
";",
"}",
"else",
"{",
"result",
"=",
"(",
"(",
"double",
")",
"value",
")",
"/",
"127.0",
";",
"}",
"if",
"(",
"result",
">",
"1.0",
")",
"{",
"result",
"=",
"1.0",
";",
"}",
"else",
"if",
"(",
"result",
"<",
"-",
"1.0",
")",
"{",
"result",
"=",
"-",
"1.0",
";",
"}",
"return",
"result",
";",
"}",
"public",
"int",
"getStickButtons",
"(",
"final",
"int",
"stick",
")",
"{",
"switch",
"(",
"stick",
")",
"{",
"case",
"1",
":",
"return",
"m_controlData",
".",
"stick0Buttons",
";",
"case",
"2",
":",
"return",
"m_controlData",
".",
"stick1Buttons",
";",
"case",
"3",
":",
"return",
"m_controlData",
".",
"stick2Buttons",
";",
"case",
"4",
":",
"return",
"m_controlData",
".",
"stick3Buttons",
";",
"default",
":",
"return",
"0",
";",
"}",
"}",
"public",
"double",
"getAnalogIn",
"(",
"final",
"int",
"channel",
")",
"{",
"switch",
"(",
"channel",
")",
"{",
"case",
"1",
":",
"return",
"kDSAnalogInScaling",
"*",
"m_controlData",
".",
"analog1",
";",
"case",
"2",
":",
"return",
"kDSAnalogInScaling",
"*",
"m_controlData",
".",
"analog2",
";",
"case",
"3",
":",
"return",
"kDSAnalogInScaling",
"*",
"m_controlData",
".",
"analog3",
";",
"case",
"4",
":",
"return",
"kDSAnalogInScaling",
"*",
"m_controlData",
".",
"analog4",
";",
"default",
":",
"return",
"0.0",
";",
"}",
"}",
"public",
"boolean",
"getDigitalIn",
"(",
"final",
"int",
"channel",
")",
"{",
"return",
"(",
"(",
"m_controlData",
".",
"dsDigitalIn",
">>",
"(",
"channel",
"-",
"1",
")",
")",
"&",
"0x1",
")",
"==",
"0x1",
";",
"}",
"public",
"void",
"setDigitalOut",
"(",
"final",
"int",
"channel",
",",
"final",
"boolean",
"value",
")",
"{",
"m_digitalOut",
"&=",
"~",
"(",
"0x1",
"<<",
"(",
"channel",
"-",
"1",
")",
")",
";",
"m_digitalOut",
"|=",
"(",
"(",
"value",
"?",
"1",
":",
"0",
")",
"<<",
"(",
"channel",
"-",
"1",
")",
")",
";",
"}",
"public",
"boolean",
"getDigitalOut",
"(",
"final",
"int",
"channel",
")",
"{",
"return",
"(",
"(",
"m_digitalOut",
">>",
"(",
"channel",
"-",
"1",
")",
")",
"&",
"0x1",
")",
"==",
"0x1",
";",
"}",
"public",
"boolean",
"isEnabled",
"(",
")",
"{",
"return",
"m_controlData",
".",
"enabled",
"(",
")",
";",
"}",
"public",
"boolean",
"isDisabled",
"(",
")",
"{",
"return",
"!",
"m_controlData",
".",
"enabled",
"(",
")",
";",
"}",
"public",
"boolean",
"isAutonomous",
"(",
")",
"{",
"return",
"m_controlData",
".",
"autonomous",
"(",
")",
";",
"}",
"public",
"boolean",
"isOperatorControl",
"(",
")",
"{",
"return",
"!",
"m_controlData",
".",
"autonomous",
"(",
")",
";",
"}",
"public",
"synchronized",
"boolean",
"isNewControlData",
"(",
")",
"{",
"boolean",
"result",
"=",
"m_newControlData",
";",
"m_newControlData",
"=",
"false",
";",
"return",
"result",
";",
"}",
"public",
"int",
"getPacketNumber",
"(",
")",
"{",
"return",
"m_controlData",
".",
"packetIndex",
";",
"}",
"public",
"Alliance",
"getAlliance",
"(",
")",
"{",
"switch",
"(",
"m_controlData",
".",
"dsID_Alliance",
")",
"{",
"case",
"'R'",
":",
"return",
"Alliance",
".",
"kRed",
";",
"case",
"'B'",
":",
"return",
"Alliance",
".",
"kBlue",
";",
"default",
":",
"return",
"Alliance",
".",
"kInvalid",
";",
"}",
"}",
"public",
"int",
"getLocation",
"(",
")",
"{",
"return",
"m_controlData",
".",
"dsID_Position",
"-",
"'0'",
";",
"}",
"public",
"void",
"setDashboardPackerToUseHigh",
"(",
"IDashboard",
"dashboard",
")",
"{",
"m_dashboardInUseHigh",
"=",
"dashboard",
";",
"}",
"public",
"Dashboard",
"getDashboardPackerHigh",
"(",
")",
"{",
"return",
"m_dashboardDefaultHigh",
";",
"}",
"public",
"IDashboard",
"getDashboardPackerInUseHigh",
"(",
")",
"{",
"return",
"m_dashboardInUseHigh",
";",
"}",
"public",
"void",
"setDashboardPackerToUseLow",
"(",
"IDashboard",
"dashboard",
")",
"{",
"m_dashboardInUseLow",
"=",
"dashboard",
";",
"}",
"public",
"Dashboard",
"getDashboardPackerLow",
"(",
")",
"{",
"return",
"m_dashboardDefaultLow",
";",
"}",
"public",
"IDashboard",
"getDashboardPackerInUseLow",
"(",
")",
"{",
"return",
"m_dashboardInUseLow",
";",
"}",
"public",
"Object",
"getStatusDataMonitor",
"(",
")",
"{",
"return",
"m_semaphore",
";",
"}",
"void",
"incrementUpdateNumber",
"(",
")",
"{",
"synchronized",
"(",
"m_semaphore",
")",
"{",
"m_updateNumber",
"++",
";",
"}",
"}",
"public",
"boolean",
"isFMSAttached",
"(",
")",
"{",
"return",
"(",
"m_controlData",
".",
"control",
"&",
"FRCCommonControlData",
".",
"FMS_ATTATCHED",
")",
">",
"0",
";",
"}",
"public",
"DriverStationEnhancedIO",
"getEnhancedIO",
"(",
")",
"{",
"return",
"m_enhancedIO",
";",
"}",
"}",
"</s>"
] |
7,489 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"IUtility",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"BoundaryException",
";",
"import",
"java",
".",
"util",
".",
"TimerTask",
";",
"public",
"class",
"PIDController",
"implements",
"IUtility",
"{",
"public",
"static",
"final",
"double",
"kDefaultPeriod",
"=",
".05",
";",
"private",
"double",
"m_P",
";",
"private",
"double",
"m_I",
";",
"private",
"double",
"m_D",
";",
"private",
"double",
"m_maximumOutput",
"=",
"1.0",
";",
"private",
"double",
"m_minimumOutput",
"=",
"-",
"1.0",
";",
"private",
"double",
"m_maximumInput",
"=",
"0.0",
";",
"private",
"double",
"m_minimumInput",
"=",
"0.0",
";",
"private",
"boolean",
"m_continuous",
"=",
"false",
";",
"private",
"boolean",
"m_enabled",
"=",
"false",
";",
"private",
"double",
"m_prevError",
"=",
"0.0",
";",
"private",
"double",
"m_totalError",
"=",
"0.0",
";",
"private",
"double",
"m_tolerance",
"=",
"0.05",
";",
"private",
"double",
"m_setpoint",
"=",
"0.0",
";",
"private",
"double",
"m_error",
"=",
"0.0",
";",
"private",
"double",
"m_result",
"=",
"0.0",
";",
"private",
"double",
"m_period",
"=",
"kDefaultPeriod",
";",
"PIDSource",
"m_pidInput",
";",
"PIDOutput",
"m_pidOutput",
";",
"java",
".",
"util",
".",
"Timer",
"m_controlLoop",
";",
"private",
"class",
"PIDTask",
"extends",
"TimerTask",
"{",
"private",
"PIDController",
"m_controller",
";",
"public",
"PIDTask",
"(",
"PIDController",
"controller",
")",
"{",
"if",
"(",
"controller",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"}",
"m_controller",
"=",
"controller",
";",
"}",
"public",
"void",
"run",
"(",
")",
"{",
"m_controller",
".",
"calculate",
"(",
")",
";",
"}",
"}",
"public",
"PIDController",
"(",
"double",
"Kp",
",",
"double",
"Ki",
",",
"double",
"Kd",
",",
"PIDSource",
"source",
",",
"PIDOutput",
"output",
",",
"double",
"period",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"if",
"(",
"output",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"\"",
")",
";",
"m_controlLoop",
"=",
"new",
"java",
".",
"util",
".",
"Timer",
"(",
")",
";",
"m_P",
"=",
"Kp",
";",
"m_I",
"=",
"Ki",
";",
"m_D",
"=",
"Kd",
";",
"m_pidInput",
"=",
"source",
";",
"m_pidOutput",
"=",
"output",
";",
"m_period",
"=",
"period",
";",
"m_controlLoop",
".",
"schedule",
"(",
"new",
"PIDTask",
"(",
"this",
")",
",",
"0L",
",",
"(",
"long",
")",
"(",
"m_period",
"*",
"1000",
")",
")",
";",
"}",
"public",
"PIDController",
"(",
"double",
"Kp",
",",
"double",
"Ki",
",",
"double",
"Kd",
",",
"PIDSource",
"source",
",",
"PIDOutput",
"output",
")",
"{",
"this",
"(",
"Kp",
",",
"Ki",
",",
"Kd",
",",
"source",
",",
"output",
",",
"kDefaultPeriod",
")",
";",
"}",
"protected",
"void",
"free",
"(",
")",
"{",
"m_controlLoop",
".",
"cancel",
"(",
")",
";",
"m_controlLoop",
"=",
"null",
";",
"}",
"private",
"void",
"calculate",
"(",
")",
"{",
"boolean",
"enabled",
";",
"PIDSource",
"pidInput",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"m_pidInput",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"m_pidOutput",
"==",
"null",
")",
"{",
"return",
";",
"}",
"enabled",
"=",
"m_enabled",
";",
"pidInput",
"=",
"m_pidInput",
";",
"}",
"if",
"(",
"enabled",
")",
"{",
"double",
"input",
"=",
"pidInput",
".",
"pidGet",
"(",
")",
";",
"double",
"result",
";",
"PIDOutput",
"pidOutput",
"=",
"null",
";",
"synchronized",
"(",
"this",
")",
"{",
"m_error",
"=",
"m_setpoint",
"-",
"input",
";",
"if",
"(",
"m_continuous",
")",
"{",
"if",
"(",
"Math",
".",
"abs",
"(",
"m_error",
")",
">",
"(",
"m_maximumInput",
"-",
"m_minimumInput",
")",
"/",
"2",
")",
"{",
"if",
"(",
"m_error",
">",
"0",
")",
"{",
"m_error",
"=",
"m_error",
"-",
"m_maximumInput",
"+",
"m_minimumInput",
";",
"}",
"else",
"{",
"m_error",
"=",
"m_error",
"+",
"m_maximumInput",
"-",
"m_minimumInput",
";",
"}",
"}",
"}",
"if",
"(",
"(",
"(",
"m_totalError",
"+",
"m_error",
")",
"*",
"m_I",
"<",
"m_maximumOutput",
")",
"&&",
"(",
"(",
"m_totalError",
"+",
"m_error",
")",
"*",
"m_I",
">",
"m_minimumOutput",
")",
")",
"{",
"m_totalError",
"+=",
"m_error",
";",
"}",
"m_result",
"=",
"(",
"m_P",
"*",
"m_error",
"+",
"m_I",
"*",
"m_totalError",
"+",
"m_D",
"*",
"(",
"m_error",
"-",
"m_prevError",
")",
")",
";",
"m_prevError",
"=",
"m_error",
";",
"if",
"(",
"m_result",
">",
"m_maximumOutput",
")",
"{",
"m_result",
"=",
"m_maximumOutput",
";",
"}",
"else",
"if",
"(",
"m_result",
"<",
"m_minimumOutput",
")",
"{",
"m_result",
"=",
"m_minimumOutput",
";",
"}",
"pidOutput",
"=",
"m_pidOutput",
";",
"result",
"=",
"m_result",
";",
"}",
"pidOutput",
".",
"pidWrite",
"(",
"result",
")",
";",
"}",
"}",
"public",
"synchronized",
"void",
"setPID",
"(",
"double",
"p",
",",
"double",
"i",
",",
"double",
"d",
")",
"{",
"m_P",
"=",
"p",
";",
"m_I",
"=",
"i",
";",
"m_D",
"=",
"d",
";",
"}",
"public",
"double",
"getP",
"(",
")",
"{",
"return",
"m_P",
";",
"}",
"public",
"double",
"getI",
"(",
")",
"{",
"return",
"m_I",
";",
"}",
"public",
"synchronized",
"double",
"getD",
"(",
")",
"{",
"return",
"m_D",
";",
"}",
"public",
"synchronized",
"double",
"get",
"(",
")",
"{",
"return",
"m_result",
";",
"}",
"public",
"synchronized",
"void",
"setContinuous",
"(",
"boolean",
"continuous",
")",
"{",
"m_continuous",
"=",
"continuous",
";",
"}",
"public",
"synchronized",
"void",
"setContinuous",
"(",
")",
"{",
"this",
".",
"setContinuous",
"(",
"true",
")",
";",
"}",
"public",
"synchronized",
"void",
"setInputRange",
"(",
"double",
"minimumInput",
",",
"double",
"maximumInput",
")",
"{",
"if",
"(",
"minimumInput",
">",
"maximumInput",
")",
"{",
"throw",
"new",
"BoundaryException",
"(",
"\"\"",
")",
";",
"}",
"m_minimumInput",
"=",
"minimumInput",
";",
"m_maximumInput",
"=",
"maximumInput",
";",
"setSetpoint",
"(",
"m_setpoint",
")",
";",
"}",
"public",
"synchronized",
"void",
"setOutputRange",
"(",
"double",
"minimumOutput",
",",
"double",
"maximumOutput",
")",
"{",
"if",
"(",
"minimumOutput",
">",
"maximumOutput",
")",
"{",
"throw",
"new",
"BoundaryException",
"(",
"\"\"",
")",
";",
"}",
"m_minimumOutput",
"=",
"minimumOutput",
";",
"m_maximumOutput",
"=",
"maximumOutput",
";",
"}",
"public",
"synchronized",
"void",
"setSetpoint",
"(",
"double",
"setpoint",
")",
"{",
"if",
"(",
"m_maximumInput",
">",
"m_minimumInput",
")",
"{",
"if",
"(",
"setpoint",
">",
"m_maximumInput",
")",
"{",
"m_setpoint",
"=",
"m_maximumInput",
";",
"}",
"else",
"if",
"(",
"setpoint",
"<",
"m_minimumInput",
")",
"{",
"m_setpoint",
"=",
"m_minimumInput",
";",
"}",
"else",
"{",
"m_setpoint",
"=",
"setpoint",
";",
"}",
"}",
"else",
"{",
"m_setpoint",
"=",
"setpoint",
";",
"}",
"}",
"public",
"synchronized",
"double",
"getSetpoint",
"(",
")",
"{",
"return",
"m_setpoint",
";",
"}",
"public",
"synchronized",
"double",
"getError",
"(",
")",
"{",
"return",
"m_error",
";",
"}",
"public",
"synchronized",
"void",
"setTolerance",
"(",
"double",
"percent",
")",
"{",
"m_tolerance",
"=",
"percent",
";",
"}",
"public",
"synchronized",
"boolean",
"onTarget",
"(",
")",
"{",
"return",
"(",
"Math",
".",
"abs",
"(",
"m_error",
")",
"<",
"m_tolerance",
"/",
"100",
"*",
"(",
"m_maximumInput",
"-",
"m_minimumInput",
")",
")",
";",
"}",
"public",
"synchronized",
"void",
"enable",
"(",
")",
"{",
"m_enabled",
"=",
"true",
";",
"}",
"public",
"synchronized",
"void",
"disable",
"(",
")",
"{",
"m_pidOutput",
".",
"pidWrite",
"(",
"0",
")",
";",
"m_enabled",
"=",
"false",
";",
"}",
"public",
"synchronized",
"boolean",
"isEnable",
"(",
")",
"{",
"return",
"m_enabled",
";",
"}",
"public",
"synchronized",
"void",
"reset",
"(",
")",
"{",
"disable",
"(",
")",
";",
"m_prevError",
"=",
"0",
";",
"m_totalError",
"=",
"0",
";",
"m_result",
"=",
"0",
";",
"}",
"}",
"</s>"
] |
7,490 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"AllocationException",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"CheckedAllocationException",
";",
"public",
"class",
"DoubleSolenoid",
"extends",
"SolenoidBase",
"{",
"public",
"static",
"class",
"Value",
"{",
"public",
"final",
"int",
"value",
";",
"public",
"static",
"final",
"int",
"kOff_val",
"=",
"0",
";",
"public",
"static",
"final",
"int",
"kForward_val",
"=",
"1",
";",
"public",
"static",
"final",
"int",
"kReverse_val",
"=",
"2",
";",
"public",
"static",
"final",
"Value",
"kOff",
"=",
"new",
"Value",
"(",
"kOff_val",
")",
";",
"public",
"static",
"final",
"Value",
"kForward",
"=",
"new",
"Value",
"(",
"kForward_val",
")",
";",
"public",
"static",
"final",
"Value",
"kReverse",
"=",
"new",
"Value",
"(",
"kReverse_val",
")",
";",
"private",
"Value",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"private",
"int",
"m_forwardChannel",
";",
"private",
"int",
"m_reverseChannel",
";",
"private",
"byte",
"m_forwardMask",
";",
"private",
"byte",
"m_reverseMask",
";",
"private",
"synchronized",
"void",
"initSolenoid",
"(",
")",
"{",
"checkSolenoidModule",
"(",
"m_chassisSlot",
")",
";",
"checkSolenoidChannel",
"(",
"m_forwardChannel",
")",
";",
"checkSolenoidChannel",
"(",
"m_reverseChannel",
")",
";",
"try",
"{",
"m_allocated",
".",
"allocate",
"(",
"slotToIndex",
"(",
"m_chassisSlot",
")",
"*",
"kSolenoidChannels",
"+",
"m_forwardChannel",
"-",
"1",
")",
";",
"}",
"catch",
"(",
"CheckedAllocationException",
"e",
")",
"{",
"throw",
"new",
"AllocationException",
"(",
"\"\"",
"+",
"m_forwardChannel",
"+",
"\"",
"on",
"module",
"\"",
"+",
"m_chassisSlot",
"+",
"\"\"",
")",
";",
"}",
"try",
"{",
"m_allocated",
".",
"allocate",
"(",
"slotToIndex",
"(",
"m_chassisSlot",
")",
"*",
"kSolenoidChannels",
"+",
"m_reverseChannel",
"-",
"1",
")",
";",
"}",
"catch",
"(",
"CheckedAllocationException",
"e",
")",
"{",
"throw",
"new",
"AllocationException",
"(",
"\"\"",
"+",
"m_reverseChannel",
"+",
"\"",
"on",
"module",
"\"",
"+",
"m_chassisSlot",
"+",
"\"\"",
")",
";",
"}",
"m_forwardMask",
"=",
"(",
"byte",
")",
"(",
"1",
"<<",
"(",
"m_forwardChannel",
"-",
"1",
")",
")",
";",
"m_reverseMask",
"=",
"(",
"byte",
")",
"(",
"1",
"<<",
"(",
"m_reverseChannel",
"-",
"1",
")",
")",
";",
"}",
"public",
"DoubleSolenoid",
"(",
"final",
"int",
"forwardChannel",
",",
"final",
"int",
"reverseChannel",
")",
"{",
"super",
"(",
"getDefaultSolenoidModule",
"(",
")",
")",
";",
"m_forwardChannel",
"=",
"forwardChannel",
";",
"m_reverseChannel",
"=",
"reverseChannel",
";",
"initSolenoid",
"(",
")",
";",
"}",
"public",
"DoubleSolenoid",
"(",
"final",
"int",
"slot",
",",
"final",
"int",
"forwardChannel",
",",
"final",
"int",
"reverseChannel",
")",
"{",
"super",
"(",
"slot",
")",
";",
"m_forwardChannel",
"=",
"forwardChannel",
";",
"m_reverseChannel",
"=",
"reverseChannel",
";",
"initSolenoid",
"(",
")",
";",
"}",
"protected",
"synchronized",
"void",
"free",
"(",
")",
"{",
"m_allocated",
".",
"free",
"(",
"slotToIndex",
"(",
"m_chassisSlot",
")",
"*",
"kSolenoidChannels",
"+",
"m_forwardChannel",
"-",
"1",
")",
";",
"m_allocated",
".",
"free",
"(",
"slotToIndex",
"(",
"m_chassisSlot",
")",
"*",
"kSolenoidChannels",
"+",
"m_reverseChannel",
"-",
"1",
")",
";",
"}",
"public",
"void",
"set",
"(",
"final",
"Value",
"value",
")",
"{",
"byte",
"rawValue",
"=",
"0",
";",
"switch",
"(",
"value",
".",
"value",
")",
"{",
"case",
"Value",
".",
"kOff_val",
":",
"rawValue",
"=",
"0x00",
";",
"break",
";",
"case",
"Value",
".",
"kForward_val",
":",
"rawValue",
"=",
"m_forwardMask",
";",
"break",
";",
"case",
"Value",
".",
"kReverse_val",
":",
"rawValue",
"=",
"m_reverseMask",
";",
"break",
";",
"}",
"set",
"(",
"rawValue",
",",
"m_forwardMask",
"|",
"m_reverseMask",
")",
";",
"}",
"public",
"Value",
"get",
"(",
")",
"{",
"byte",
"value",
"=",
"getAll",
"(",
")",
";",
"if",
"(",
"(",
"value",
"&",
"m_forwardMask",
")",
"!=",
"0",
")",
"return",
"Value",
".",
"kForward",
";",
"if",
"(",
"(",
"value",
"&",
"m_reverseMask",
")",
"!=",
"0",
")",
"return",
"Value",
".",
"kReverse",
";",
"return",
"Value",
".",
"kOff",
";",
"}",
"}",
"</s>"
] |
7,491 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"communication",
".",
"FRCControl",
";",
"import",
"javax",
".",
"microedition",
".",
"midlet",
".",
"MIDlet",
";",
"import",
"javax",
".",
"microedition",
".",
"midlet",
".",
"MIDletStateChangeException",
";",
"public",
"abstract",
"class",
"RobotBase",
"extends",
"MIDlet",
"{",
"public",
"static",
"final",
"int",
"ROBOT_TASK_PRIORITY",
"=",
"101",
";",
"public",
"final",
"static",
"String",
"ERRORS_TO_DRIVERSTATION_PROP",
"=",
"\"\"",
";",
"protected",
"final",
"DriverStation",
"m_ds",
";",
"private",
"final",
"Watchdog",
"m_watchdog",
"=",
"Watchdog",
".",
"getInstance",
"(",
")",
";",
"protected",
"RobotBase",
"(",
")",
"{",
"m_ds",
"=",
"DriverStation",
".",
"getInstance",
"(",
")",
";",
"m_watchdog",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"protected",
"void",
"free",
"(",
")",
"{",
"}",
"public",
"boolean",
"isSystemActive",
"(",
")",
"{",
"return",
"m_watchdog",
".",
"isSystemActive",
"(",
")",
";",
"}",
"public",
"Watchdog",
"getWatchdog",
"(",
")",
"{",
"return",
"m_watchdog",
";",
"}",
"public",
"boolean",
"isDisabled",
"(",
")",
"{",
"return",
"m_ds",
".",
"isDisabled",
"(",
")",
";",
"}",
"public",
"boolean",
"isEnabled",
"(",
")",
"{",
"return",
"m_ds",
".",
"isEnabled",
"(",
")",
";",
"}",
"public",
"boolean",
"isAutonomous",
"(",
")",
"{",
"return",
"m_ds",
".",
"isAutonomous",
"(",
")",
";",
"}",
"public",
"boolean",
"isOperatorControl",
"(",
")",
"{",
"return",
"m_ds",
".",
"isOperatorControl",
"(",
")",
";",
"}",
"public",
"boolean",
"isNewDataAvailable",
"(",
")",
"{",
"return",
"m_ds",
".",
"isNewControlData",
"(",
")",
";",
"}",
"public",
"abstract",
"void",
"startCompetition",
"(",
")",
";",
"public",
"static",
"boolean",
"getBooleanProperty",
"(",
"String",
"name",
",",
"boolean",
"defaultValue",
")",
"{",
"String",
"propVal",
"=",
"System",
".",
"getProperty",
"(",
"name",
")",
";",
"if",
"(",
"propVal",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"if",
"(",
"propVal",
".",
"equalsIgnoreCase",
"(",
"\"false\"",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"propVal",
".",
"equalsIgnoreCase",
"(",
"\"true\"",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"propVal",
")",
";",
"}",
"}",
"protected",
"final",
"void",
"startApp",
"(",
")",
"throws",
"MIDletStateChangeException",
"{",
"boolean",
"errorOnExit",
"=",
"false",
";",
"Watchdog",
".",
"getInstance",
"(",
")",
".",
"setExpiration",
"(",
"0.1",
")",
";",
"Watchdog",
".",
"getInstance",
"(",
")",
".",
"setEnabled",
"(",
"false",
")",
";",
"FRCControl",
".",
"observeUserProgramStarting",
"(",
")",
";",
"try",
"{",
"this",
".",
"startCompetition",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"t",
".",
"printStackTrace",
"(",
")",
";",
"errorOnExit",
"=",
"true",
";",
"}",
"finally",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"if",
"(",
"errorOnExit",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"else",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\"",
")",
";",
"}",
"}",
"}",
"protected",
"final",
"void",
"pauseApp",
"(",
")",
"{",
"}",
"protected",
"final",
"void",
"destroyApp",
"(",
"boolean",
"unconditional",
")",
"throws",
"MIDletStateChangeException",
"{",
"}",
"}",
"</s>"
] |
7,492 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"parsing",
".",
"ISensor",
";",
"public",
"class",
"GearTooth",
"extends",
"Counter",
"implements",
"ISensor",
"{",
"private",
"static",
"final",
"double",
"kGearToothThreshold",
"=",
"55e-6",
";",
"public",
"void",
"enableDirectionSensing",
"(",
"boolean",
"directionSensitive",
")",
"{",
"if",
"(",
"directionSensitive",
")",
"{",
"setPulseLengthMode",
"(",
"kGearToothThreshold",
")",
";",
"}",
"}",
"public",
"GearTooth",
"(",
"final",
"int",
"channel",
",",
"boolean",
"directionSensitive",
")",
"{",
"super",
"(",
"channel",
")",
";",
"enableDirectionSensing",
"(",
"directionSensitive",
")",
";",
"}",
"public",
"GearTooth",
"(",
"final",
"int",
"channel",
")",
"{",
"this",
"(",
"channel",
",",
"false",
")",
";",
"}",
"public",
"GearTooth",
"(",
"final",
"int",
"slot",
",",
"final",
"int",
"channel",
",",
"boolean",
"directionSensitive",
")",
"{",
"super",
"(",
"slot",
",",
"channel",
")",
";",
"enableDirectionSensing",
"(",
"directionSensitive",
")",
";",
"}",
"public",
"GearTooth",
"(",
"final",
"int",
"slot",
",",
"final",
"int",
"channel",
")",
"{",
"this",
"(",
"slot",
",",
"channel",
",",
"false",
")",
";",
"}",
"public",
"GearTooth",
"(",
"DigitalSource",
"source",
",",
"boolean",
"directionSensitive",
")",
"{",
"super",
"(",
"source",
")",
";",
"enableDirectionSensing",
"(",
"directionSensitive",
")",
";",
"}",
"public",
"GearTooth",
"(",
"DigitalSource",
"source",
")",
"{",
"this",
"(",
"source",
",",
"false",
")",
";",
"}",
"}",
"</s>"
] |
7,493 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"fpga",
".",
"tDIO",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"AllocationException",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"util",
".",
"CheckedAllocationException",
";",
"public",
"class",
"PWM",
"extends",
"SensorBase",
"{",
"private",
"static",
"Resource",
"allocated",
"=",
"new",
"Resource",
"(",
"(",
"tDIO",
".",
"kNumSystems",
"*",
"kPwmChannels",
")",
")",
";",
"public",
"static",
"class",
"PeriodMultiplier",
"{",
"public",
"final",
"int",
"value",
";",
"static",
"final",
"int",
"k1X_val",
"=",
"1",
";",
"static",
"final",
"int",
"k2X_val",
"=",
"2",
";",
"static",
"final",
"int",
"k4X_val",
"=",
"4",
";",
"public",
"static",
"final",
"PeriodMultiplier",
"k1X",
"=",
"new",
"PeriodMultiplier",
"(",
"k1X_val",
")",
";",
"public",
"static",
"final",
"PeriodMultiplier",
"k2X",
"=",
"new",
"PeriodMultiplier",
"(",
"k2X_val",
")",
";",
"public",
"static",
"final",
"PeriodMultiplier",
"k4X",
"=",
"new",
"PeriodMultiplier",
"(",
"k4X_val",
")",
";",
"private",
"PeriodMultiplier",
"(",
"int",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"}",
"}",
"private",
"int",
"m_channel",
";",
"private",
"DigitalModule",
"m_module",
";",
"protected",
"static",
"final",
"int",
"kDefaultPwmPeriod",
"=",
"774",
";",
"protected",
"static",
"final",
"int",
"kDefaultMinPwmHigh",
"=",
"102",
";",
"public",
"static",
"final",
"int",
"kPwmDisabled",
"=",
"0",
";",
"boolean",
"m_eliminateDeadband",
";",
"int",
"m_maxPwm",
";",
"int",
"m_deadbandMaxPwm",
";",
"int",
"m_centerPwm",
";",
"int",
"m_deadbandMinPwm",
";",
"int",
"m_minPwm",
";",
"private",
"void",
"initPWM",
"(",
"final",
"int",
"slot",
",",
"final",
"int",
"channel",
")",
"{",
"checkPWMModule",
"(",
"slot",
")",
";",
"checkPWMChannel",
"(",
"channel",
")",
";",
"try",
"{",
"allocated",
".",
"allocate",
"(",
"DigitalModule",
".",
"slotToIndex",
"(",
"slot",
")",
"*",
"kPwmChannels",
"+",
"channel",
"-",
"1",
")",
";",
"}",
"catch",
"(",
"CheckedAllocationException",
"e",
")",
"{",
"throw",
"new",
"AllocationException",
"(",
"\"PWM",
"channel",
"\"",
"+",
"channel",
"+",
"\"",
"on",
"module",
"\"",
"+",
"slot",
"+",
"\"\"",
")",
";",
"}",
"m_channel",
"=",
"channel",
";",
"m_module",
"=",
"DigitalModule",
".",
"getInstance",
"(",
"slot",
")",
";",
"m_module",
".",
"setPWM",
"(",
"m_channel",
",",
"kPwmDisabled",
")",
";",
"m_eliminateDeadband",
"=",
"false",
";",
"}",
"public",
"PWM",
"(",
"final",
"int",
"slot",
",",
"final",
"int",
"channel",
")",
"{",
"initPWM",
"(",
"slot",
",",
"channel",
")",
";",
"}",
"public",
"PWM",
"(",
"final",
"int",
"channel",
")",
"{",
"initPWM",
"(",
"getDefaultDigitalModule",
"(",
")",
",",
"channel",
")",
";",
"}",
"protected",
"void",
"free",
"(",
")",
"{",
"m_module",
".",
"setPWM",
"(",
"m_channel",
",",
"kPwmDisabled",
")",
";",
"allocated",
".",
"free",
"(",
"DigitalModule",
".",
"slotToIndex",
"(",
"m_module",
".",
"getSlot",
"(",
")",
")",
"*",
"kPwmChannels",
"+",
"m_channel",
"-",
"1",
")",
";",
"}",
"public",
"void",
"enableDeadbandElimination",
"(",
"boolean",
"eliminateDeadband",
")",
"{",
"m_eliminateDeadband",
"=",
"eliminateDeadband",
";",
"}",
"public",
"void",
"setBounds",
"(",
"final",
"int",
"max",
",",
"final",
"int",
"deadbandMax",
",",
"final",
"int",
"center",
",",
"final",
"int",
"deadbandMin",
",",
"final",
"int",
"min",
")",
"{",
"m_maxPwm",
"=",
"max",
";",
"m_deadbandMaxPwm",
"=",
"deadbandMax",
";",
"m_centerPwm",
"=",
"center",
";",
"m_deadbandMinPwm",
"=",
"deadbandMin",
";",
"m_minPwm",
"=",
"min",
";",
"}",
"public",
"void",
"setPosition",
"(",
"double",
"pos",
")",
"{",
"if",
"(",
"pos",
"<",
"0.0",
")",
"{",
"pos",
"=",
"0.0",
";",
"}",
"else",
"if",
"(",
"pos",
">",
"1.0",
")",
"{",
"pos",
"=",
"1.0",
";",
"}",
"int",
"rawValue",
";",
"rawValue",
"=",
"(",
"int",
")",
"(",
"(",
"pos",
"*",
"(",
"double",
")",
"getFullRangeScaleFactor",
"(",
")",
")",
"+",
"getMinNegativePwm",
"(",
")",
")",
";",
"setRaw",
"(",
"rawValue",
")",
";",
"}",
"public",
"double",
"getPosition",
"(",
")",
"{",
"int",
"value",
"=",
"getRaw",
"(",
")",
";",
"if",
"(",
"value",
"<",
"getMinNegativePwm",
"(",
")",
")",
"{",
"return",
"0.0",
";",
"}",
"else",
"if",
"(",
"value",
">",
"getMaxPositivePwm",
"(",
")",
")",
"{",
"return",
"1.0",
";",
"}",
"else",
"{",
"return",
"(",
"double",
")",
"(",
"value",
"-",
"getMinNegativePwm",
"(",
")",
")",
"/",
"(",
"double",
")",
"getFullRangeScaleFactor",
"(",
")",
";",
"}",
"}",
"final",
"void",
"setSpeed",
"(",
"double",
"speed",
")",
"{",
"if",
"(",
"speed",
"<",
"-",
"1.0",
")",
"{",
"speed",
"=",
"-",
"1.0",
";",
"}",
"else",
"if",
"(",
"speed",
">",
"1.0",
")",
"{",
"speed",
"=",
"1.0",
";",
"}",
"int",
"rawValue",
";",
"if",
"(",
"speed",
"==",
"0.0",
")",
"{",
"rawValue",
"=",
"getCenterPwm",
"(",
")",
";",
"}",
"else",
"if",
"(",
"speed",
">",
"0.0",
")",
"{",
"rawValue",
"=",
"(",
"int",
")",
"(",
"speed",
"*",
"(",
"(",
"double",
")",
"getPositiveScaleFactor",
"(",
")",
")",
"+",
"(",
"(",
"double",
")",
"getMinPositivePwm",
"(",
")",
")",
"+",
"0.5",
")",
";",
"}",
"else",
"{",
"rawValue",
"=",
"(",
"int",
")",
"(",
"speed",
"*",
"(",
"(",
"double",
")",
"getNegativeScaleFactor",
"(",
")",
")",
"+",
"(",
"(",
"double",
")",
"getMaxNegativePwm",
"(",
")",
")",
"+",
"0.5",
")",
";",
"}",
"setRaw",
"(",
"rawValue",
")",
";",
"}",
"public",
"double",
"getSpeed",
"(",
")",
"{",
"int",
"value",
"=",
"getRaw",
"(",
")",
";",
"if",
"(",
"value",
">",
"getMaxPositivePwm",
"(",
")",
")",
"{",
"return",
"1.0",
";",
"}",
"else",
"if",
"(",
"value",
"<",
"getMinNegativePwm",
"(",
")",
")",
"{",
"return",
"-",
"1.0",
";",
"}",
"else",
"if",
"(",
"value",
">",
"getMinPositivePwm",
"(",
")",
")",
"{",
"return",
"(",
"double",
")",
"(",
"value",
"-",
"getMinPositivePwm",
"(",
")",
")",
"/",
"(",
"double",
")",
"getPositiveScaleFactor",
"(",
")",
";",
"}",
"else",
"if",
"(",
"value",
"<",
"getMaxNegativePwm",
"(",
")",
")",
"{",
"return",
"(",
"double",
")",
"(",
"value",
"-",
"getMaxNegativePwm",
"(",
")",
")",
"/",
"(",
"double",
")",
"getNegativeScaleFactor",
"(",
")",
";",
"}",
"else",
"{",
"return",
"0.0",
";",
"}",
"}",
"public",
"void",
"setRaw",
"(",
"int",
"value",
")",
"{",
"m_module",
".",
"setPWM",
"(",
"m_channel",
",",
"value",
")",
";",
"}",
"public",
"int",
"getRaw",
"(",
")",
"{",
"return",
"m_module",
".",
"getPWM",
"(",
"m_channel",
")",
";",
"}",
"public",
"void",
"setPeriodMultiplier",
"(",
"PeriodMultiplier",
"mult",
")",
"{",
"switch",
"(",
"mult",
".",
"value",
")",
"{",
"case",
"PeriodMultiplier",
".",
"k4X_val",
":",
"m_module",
".",
"setPWMPeriodScale",
"(",
"m_channel",
",",
"3",
")",
";",
"break",
";",
"case",
"PeriodMultiplier",
".",
"k2X_val",
":",
"m_module",
".",
"setPWMPeriodScale",
"(",
"m_channel",
",",
"1",
")",
";",
"break",
";",
"case",
"PeriodMultiplier",
".",
"k1X_val",
":",
"m_module",
".",
"setPWMPeriodScale",
"(",
"m_channel",
",",
"0",
")",
";",
"break",
";",
"default",
":",
"}",
"}",
"private",
"int",
"getMaxPositivePwm",
"(",
")",
"{",
"return",
"m_maxPwm",
";",
"}",
";",
"private",
"int",
"getMinPositivePwm",
"(",
")",
"{",
"return",
"m_eliminateDeadband",
"?",
"m_deadbandMaxPwm",
":",
"m_centerPwm",
"+",
"1",
";",
"}",
";",
"private",
"int",
"getCenterPwm",
"(",
")",
"{",
"return",
"m_centerPwm",
";",
"}",
";",
"private",
"int",
"getMaxNegativePwm",
"(",
")",
"{",
"return",
"m_eliminateDeadband",
"?",
"m_deadbandMinPwm",
":",
"m_centerPwm",
"-",
"1",
";",
"}",
";",
"private",
"int",
"getMinNegativePwm",
"(",
")",
"{",
"return",
"m_minPwm",
";",
"}",
";",
"private",
"int",
"getPositiveScaleFactor",
"(",
")",
"{",
"return",
"getMaxPositivePwm",
"(",
")",
"-",
"getMinPositivePwm",
"(",
")",
";",
"}",
"private",
"int",
"getNegativeScaleFactor",
"(",
")",
"{",
"return",
"getMaxNegativePwm",
"(",
")",
"-",
"getMinNegativePwm",
"(",
")",
";",
"}",
"private",
"int",
"getFullRangeScaleFactor",
"(",
")",
"{",
"return",
"getMaxPositivePwm",
"(",
")",
"-",
"getMinNegativePwm",
"(",
")",
";",
"}",
"}",
"</s>"
] |
7,494 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"can",
";",
"public",
"class",
"CANInvalidBufferException",
"extends",
"RuntimeException",
"{",
"public",
"CANInvalidBufferException",
"(",
")",
"{",
"super",
"(",
")",
";",
"}",
"}",
"</s>"
] |
7,495 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"can",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"*",
";",
"import",
"com",
".",
"sun",
".",
"cldc",
".",
"jna",
".",
"ptr",
".",
"IntByReference",
";",
"import",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"communication",
".",
"Semaphore",
";",
"public",
"class",
"JaguarCANDriver",
"{",
"public",
"static",
"final",
"int",
"kMaxMessageDataSize",
"=",
"8",
";",
"private",
"static",
"final",
"TaskExecutor",
"taskExecutor",
"=",
"new",
"TaskExecutor",
"(",
"\"\"",
")",
";",
"private",
"static",
"final",
"Function",
"sendMessageFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"static",
"void",
"sendMessage",
"(",
"int",
"messageID",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"dataSize",
")",
"throws",
"CANTimeoutException",
"{",
"Pointer",
"sendDataBufferPointer",
"=",
"new",
"Pointer",
"(",
"kMaxMessageDataSize",
")",
";",
"sendDataBufferPointer",
".",
"setBytes",
"(",
"0",
",",
"data",
",",
"0",
",",
"dataSize",
")",
";",
"IntByReference",
"sendStatus",
"=",
"new",
"IntByReference",
"(",
"0",
")",
";",
"sendStatus",
".",
"setValue",
"(",
"0",
")",
";",
"sendMessageFn",
".",
"call4",
"(",
"messageID",
",",
"sendDataBufferPointer",
",",
"dataSize",
",",
"sendStatus",
".",
"getPointer",
"(",
")",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
")",
";",
"int",
"statusValue",
"=",
"sendStatus",
".",
"getValue",
"(",
")",
";",
"sendStatus",
".",
"free",
"(",
")",
";",
"sendDataBufferPointer",
".",
"free",
"(",
")",
";",
"CANExceptionFactory",
".",
"checkStatus",
"(",
"statusValue",
",",
"messageID",
")",
";",
"}",
"private",
"static",
"final",
"BlockingFunction",
"receiveMessageFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getBlockingFunction",
"(",
"\"\"",
")",
";",
"public",
"int",
"receivedMessageId",
";",
"static",
"{",
"receiveMessageFn",
".",
"setTaskExecutor",
"(",
"taskExecutor",
")",
";",
"}",
"public",
"byte",
"receiveMessage",
"(",
"int",
"messageID",
",",
"byte",
"[",
"]",
"data",
",",
"double",
"timeout",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"dataSize",
"=",
"0",
";",
"IntByReference",
"recvStatus",
"=",
"new",
"IntByReference",
"(",
"0",
")",
";",
"recvStatus",
".",
"setValue",
"(",
"0",
")",
";",
"Pointer",
"messageIdPtr",
"=",
"new",
"Pointer",
"(",
"4",
")",
";",
"messageIdPtr",
".",
"setInt",
"(",
"0",
",",
"messageID",
")",
";",
"Pointer",
"dataSizePtr",
"=",
"new",
"Pointer",
"(",
"1",
")",
";",
"dataSizePtr",
".",
"setByte",
"(",
"0",
",",
"(",
"byte",
")",
"0",
")",
";",
"Pointer",
"recvDataBufferPointer",
"=",
"new",
"Pointer",
"(",
"kMaxMessageDataSize",
")",
";",
"receiveMessageFn",
".",
"call5",
"(",
"messageIdPtr",
",",
"recvDataBufferPointer",
",",
"dataSizePtr",
",",
"(",
"int",
")",
"(",
"timeout",
"*",
"1000.0",
")",
",",
"recvStatus",
".",
"getPointer",
"(",
")",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
")",
";",
"int",
"statusValue",
"=",
"recvStatus",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"statusValue",
">=",
"0",
")",
"{",
"dataSize",
"=",
"dataSizePtr",
".",
"getByte",
"(",
"0",
")",
";",
"receivedMessageId",
"=",
"messageIdPtr",
".",
"getInt",
"(",
"0",
")",
";",
"recvDataBufferPointer",
".",
"getBytes",
"(",
"0",
",",
"data",
",",
"0",
",",
"data",
".",
"length",
"<",
"dataSize",
"?",
"data",
".",
"length",
":",
"dataSize",
")",
";",
"}",
"recvDataBufferPointer",
".",
"free",
"(",
")",
";",
"dataSizePtr",
".",
"free",
"(",
")",
";",
"messageIdPtr",
".",
"free",
"(",
")",
";",
"recvStatus",
".",
"free",
"(",
")",
";",
"CANExceptionFactory",
".",
"checkStatus",
"(",
"statusValue",
",",
"messageID",
")",
";",
"return",
"dataSize",
";",
"}",
"public",
"byte",
"receiveMessage",
"(",
"int",
"messageID",
",",
"byte",
"[",
"]",
"data",
")",
"throws",
"CANTimeoutException",
"{",
"return",
"receiveMessage",
"(",
"messageID",
",",
"data",
",",
"0.01",
")",
";",
"}",
"private",
"static",
"final",
"Function",
"receiveMessageStart_semFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"boolean",
"receiveMessageStart",
"(",
"int",
"messageID",
",",
"Semaphore",
"sem",
",",
"double",
"timeout",
")",
"throws",
"CANTimeoutException",
"{",
"int",
"retVal",
"=",
"0",
";",
"IntByReference",
"recvStatus",
"=",
"new",
"IntByReference",
"(",
"0",
")",
";",
"recvStatus",
".",
"setValue",
"(",
"0",
")",
";",
"retVal",
"=",
"receiveMessageStart_semFn",
".",
"call4",
"(",
"messageID",
",",
"sem",
".",
"getPointer",
"(",
")",
",",
"(",
"int",
")",
"(",
"timeout",
"*",
"1000.0",
")",
",",
"recvStatus",
".",
"getPointer",
"(",
")",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
")",
";",
"int",
"statusValue",
"=",
"recvStatus",
".",
"getValue",
"(",
")",
";",
"recvStatus",
".",
"free",
"(",
")",
";",
"CANExceptionFactory",
".",
"checkStatus",
"(",
"statusValue",
",",
"messageID",
")",
";",
"return",
"retVal",
"!=",
"0",
";",
"}",
"private",
"static",
"final",
"Function",
"receiveMessageCompleteFn",
"=",
"NativeLibrary",
".",
"getDefaultInstance",
"(",
")",
".",
"getFunction",
"(",
"\"\"",
")",
";",
"public",
"byte",
"receiveMessageComplete",
"(",
"int",
"messageID",
",",
"byte",
"[",
"]",
"data",
")",
"throws",
"CANTimeoutException",
"{",
"byte",
"dataSize",
"=",
"0",
";",
"IntByReference",
"recvStatus",
"=",
"new",
"IntByReference",
"(",
"0",
")",
";",
"recvStatus",
".",
"setValue",
"(",
"0",
")",
";",
"Pointer",
"messageIdPtr",
"=",
"new",
"Pointer",
"(",
"4",
")",
";",
"messageIdPtr",
".",
"setInt",
"(",
"0",
",",
"messageID",
")",
";",
"Pointer",
"dataSizePtr",
"=",
"new",
"Pointer",
"(",
"1",
")",
";",
"dataSizePtr",
".",
"setByte",
"(",
"0",
",",
"(",
"byte",
")",
"0",
")",
";",
"Pointer",
"recvDataBufferPointer",
"=",
"new",
"Pointer",
"(",
"kMaxMessageDataSize",
")",
";",
"receiveMessageCompleteFn",
".",
"call4",
"(",
"messageIdPtr",
",",
"recvDataBufferPointer",
",",
"dataSizePtr",
",",
"recvStatus",
".",
"getPointer",
"(",
")",
".",
"address",
"(",
")",
".",
"toUWord",
"(",
")",
".",
"toPrimitive",
"(",
")",
")",
";",
"int",
"statusValue",
"=",
"recvStatus",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"statusValue",
">=",
"0",
")",
"{",
"dataSize",
"=",
"dataSizePtr",
".",
"getByte",
"(",
"0",
")",
";",
"receivedMessageId",
"=",
"messageIdPtr",
".",
"getInt",
"(",
"0",
")",
";",
"recvDataBufferPointer",
".",
"getBytes",
"(",
"0",
",",
"data",
",",
"0",
",",
"data",
".",
"length",
"<",
"dataSize",
"?",
"data",
".",
"length",
":",
"dataSize",
")",
";",
"}",
"recvDataBufferPointer",
".",
"free",
"(",
")",
";",
"dataSizePtr",
".",
"free",
"(",
")",
";",
"messageIdPtr",
".",
"free",
"(",
")",
";",
"recvStatus",
".",
"free",
"(",
")",
";",
"CANExceptionFactory",
".",
"checkStatus",
"(",
"statusValue",
",",
"messageID",
")",
";",
"return",
"dataSize",
";",
"}",
"}",
"</s>"
] |
7,496 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"can",
";",
"public",
"class",
"CANJaguarVersionException",
"extends",
"RuntimeException",
"{",
"public",
"static",
"final",
"int",
"kMinLegalFIRSTFirmwareVersion",
"=",
"92",
";",
"public",
"static",
"final",
"int",
"kMinRDKFirmwareVersion",
"=",
"3330",
";",
"public",
"CANJaguarVersionException",
"(",
"int",
"deviceNumber",
",",
"int",
"fwVersion",
")",
"{",
"super",
"(",
"getString",
"(",
"deviceNumber",
",",
"fwVersion",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"fwVersion[\"",
"+",
"deviceNumber",
"+",
"\"]:",
"\"",
"+",
"fwVersion",
")",
";",
"}",
"static",
"String",
"getString",
"(",
"int",
"deviceNumber",
",",
"int",
"fwVersion",
")",
"{",
"String",
"msg",
";",
"if",
"(",
"fwVersion",
"<",
"kMinRDKFirmwareVersion",
")",
"{",
"msg",
"=",
"\"Jaguar",
"\"",
"+",
"deviceNumber",
"+",
"\"\"",
"+",
"Integer",
".",
"toString",
"(",
"kMinLegalFIRSTFirmwareVersion",
")",
"+",
"\"\"",
";",
"}",
"else",
"{",
"msg",
"=",
"\"Jaguar",
"\"",
"+",
"deviceNumber",
"+",
"\"\"",
"+",
"Integer",
".",
"toString",
"(",
"kMinLegalFIRSTFirmwareVersion",
")",
"+",
"\"\"",
";",
"}",
"return",
"msg",
";",
"}",
"}",
"</s>"
] |
7,497 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"can",
";",
"public",
"class",
"CANNotInitializedException",
"extends",
"RuntimeException",
"{",
"public",
"CANNotInitializedException",
"(",
")",
"{",
"super",
"(",
")",
";",
"}",
"}",
"</s>"
] |
7,498 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"can",
";",
"public",
"class",
"JaguarCANProtocol",
"{",
"public",
"static",
"final",
"int",
"CAN_MSGID_FULL_M",
"=",
"0x1fffffff",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_DEVNO_M",
"=",
"0x0000003f",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_API_M",
"=",
"0x0000ffc0",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_MFR_M",
"=",
"0x00ff0000",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_DTYPE_M",
"=",
"0x1f000000",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_DEVNO_S",
"=",
"0",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_API_S",
"=",
"6",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_MFR_S",
"=",
"16",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_DTYPE_S",
"=",
"24",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_DEVNO_BCAST",
"=",
"0x00000000",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_API_SYSHALT",
"=",
"0x00000000",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_API_SYSRST",
"=",
"0x00000040",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_API_DEVASSIGN",
"=",
"0x00000080",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_API_DEVQUERY",
"=",
"0x000000c0",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_API_HEARTBEAT",
"=",
"0x00000140",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_API_SYNC",
"=",
"0x00000180",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_API_UPDATE",
"=",
"0x000001c0",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_API_FIRMVER",
"=",
"0x00000200",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_API_ENUMERATE",
"=",
"0x00000240",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_API_SYSRESUME",
"=",
"0x00000280",
";",
"public",
"static",
"final",
"int",
"CAN_STATUS_CODE_M",
"=",
"0x0000ffff",
";",
"public",
"static",
"final",
"int",
"CAN_STATUS_MFG_M",
"=",
"0x00ff0000",
";",
"public",
"static",
"final",
"int",
"CAN_STATUS_DTYPE_M",
"=",
"0x1f000000",
";",
"public",
"static",
"final",
"int",
"CAN_STATUS_CODE_S",
"=",
"0",
";",
"public",
"static",
"final",
"int",
"CAN_STATUS_MFG_S",
"=",
"16",
";",
"public",
"static",
"final",
"int",
"CAN_STATUS_DTYPE_S",
"=",
"24",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_MFR_NI",
"=",
"0x00010000",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_MFR_LM",
"=",
"0x00020000",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_MFR_DEKA",
"=",
"0x00030000",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_DTYPE_BCAST",
"=",
"0x00000000",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_DTYPE_ROBOT",
"=",
"0x01000000",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_DTYPE_MOTOR",
"=",
"0x02000000",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_DTYPE_RELAY",
"=",
"0x03000000",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_DTYPE_GYRO",
"=",
"0x04000000",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_DTYPE_ACCEL",
"=",
"0x05000000",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_DTYPE_USONIC",
"=",
"0x06000000",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_DTYPE_GEART",
"=",
"0x07000000",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_DTYPE_UPDATE",
"=",
"0x1f000000",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_API_CLASS_M",
"=",
"0x0000fc00",
";",
"public",
"static",
"final",
"int",
"CAN_MSGID_API_ID_M",
"=",
"0x000003c0",
";",
"public",
"static",
"final",
"int",
"CAN_API_MC_VOLTAGE",
"=",
"0x00000000",
";",
"public",
"static",
"final",
"int",
"CAN_API_MC_SPD",
"=",
"0x00000400",
";",
"public",
"static",
"final",
"int",
"CAN_API_MC_VCOMP",
"=",
"0x00000800",
";",
"public",
"static",
"final",
"int",
"CAN_API_MC_POS",
"=",
"0x00000c00",
";",
"public",
"static",
"final",
"int",
"CAN_API_MC_ICTRL",
"=",
"0x00001000",
";",
"public",
"static",
"final",
"int",
"CAN_API_MC_STATUS",
"=",
"0x00001400",
";",
"public",
"static",
"final",
"int",
"CAN_API_MC_CFG",
"=",
"0x00001c00",
";",
"public",
"static",
"final",
"int",
"CAN_API_MC_ACK",
"=",
"0x00002000",
";",
"public",
"static",
"final",
"int",
"LM_API_VOLT",
"=",
"(",
"CAN_MSGID_MFR_LM",
"|",
"CAN_MSGID_DTYPE_MOTOR",
"|",
"CAN_API_MC_VOLTAGE",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_VOLT_EN",
"=",
"(",
"LM_API_VOLT",
"|",
"(",
"0",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_VOLT_DIS",
"=",
"(",
"LM_API_VOLT",
"|",
"(",
"1",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_VOLT_SET",
"=",
"(",
"LM_API_VOLT",
"|",
"(",
"2",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_VOLT_SET_RAMP",
"=",
"(",
"LM_API_VOLT",
"|",
"(",
"3",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_VOLT_T_EN",
"=",
"(",
"LM_API_VOLT",
"|",
"(",
"4",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_VOLT_T_SET",
"=",
"(",
"LM_API_VOLT",
"|",
"(",
"5",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_VOLT_RAMP_DIS",
"=",
"0",
";",
"public",
"static",
"final",
"int",
"LM_API_SYNC_PEND_NOW",
"=",
"0",
";",
"public",
"static",
"final",
"int",
"LM_API_SPD",
"=",
"(",
"CAN_MSGID_MFR_LM",
"|",
"CAN_MSGID_DTYPE_MOTOR",
"|",
"CAN_API_MC_SPD",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_SPD_EN",
"=",
"(",
"LM_API_SPD",
"|",
"(",
"0",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_SPD_DIS",
"=",
"(",
"LM_API_SPD",
"|",
"(",
"1",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_SPD_SET",
"=",
"(",
"LM_API_SPD",
"|",
"(",
"2",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_SPD_PC",
"=",
"(",
"LM_API_SPD",
"|",
"(",
"3",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_SPD_IC",
"=",
"(",
"LM_API_SPD",
"|",
"(",
"4",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_SPD_DC",
"=",
"(",
"LM_API_SPD",
"|",
"(",
"5",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_SPD_REF",
"=",
"(",
"LM_API_SPD",
"|",
"(",
"6",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_SPD_T_EN",
"=",
"(",
"LM_API_SPD",
"|",
"(",
"7",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_SPD_T_SET",
"=",
"(",
"LM_API_SPD",
"|",
"(",
"8",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_VCOMP",
"=",
"(",
"CAN_MSGID_MFR_LM",
"|",
"CAN_MSGID_DTYPE_MOTOR",
"|",
"CAN_API_MC_VCOMP",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_VCOMP_EN",
"=",
"(",
"LM_API_VCOMP",
"|",
"(",
"0",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_VCOMP_DIS",
"=",
"(",
"LM_API_VCOMP",
"|",
"(",
"1",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_VCOMP_SET",
"=",
"(",
"LM_API_VCOMP",
"|",
"(",
"2",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_VCOMP_IN_RAMP",
"=",
"(",
"LM_API_VCOMP",
"|",
"(",
"3",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_VCOMP_COMP_RAMP",
"=",
"(",
"LM_API_VCOMP",
"|",
"(",
"4",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_VCOMP_T_EN",
"=",
"(",
"LM_API_VCOMP",
"|",
"(",
"5",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_VCOMP_T_SET",
"=",
"(",
"LM_API_VCOMP",
"|",
"(",
"6",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_POS",
"=",
"(",
"CAN_MSGID_MFR_LM",
"|",
"CAN_MSGID_DTYPE_MOTOR",
"|",
"CAN_API_MC_POS",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_POS_EN",
"=",
"(",
"LM_API_POS",
"|",
"(",
"0",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_POS_DIS",
"=",
"(",
"LM_API_POS",
"|",
"(",
"1",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_POS_SET",
"=",
"(",
"LM_API_POS",
"|",
"(",
"2",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_POS_PC",
"=",
"(",
"LM_API_POS",
"|",
"(",
"3",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_POS_IC",
"=",
"(",
"LM_API_POS",
"|",
"(",
"4",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_POS_DC",
"=",
"(",
"LM_API_POS",
"|",
"(",
"5",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_POS_REF",
"=",
"(",
"LM_API_POS",
"|",
"(",
"6",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_POS_T_EN",
"=",
"(",
"LM_API_POS",
"|",
"(",
"7",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_POS_T_SET",
"=",
"(",
"LM_API_POS",
"|",
"(",
"8",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_ICTRL",
"=",
"(",
"CAN_MSGID_MFR_LM",
"|",
"CAN_MSGID_DTYPE_MOTOR",
"|",
"CAN_API_MC_ICTRL",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_ICTRL_EN",
"=",
"(",
"LM_API_ICTRL",
"|",
"(",
"0",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_ICTRL_DIS",
"=",
"(",
"LM_API_ICTRL",
"|",
"(",
"1",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_ICTRL_SET",
"=",
"(",
"LM_API_ICTRL",
"|",
"(",
"2",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_ICTRL_PC",
"=",
"(",
"LM_API_ICTRL",
"|",
"(",
"3",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_ICTRL_IC",
"=",
"(",
"LM_API_ICTRL",
"|",
"(",
"4",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_ICTRL_DC",
"=",
"(",
"LM_API_ICTRL",
"|",
"(",
"5",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_ICTRL_T_EN",
"=",
"(",
"LM_API_ICTRL",
"|",
"(",
"6",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_ICTRL_T_SET",
"=",
"(",
"LM_API_ICTRL",
"|",
"(",
"7",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_UPD",
"=",
"(",
"CAN_MSGID_MFR_LM",
"|",
"CAN_MSGID_DTYPE_UPDATE",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_UPD_PING",
"=",
"(",
"LM_API_UPD",
"|",
"(",
"0",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_UPD_DOWNLOAD",
"=",
"(",
"LM_API_UPD",
"|",
"(",
"1",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_UPD_SEND_DATA",
"=",
"(",
"LM_API_UPD",
"|",
"(",
"2",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_UPD_RESET",
"=",
"(",
"LM_API_UPD",
"|",
"(",
"3",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_UPD_ACK",
"=",
"(",
"LM_API_UPD",
"|",
"(",
"4",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_HWVER",
"=",
"(",
"LM_API_UPD",
"|",
"(",
"5",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_UPD_REQUEST",
"=",
"(",
"LM_API_UPD",
"|",
"(",
"6",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_UNTRUST_EN",
"=",
"(",
"LM_API_UPD",
"|",
"(",
"11",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_TRUST_EN",
"=",
"(",
"LM_API_UPD",
"|",
"(",
"12",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_TRUST_HEARTBEAT",
"=",
"(",
"LM_API_UPD",
"|",
"(",
"13",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_STATUS",
"=",
"(",
"CAN_MSGID_MFR_LM",
"|",
"CAN_MSGID_DTYPE_MOTOR",
"|",
"CAN_API_MC_STATUS",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_STATUS_VOLTOUT",
"=",
"(",
"LM_API_STATUS",
"|",
"(",
"0",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_STATUS_VOLTBUS",
"=",
"(",
"LM_API_STATUS",
"|",
"(",
"1",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_STATUS_CURRENT",
"=",
"(",
"LM_API_STATUS",
"|",
"(",
"2",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_STATUS_TEMP",
"=",
"(",
"LM_API_STATUS",
"|",
"(",
"3",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_STATUS_POS",
"=",
"(",
"LM_API_STATUS",
"|",
"(",
"4",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_STATUS_SPD",
"=",
"(",
"LM_API_STATUS",
"|",
"(",
"5",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_STATUS_LIMIT",
"=",
"(",
"LM_API_STATUS",
"|",
"(",
"6",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_STATUS_FAULT",
"=",
"(",
"LM_API_STATUS",
"|",
"(",
"7",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_STATUS_POWER",
"=",
"(",
"LM_API_STATUS",
"|",
"(",
"8",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_STATUS_CMODE",
"=",
"(",
"LM_API_STATUS",
"|",
"(",
"9",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_STATUS_VOUT",
"=",
"(",
"LM_API_STATUS",
"|",
"(",
"10",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_STATUS_LIMIT_FWD",
"=",
"0x01",
";",
"public",
"static",
"final",
"int",
"LM_STATUS_LIMIT_REV",
"=",
"0x02",
";",
"public",
"static",
"final",
"int",
"LM_STATUS_FAULT_ILIMIT",
"=",
"0x01",
";",
"public",
"static",
"final",
"int",
"LM_STATUS_FAULT_TLIMIT",
"=",
"0x02",
";",
"public",
"static",
"final",
"int",
"LM_STATUS_FAULT_VLIMIT",
"=",
"0x04",
";",
"public",
"static",
"final",
"int",
"LM_API_CFG",
"=",
"(",
"CAN_MSGID_MFR_LM",
"|",
"CAN_MSGID_DTYPE_MOTOR",
"|",
"CAN_API_MC_CFG",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_CFG_NUM_BRUSHES",
"=",
"(",
"LM_API_CFG",
"|",
"(",
"0",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_CFG_ENC_LINES",
"=",
"(",
"LM_API_CFG",
"|",
"(",
"1",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_CFG_POT_TURNS",
"=",
"(",
"LM_API_CFG",
"|",
"(",
"2",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_CFG_BRAKE_COAST",
"=",
"(",
"LM_API_CFG",
"|",
"(",
"3",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_CFG_LIMIT_MODE",
"=",
"(",
"LM_API_CFG",
"|",
"(",
"4",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_CFG_LIMIT_FWD",
"=",
"(",
"LM_API_CFG",
"|",
"(",
"5",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_CFG_LIMIT_REV",
"=",
"(",
"LM_API_CFG",
"|",
"(",
"6",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_CFG_MAX_VOUT",
"=",
"(",
"LM_API_CFG",
"|",
"(",
"7",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_CFG_FAULT_TIME",
"=",
"(",
"LM_API_CFG",
"|",
"(",
"8",
"<<",
"CAN_MSGID_API_S",
")",
")",
";",
"public",
"static",
"final",
"int",
"LM_API_ACK",
"=",
"(",
"CAN_MSGID_MFR_LM",
"|",
"CAN_MSGID_DTYPE_MOTOR",
"|",
"CAN_API_MC_ACK",
")",
";",
"public",
"static",
"final",
"int",
"LM_HWVER_UNKNOWN",
"=",
"0x00",
";",
"public",
"static",
"final",
"int",
"LM_HWVER_JAG_1_0",
"=",
"0x01",
";",
"public",
"static",
"final",
"int",
"LM_HWVER_JAG_2_0",
"=",
"0x02",
";",
"public",
"static",
"final",
"int",
"LM_STATUS_CMODE_VOLT",
"=",
"0x00",
";",
"public",
"static",
"final",
"int",
"LM_STATUS_CMODE_CURRENT",
"=",
"0x01",
";",
"public",
"static",
"final",
"int",
"LM_STATUS_CMODE_SPEED",
"=",
"0x02",
";",
"public",
"static",
"final",
"int",
"LM_STATUS_CMODE_POS",
"=",
"0x03",
";",
"public",
"static",
"final",
"int",
"LM_STATUS_CMODE_VCOMP",
"=",
"0x04",
";",
"public",
"static",
"final",
"int",
"LM_REF_ENCODER",
"=",
"0x00",
";",
"public",
"static",
"final",
"int",
"LM_REF_POT",
"=",
"0x01",
";",
"public",
"static",
"final",
"int",
"LM_REF_INV_ENCODER",
"=",
"0x02",
";",
"public",
"static",
"final",
"int",
"LM_REF_QUAD_ENCODER",
"=",
"0x03",
";",
"public",
"static",
"final",
"int",
"LM_REF_NONE",
"=",
"0xff",
";",
"public",
"static",
"final",
"int",
"LM_FAULT_CURRENT",
"=",
"0x01",
";",
"public",
"static",
"final",
"int",
"LM_FAULT_TEMP",
"=",
"0x02",
";",
"public",
"static",
"final",
"int",
"LM_FAULT_VBUS",
"=",
"0x04",
";",
"public",
"static",
"final",
"int",
"LM_FAULT_GATE_DRIVE",
"=",
"0x08",
";",
"}",
"</s>"
] |
7,499 | [
"<s>",
"package",
"edu",
".",
"wpi",
".",
"first",
".",
"wpilibj",
".",
"can",
";",
"public",
"class",
"CANMessageNotAllowedException",
"extends",
"RuntimeException",
"{",
"public",
"CANMessageNotAllowedException",
"(",
"String",
"msg",
")",
"{",
"super",
"(",
"msg",
")",
";",
"}",
"}",
"</s>"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.