Update to 2018_v4 image and new build system. (#598)

* Revert "Force OpenCV to 3.1.0 (#602)"

This reverts commit 50ed55e8e2.

* Removes Simulation

* Removes old build system

* Removes old gtest

* Adds new gmock and gtest

* Updates to new ni-libraries

* removes MyRobot (to be replaced)

* moves files to new location

* Adds new sim backend and new test executables

* updates .styleguide and .gitignore

* Changes cpp WPILibVersion to a function

MSVC throws an AV with the old version.

* Disables USBCamera on all systems except for linux

* 2018 NI Libraries

* New build system
This commit is contained in:
Thad House
2017-08-18 21:35:53 -07:00
committed by Peter Johnson
parent 50ed55e8e2
commit e1195e8b9d
1024 changed files with 64481 additions and 61340 deletions

View File

@@ -0,0 +1,81 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#include "DigitalInternal.h"
#include "ConstantsInternal.h"
#include "HAL/AnalogTrigger.h"
#include "HAL/HAL.h"
#include "HAL/Ports.h"
#include "HAL/cpp/priority_mutex.h"
#include "PortsInternal.h"
namespace hal {
bool digitalSystemsInitialized = false;
DigitalHandleResource<HAL_DigitalHandle, DigitalPort,
kNumDigitalChannels + kNumPWMHeaders>
digitalChannelHandles;
/**
* Map DIO channel numbers from their physical number (10 to 26) to their
* position in the bit field.
*/
int32_t remapMXPChannel(int32_t channel) { return channel - 10; }
int32_t remapMXPPWMChannel(int32_t channel) {
if (channel < 14) {
return channel - 10; // first block of 4 pwms (MXP 0-3)
} else {
return channel - 6; // block of PWMs after SPI
}
}
/**
* remap the digital source channel and set the module.
* If it's an analog trigger, determine the module from the high order routing
* channel else do normal digital input remapping based on channel number
* (MXP)
*/
bool remapDigitalSource(HAL_Handle digitalSourceHandle,
HAL_AnalogTriggerType analogTriggerType,
uint8_t& channel, uint8_t& module,
bool& analogTrigger) {
if (isHandleType(digitalSourceHandle, HAL_HandleEnum::AnalogTrigger)) {
// If handle passed, index is not negative
int32_t index = getHandleIndex(digitalSourceHandle);
channel = (index << 2) + analogTriggerType;
module = channel >> 4;
analogTrigger = true;
return true;
} else if (isHandleType(digitalSourceHandle, HAL_HandleEnum::DIO)) {
int32_t index = getHandleIndex(digitalSourceHandle);
if (index >= kNumDigitalHeaders) {
channel = remapMXPChannel(index);
module = 1;
} else {
channel = index;
module = 0;
}
analogTrigger = false;
return true;
} else {
return false;
}
}
int32_t GetDigitalInputChannel(HAL_DigitalHandle handle, int32_t* status) {
auto digital = digitalChannelHandles.Get(handle, HAL_HandleEnum::DIO);
if (digital == nullptr) {
*status = HAL_HANDLE_ERROR;
return -1;
}
return digital->channel;
}
} // namespace hal