- Add AFBR module as a HAL.
- Platform layer to support running AFBR API using Zephyr.
- Ability to instantiate on device-tree.
- Samples in the module proving foundations works.
- Zephyr Sensor API support, by introducing:
- Read/Decode for SENSOR_CHAN_DISTANCE (1-D results).
- Streaming mode for DATA_READY (1-D results).
Signed-off-by: Luis Ubieda <luisf@croxel.com>
29 lines
499 B
C
29 lines
499 B
C
/*
|
|
* Copyright (c) 2025 Croxel Inc.
|
|
* Copyright (c) 2025 CogniPilot Foundation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <zephyr/irq.h>
|
|
|
|
#include <platform/argus_irq.h>
|
|
|
|
/* We have an atomic lock count in order to only lock once and store the lock key. */
|
|
static atomic_val_t lock_count;
|
|
static uint32_t lock;
|
|
|
|
void IRQ_UNLOCK(void)
|
|
{
|
|
if (atomic_dec(&lock_count) == 1) {
|
|
irq_unlock(lock);
|
|
}
|
|
}
|
|
|
|
void IRQ_LOCK(void)
|
|
{
|
|
if (atomic_inc(&lock_count) == 0) {
|
|
lock = irq_lock();
|
|
}
|
|
}
|