Make the HAL self initialize when ever any initialization function is called (#1012)

This commit is contained in:
Thad House
2018-05-13 22:02:47 -07:00
committed by Peter Johnson
parent 59a8e9da57
commit e21a246a4d
50 changed files with 149 additions and 2 deletions

View File

@@ -11,6 +11,7 @@
#include "DigitalInternal.h"
#include "HAL/HAL.h"
#include "HAL/handles/LimitedHandleResource.h"
#include "HALInitializer.h"
#include "PortsInternal.h"
using namespace hal;
@@ -42,6 +43,7 @@ extern "C" {
HAL_CounterHandle HAL_InitializeCounter(HAL_Counter_Mode mode, int32_t* index,
int32_t* status) {
hal::init::CheckInit();
auto handle = counterHandles->Allocate();
if (handle == HAL_kInvalidHandle) { // out of resources
*status = NO_AVAILABLE_RESOURCES;