This commit is contained in:
Mysteo91
2023-08-11 16:04:03 +03:00
parent e40a82a218
commit c6211b1db1
7 changed files with 134 additions and 30 deletions

View File

@@ -71,10 +71,8 @@ uint16_t range; /* range average distance */
#define AlarmKeepDispTime 250 /* alarm message retain time after it fires */
volatile int IntrFired=0;
extern volatile uint32_t SensorsEnabled;
uint8_t inited = 0;
void AbortErr( const char * msg ){
State.mode= WaitForReset;
}
@@ -87,12 +85,17 @@ void DoScalingSwap(int scaling){
uint8_t allowIT = 0;
void vl6180_init (void)
{
allowIT = 0;
HAL_GPIO_WritePin(CS_PROXIMITY_GPIO_Port, CS_PROXIMITY_Pin, GPIO_PIN_RESET);
HAL_Delay(200);
HAL_GPIO_WritePin(CS_PROXIMITY_GPIO_Port, CS_PROXIMITY_Pin, GPIO_PIN_SET);
HAL_Delay(200);
VL6180_WaitDeviceBooted(theVL6180Dev);
if (VL6180_WaitDeviceBooted(theVL6180Dev) )
{
return;
}
inited = 1;
VL6180_InitData(theVL6180Dev);
State.InitScale=VL6180_UpscaleGetScaling(theVL6180Dev);
State.FilterEn=VL6180_FilterGetState(theVL6180Dev);
@@ -286,5 +289,7 @@ uint8_t vl6180_single_shot ()
int32_t vl6180_is_ready ()
{
if (inited < 0)
return -1;
return VL6180_RangeWaitDeviceReady(theVL6180Dev, 3);
}