Add AddressableLED simulation support

This commit is contained in:
Peter Johnson
2019-11-17 15:05:56 -08:00
parent 8ed2059074
commit a4c9e4ec28
16 changed files with 750 additions and 10 deletions

View File

@@ -9,6 +9,8 @@
#include <stdint.h>
#define HAL_kAddressableLEDMaxLength 5460
struct HAL_AddressableLEDData {
uint8_t b;
uint8_t g;

View File

@@ -151,6 +151,13 @@ int32_t HAL_GetNumPDPChannels(void);
* @return the number of Duty Cycle inputs
*/
int32_t HAL_GetNumDutyCycles(void);
/**
* Gets the number of addressable LED generators in the current system.
*
* @return the number of Addressable LED generators
*/
int32_t HAL_GetNumAddressableLEDs(void);
#ifdef __cplusplus
} // extern "C"
#endif

View File

@@ -0,0 +1,65 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 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. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "NotifyListener.h"
#include "hal/AddressableLEDTypes.h"
#include "hal/Types.h"
#ifdef __cplusplus
extern "C" {
#endif
void HALSIM_ResetAddressableLEDData(int32_t index);
int32_t HALSIM_RegisterAddressableLEDInitializedCallback(
int32_t index, HAL_NotifyCallback callback, void* param,
HAL_Bool initialNotify);
void HALSIM_CancelAddressableLEDInitializedCallback(int32_t index, int32_t uid);
HAL_Bool HALSIM_GetAddressableLEDInitialized(int32_t index);
void HALSIM_SetAddressableLEDInitialized(int32_t index, HAL_Bool initialized);
int32_t HALSIM_RegisterAddressableLEDOutputPortCallback(
int32_t index, HAL_NotifyCallback callback, void* param,
HAL_Bool initialNotify);
void HALSIM_CancelAddressableLEDOutputPortCallback(int32_t index, int32_t uid);
int32_t HALSIM_GetAddressableLEDOutputPort(int32_t index);
void HALSIM_SetAddressableLEDOutputPort(int32_t index, int32_t outputPort);
int32_t HALSIM_RegisterAddressableLEDLengthCallback(int32_t index,
HAL_NotifyCallback callback,
void* param,
HAL_Bool initialNotify);
void HALSIM_CancelAddressableLEDLengthCallback(int32_t index, int32_t uid);
int32_t HALSIM_GetAddressableLEDLength(int32_t index);
void HALSIM_SetAddressableLEDLength(int32_t index, int32_t length);
int32_t HALSIM_RegisterAddressableLEDRunningCallback(
int32_t index, HAL_NotifyCallback callback, void* param,
HAL_Bool initialNotify);
void HALSIM_CancelAddressableLEDRunningCallback(int32_t index, int32_t uid);
HAL_Bool HALSIM_GetAddressableLEDRunning(int32_t index);
void HALSIM_SetAddressableLEDRunning(int32_t index, HAL_Bool running);
int32_t HALSIM_RegisterAddressableLEDDataCallback(
int32_t index, HAL_ConstBufferCallback callback, void* param);
void HALSIM_CancelAddressableLEDDataCallback(int32_t index, int32_t uid);
int32_t HALSIM_GetAddressableLEDData(int32_t index,
struct HAL_AddressableLEDData* data);
void HALSIM_SetAddressableLEDData(int32_t index,
const struct HAL_AddressableLEDData* data,
int32_t length);
void HALSIM_RegisterAddressableLEDAllCallbacks(int32_t index,
HAL_NotifyCallback callback,
void* param,
HAL_Bool initialNotify);
#ifdef __cplusplus
} // extern "C"
#endif