---vl6180dr

This commit is contained in:
Mysteo91
2023-07-31 15:57:16 +03:00
parent cef4988b6d
commit bbe0faf31d
5 changed files with 111 additions and 27 deletions

View File

@@ -8,7 +8,7 @@
#include "main.h"
#include "i2c.h"
#define max_scale 3
#define max_scale 1
uint8_t changeScale = 0;
#define ALLOW_DISABLE_WAF_FROM_BLUE_BUTTON 1
#define theVL6180Dev 0x52 // what we use as "API device
@@ -228,15 +228,31 @@ void RangeState(void) {
}
}
uint32_t resetPressedMs = 0;
uint8_t motionDetected = 0;
__weak void proximityMessureCompleted (void)
{
}
uint8_t getRange (VL6180_RangeData_t* range)
{
if (Range.errorStatus == 0)
{
*range = Range;
return 0;
}
else
{
range->range_mm = -1;
return 1;
}
}
void HAL_GPIO_EXTI_Rising_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == GPIO_PIN_0 && allowIT == 1)
{
RangeState();
if (Range.errorStatus == 0)
{
__NOP();
}
proximityMessureCompleted();
VL6180_ClearAllInterrupt(theVL6180Dev);
}
else if (GPIO_Pin == GPIO_PIN_1)