Add ability to associate other devices with a SimDevice

Implemented only for AnalogInput, DIO, and Encoder.
This commit is contained in:
Peter Johnson
2019-10-04 22:56:24 -07:00
parent 81c2c8a7de
commit aa90645865
36 changed files with 222 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-2019 FIRST. 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. */
@@ -55,6 +55,15 @@ HAL_Bool HAL_CheckAnalogModule(int32_t module);
*/
HAL_Bool HAL_CheckAnalogInputChannel(int32_t channel);
/**
* Indicates the analog input is used by a simulated device.
*
* @param handle the analog input handle
* @param device simulated device handle
*/
void HAL_SetAnalogInputSimDevice(HAL_AnalogInputHandle handle,
HAL_SimDeviceHandle device);
/**
* Sets the sample rate.
*

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-2019 FIRST. 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. */
@@ -41,6 +41,14 @@ HAL_Bool HAL_CheckDIOChannel(int32_t channel);
void HAL_FreeDIOPort(HAL_DigitalHandle dioPortHandle);
/**
* Indicates the DIO channel is used by a simulated device.
*
* @param handle the DIO channel handle
* @param device simulated device handle
*/
void HAL_SetDIOSimDevice(HAL_DigitalHandle handle, HAL_SimDeviceHandle device);
/**
* Allocates a DO PWM Generator.
*

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-2019 FIRST. 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. */
@@ -72,6 +72,15 @@ HAL_EncoderHandle HAL_InitializeEncoder(
*/
void HAL_FreeEncoder(HAL_EncoderHandle encoderHandle, int32_t* status);
/**
* Indicates the encoder is used by a simulated device.
*
* @param handle the encoder handle
* @param device simulated device handle
*/
void HAL_SetEncoderSimDevice(HAL_EncoderHandle handle,
HAL_SimDeviceHandle device);
/**
* Gets the current counts of the encoder after encoding type scaling.
*

View File

@@ -23,6 +23,8 @@ void HALSIM_CancelAnalogInInitializedCallback(int32_t index, int32_t uid);
HAL_Bool HALSIM_GetAnalogInInitialized(int32_t index);
void HALSIM_SetAnalogInInitialized(int32_t index, HAL_Bool initialized);
HAL_SimDeviceHandle HALSIM_GetAnalogInSimDevice(int32_t index);
int32_t HALSIM_RegisterAnalogInAverageBitsCallback(int32_t index,
HAL_NotifyCallback callback,
void* param,

View File

@@ -23,6 +23,8 @@ void HALSIM_CancelDIOInitializedCallback(int32_t index, int32_t uid);
HAL_Bool HALSIM_GetDIOInitialized(int32_t index);
void HALSIM_SetDIOInitialized(int32_t index, HAL_Bool initialized);
HAL_SimDeviceHandle HALSIM_GetDIOSimDevice(int32_t index);
int32_t HALSIM_RegisterDIOValueCallback(int32_t index,
HAL_NotifyCallback callback,
void* param, HAL_Bool initialNotify);

View File

@@ -24,6 +24,8 @@ void HALSIM_CancelEncoderInitializedCallback(int32_t index, int32_t uid);
HAL_Bool HALSIM_GetEncoderInitialized(int32_t index);
void HALSIM_SetEncoderInitialized(int32_t index, HAL_Bool initialized);
HAL_SimDeviceHandle HALSIM_GetEncoderSimDevice(int32_t index);
int32_t HALSIM_RegisterEncoderCountCallback(int32_t index,
HAL_NotifyCallback callback,
void* param,