Furi: core refactoring and CMSIS removal part 2 (#1410)
* Furi: rename and move core * Furi: drop CMSIS_OS header and unused api, partially refactor and cleanup the rest * Furi: CMSIS_OS drop and refactoring. * Furi: refactoring, remove cmsis legacy * Furi: fix incorrect assert on queue deallocation, cleanup timer * Furi: improve delay api, get rid of floats * hal: dropped furi_hal_crc * Furi: move DWT based delay to cortex HAL * Furi: update core documentation Co-authored-by: hedger <hedger@nanode.su>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,302 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2020 Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ----------------------------------------------------------------------
|
||||
*
|
||||
* $Date: 12. June 2020
|
||||
* $Revision: V2.1.3
|
||||
*
|
||||
* Project: CMSIS-RTOS2 API
|
||||
* Title: cmsis_os2.h header file
|
||||
*
|
||||
* Version 2.1.3
|
||||
* Additional functions allowed to be called from Interrupt Service Routines:
|
||||
* - osThreadGetId
|
||||
* Version 2.1.2
|
||||
* Additional functions allowed to be called from Interrupt Service Routines:
|
||||
* - osKernelGetInfo, osKernelGetState
|
||||
* Version 2.1.1
|
||||
* Additional functions allowed to be called from Interrupt Service Routines:
|
||||
* - osKernelGetTickCount, osKernelGetTickFreq
|
||||
* Changed Kernel Tick type to uint32_t:
|
||||
* - updated: osKernelGetTickCount, osDelayUntil
|
||||
* Version 2.1.0
|
||||
* Support for critical and uncritical sections (nesting safe):
|
||||
* - updated: osKernelLock, osKernelUnlock
|
||||
* - added: osKernelRestoreLock
|
||||
* Updated Thread and Event Flags:
|
||||
* - changed flags parameter and return type from int32_t to uint32_t
|
||||
* Version 2.0.0
|
||||
* Initial Release
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef CMSIS_OS2_H_
|
||||
#define CMSIS_OS2_H_
|
||||
|
||||
#ifndef __NO_RETURN
|
||||
#if defined(__CC_ARM)
|
||||
#define __NO_RETURN __declspec(noreturn)
|
||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
||||
#define __NO_RETURN __attribute__((__noreturn__))
|
||||
#elif defined(__GNUC__)
|
||||
#define __NO_RETURN __attribute__((__noreturn__))
|
||||
#elif defined(__ICCARM__)
|
||||
#define __NO_RETURN __noreturn
|
||||
#else
|
||||
#define __NO_RETURN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <furi/base.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
// ==== Enumerations, structures, defines ====
|
||||
|
||||
/// Version information.
|
||||
typedef struct {
|
||||
uint32_t api; ///< API version (major.minor.rev: mmnnnrrrr dec).
|
||||
uint32_t kernel; ///< Kernel version (major.minor.rev: mmnnnrrrr dec).
|
||||
} osVersion_t;
|
||||
|
||||
/// Kernel state.
|
||||
typedef enum {
|
||||
osKernelInactive = 0, ///< Inactive.
|
||||
osKernelReady = 1, ///< Ready.
|
||||
osKernelRunning = 2, ///< Running.
|
||||
osKernelLocked = 3, ///< Locked.
|
||||
osKernelSuspended = 4, ///< Suspended.
|
||||
osKernelError = -1, ///< Error.
|
||||
osKernelReserved = 0x7FFFFFFF ///< Prevents enum down-size compiler optimization.
|
||||
} osKernelState_t;
|
||||
|
||||
/// Timer callback function.
|
||||
typedef void (*osTimerFunc_t) (void *argument);
|
||||
|
||||
/// Timer type.
|
||||
typedef enum {
|
||||
osTimerOnce = 0, ///< One-shot timer.
|
||||
osTimerPeriodic = 1 ///< Repeating timer.
|
||||
} osTimerType_t;
|
||||
|
||||
|
||||
/// \details Timer ID identifies the timer.
|
||||
typedef void *osTimerId_t;
|
||||
|
||||
/// \details Message Queue ID identifies the message queue.
|
||||
typedef void *osMessageQueueId_t;
|
||||
|
||||
|
||||
#ifndef TZ_MODULEID_T
|
||||
#define TZ_MODULEID_T
|
||||
/// \details Data type that identifies secure software modules called by a process.
|
||||
typedef uint32_t TZ_ModuleId_t;
|
||||
#endif
|
||||
|
||||
|
||||
/// Attributes structure for timer.
|
||||
typedef struct {
|
||||
const char *name; ///< name of the timer
|
||||
uint32_t attr_bits; ///< attribute bits
|
||||
void *cb_mem; ///< memory for control block
|
||||
uint32_t cb_size; ///< size of provided memory for control block
|
||||
} osTimerAttr_t;
|
||||
|
||||
/// Attributes structure for message queue.
|
||||
typedef struct {
|
||||
const char *name; ///< name of the message queue
|
||||
uint32_t attr_bits; ///< attribute bits
|
||||
void *cb_mem; ///< memory for control block
|
||||
uint32_t cb_size; ///< size of provided memory for control block
|
||||
void *mq_mem; ///< memory for data storage
|
||||
uint32_t mq_size; ///< size of provided memory for data storage
|
||||
} osMessageQueueAttr_t;
|
||||
|
||||
|
||||
// ==== Kernel Management Functions ====
|
||||
|
||||
/// Initialize the RTOS Kernel.
|
||||
/// \return status code that indicates the execution status of the function.
|
||||
osStatus_t osKernelInitialize (void);
|
||||
|
||||
/// Get RTOS Kernel Information.
|
||||
/// \param[out] version pointer to buffer for retrieving version information.
|
||||
/// \param[out] id_buf pointer to buffer for retrieving kernel identification string.
|
||||
/// \param[in] id_size size of buffer for kernel identification string.
|
||||
/// \return status code that indicates the execution status of the function.
|
||||
osStatus_t osKernelGetInfo (osVersion_t *version, char *id_buf, uint32_t id_size);
|
||||
|
||||
/// Get the current RTOS Kernel state.
|
||||
/// \return current RTOS Kernel state.
|
||||
osKernelState_t osKernelGetState (void);
|
||||
|
||||
/// Start the RTOS Kernel scheduler.
|
||||
/// \return status code that indicates the execution status of the function.
|
||||
osStatus_t osKernelStart (void);
|
||||
|
||||
/// Lock the RTOS Kernel scheduler.
|
||||
/// \return previous lock state (1 - locked, 0 - not locked, error code if negative).
|
||||
int32_t osKernelLock (void);
|
||||
|
||||
/// Unlock the RTOS Kernel scheduler.
|
||||
/// \return previous lock state (1 - locked, 0 - not locked, error code if negative).
|
||||
int32_t osKernelUnlock (void);
|
||||
|
||||
/// Restore the RTOS Kernel scheduler lock state.
|
||||
/// \param[in] lock lock state obtained by \ref osKernelLock or \ref osKernelUnlock.
|
||||
/// \return new lock state (1 - locked, 0 - not locked, error code if negative).
|
||||
int32_t osKernelRestoreLock (int32_t lock);
|
||||
|
||||
/// Suspend the RTOS Kernel scheduler.
|
||||
/// \return time in ticks, for how long the system can sleep or power-down.
|
||||
uint32_t osKernelSuspend (void);
|
||||
|
||||
/// Resume the RTOS Kernel scheduler.
|
||||
/// \param[in] sleep_ticks time in ticks for how long the system was in sleep or power-down mode.
|
||||
void osKernelResume (uint32_t sleep_ticks);
|
||||
|
||||
/// Get the RTOS kernel tick count.
|
||||
/// \return RTOS kernel current tick count.
|
||||
uint32_t osKernelGetTickCount (void);
|
||||
|
||||
/// Get the RTOS kernel tick frequency.
|
||||
/// \return frequency of the kernel tick in hertz, i.e. kernel ticks per second.
|
||||
uint32_t osKernelGetTickFreq (void);
|
||||
|
||||
/// Get the RTOS kernel system timer frequency.
|
||||
/// \return frequency of the system timer in hertz, i.e. timer ticks per second.
|
||||
uint32_t osKernelGetSysTimerFreq (void);
|
||||
|
||||
// ==== Generic Wait Functions ====
|
||||
|
||||
/// Wait for Timeout (Time Delay).
|
||||
/// \param[in] ticks \ref CMSIS_RTOS_TimeOutValue "time ticks" value
|
||||
/// \return status code that indicates the execution status of the function.
|
||||
osStatus_t osDelay (uint32_t ticks);
|
||||
|
||||
/// Wait until specified time.
|
||||
/// \param[in] ticks absolute time in ticks
|
||||
/// \return status code that indicates the execution status of the function.
|
||||
osStatus_t osDelayUntil (uint32_t ticks);
|
||||
|
||||
|
||||
// ==== Timer Management Functions ====
|
||||
|
||||
/// Create and Initialize a timer.
|
||||
/// \param[in] func function pointer to callback function.
|
||||
/// \param[in] type \ref osTimerOnce for one-shot or \ref osTimerPeriodic for periodic behavior.
|
||||
/// \param[in] argument argument to the timer callback function.
|
||||
/// \param[in] attr timer attributes; NULL: default values.
|
||||
/// \return timer ID for reference by other functions or NULL in case of error.
|
||||
osTimerId_t osTimerNew (osTimerFunc_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr);
|
||||
|
||||
/// Get name of a timer.
|
||||
/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
|
||||
/// \return name as null-terminated string.
|
||||
const char *osTimerGetName (osTimerId_t timer_id);
|
||||
|
||||
/// Start or restart a timer.
|
||||
/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
|
||||
/// \param[in] ticks \ref CMSIS_RTOS_TimeOutValue "time ticks" value of the timer.
|
||||
/// \return status code that indicates the execution status of the function.
|
||||
osStatus_t osTimerStart (osTimerId_t timer_id, uint32_t ticks);
|
||||
|
||||
/// Stop a timer.
|
||||
/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
|
||||
/// \return status code that indicates the execution status of the function.
|
||||
osStatus_t osTimerStop (osTimerId_t timer_id);
|
||||
|
||||
/// Check if a timer is running.
|
||||
/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
|
||||
/// \return 0 not running, 1 running.
|
||||
uint32_t osTimerIsRunning (osTimerId_t timer_id);
|
||||
|
||||
/// Delete a timer.
|
||||
/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
|
||||
/// \return status code that indicates the execution status of the function.
|
||||
osStatus_t osTimerDelete (osTimerId_t timer_id);
|
||||
|
||||
// ==== Message Queue Management Functions ====
|
||||
|
||||
/// Create and Initialize a Message Queue object.
|
||||
/// \param[in] msg_count maximum number of messages in queue.
|
||||
/// \param[in] msg_size maximum message size in bytes.
|
||||
/// \param[in] attr message queue attributes; NULL: default values.
|
||||
/// \return message queue ID for reference by other functions or NULL in case of error.
|
||||
osMessageQueueId_t osMessageQueueNew (uint32_t msg_count, uint32_t msg_size, const osMessageQueueAttr_t *attr);
|
||||
|
||||
/// Get name of a Message Queue object.
|
||||
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
|
||||
/// \return name as null-terminated string.
|
||||
const char *osMessageQueueGetName (osMessageQueueId_t mq_id);
|
||||
|
||||
/// Put a Message into a Queue or timeout if Queue is full.
|
||||
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
|
||||
/// \param[in] msg_ptr pointer to buffer with message to put into a queue.
|
||||
/// \param[in] msg_prio message priority.
|
||||
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
|
||||
/// \return status code that indicates the execution status of the function.
|
||||
osStatus_t osMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout);
|
||||
|
||||
/// Get a Message from a Queue or timeout if Queue is empty.
|
||||
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
|
||||
/// \param[out] msg_ptr pointer to buffer for message to get from a queue.
|
||||
/// \param[out] msg_prio pointer to buffer for message priority or NULL.
|
||||
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
|
||||
/// \return status code that indicates the execution status of the function.
|
||||
osStatus_t osMessageQueueGet (osMessageQueueId_t mq_id, void *msg_ptr, uint8_t *msg_prio, uint32_t timeout);
|
||||
|
||||
/// Get maximum number of messages in a Message Queue.
|
||||
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
|
||||
/// \return maximum number of messages.
|
||||
uint32_t osMessageQueueGetCapacity (osMessageQueueId_t mq_id);
|
||||
|
||||
/// Get maximum message size in a Message Queue.
|
||||
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
|
||||
/// \return maximum message size in bytes.
|
||||
uint32_t osMessageQueueGetMsgSize (osMessageQueueId_t mq_id);
|
||||
|
||||
/// Get number of queued messages in a Message Queue.
|
||||
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
|
||||
/// \return number of queued messages.
|
||||
uint32_t osMessageQueueGetCount (osMessageQueueId_t mq_id);
|
||||
|
||||
/// Get number of available slots for messages in a Message Queue.
|
||||
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
|
||||
/// \return number of available slots for messages.
|
||||
uint32_t osMessageQueueGetSpace (osMessageQueueId_t mq_id);
|
||||
|
||||
/// Reset a Message Queue to initial empty state.
|
||||
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
|
||||
/// \return status code that indicates the execution status of the function.
|
||||
osStatus_t osMessageQueueReset (osMessageQueueId_t mq_id);
|
||||
|
||||
/// Delete a Message Queue object.
|
||||
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
|
||||
/// \return status code that indicates the execution status of the function.
|
||||
osStatus_t osMessageQueueDelete (osMessageQueueId_t mq_id);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CMSIS_OS2_H_
|
@@ -1,319 +0,0 @@
|
||||
/* --------------------------------------------------------------------------
|
||||
* Copyright (c) 2013-2021 Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Name: freertos_os2.h
|
||||
* Purpose: CMSIS RTOS2 wrapper for FreeRTOS
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef FREERTOS_OS2_H_
|
||||
#define FREERTOS_OS2_H_
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "FreeRTOS.h" // ARM.FreeRTOS::RTOS:Core
|
||||
|
||||
#if defined(_RTE_)
|
||||
#include "RTE_Components.h" // Component selection
|
||||
#include CMSIS_device_header
|
||||
|
||||
/* Configuration and component setup check */
|
||||
#if defined(RTE_Compiler_EventRecorder)
|
||||
#if !defined(EVR_FREERTOS_DISABLE)
|
||||
#define USE_TRACE_EVENT_RECORDER
|
||||
/*
|
||||
FreeRTOS provides functions and hooks to support execution tracing. This
|
||||
functionality is only enabled if configUSE_TRACE_FACILITY == 1.
|
||||
Set #define configUSE_TRACE_FACILITY 1 in FreeRTOSConfig.h to enable trace events.
|
||||
*/
|
||||
#if (configUSE_TRACE_FACILITY == 0)
|
||||
#error "Definition configUSE_TRACE_FACILITY must equal 1 to enable FreeRTOS trace events."
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(RTE_RTOS_FreeRTOS_HEAP_1)
|
||||
#define USE_FreeRTOS_HEAP_1
|
||||
#endif
|
||||
|
||||
#if defined(RTE_RTOS_FreeRTOS_HEAP_5)
|
||||
#define USE_FreeRTOS_HEAP_5
|
||||
#endif
|
||||
#endif /* _RTE_ */
|
||||
|
||||
/*
|
||||
CMSIS-RTOS2 FreeRTOS image size optimization definitions.
|
||||
|
||||
Note: Definitions configUSE_OS2 can be used to optimize FreeRTOS image size when
|
||||
certain functionality is not required when using CMSIS-RTOS2 API.
|
||||
In general optimization decisions are left to the tool chain but in cases
|
||||
when coding style prevents it to optimize the code following optional
|
||||
definitions can be used.
|
||||
*/
|
||||
|
||||
/*
|
||||
Option to exclude CMSIS-RTOS2 functions osThreadSuspend and osThreadResume from
|
||||
the application image.
|
||||
*/
|
||||
#ifndef configUSE_OS2_THREAD_SUSPEND_RESUME
|
||||
#define configUSE_OS2_THREAD_SUSPEND_RESUME 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
Option to exclude CMSIS-RTOS2 function furi_thread_enumerate from the application image.
|
||||
*/
|
||||
#ifndef configUSE_OS2_THREAD_ENUMERATE
|
||||
#define configUSE_OS2_THREAD_ENUMERATE 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
Option to disable CMSIS-RTOS2 function osEventFlagsSet and osEventFlagsClear
|
||||
operation from ISR.
|
||||
*/
|
||||
#ifndef configUSE_OS2_EVENTFLAGS_FROM_ISR
|
||||
#define configUSE_OS2_EVENTFLAGS_FROM_ISR 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
Option to exclude CMSIS-RTOS2 Thread Flags API functions from the application image.
|
||||
*/
|
||||
#ifndef configUSE_OS2_THREAD_FLAGS
|
||||
#define configUSE_OS2_THREAD_FLAGS configUSE_TASK_NOTIFICATIONS
|
||||
#endif
|
||||
|
||||
/*
|
||||
Option to exclude CMSIS-RTOS2 Timer API functions from the application image.
|
||||
*/
|
||||
#ifndef configUSE_OS2_TIMER
|
||||
#define configUSE_OS2_TIMER configUSE_TIMERS
|
||||
#endif
|
||||
|
||||
/*
|
||||
Option to exclude CMSIS-RTOS2 Mutex API functions from the application image.
|
||||
*/
|
||||
#ifndef configUSE_OS2_MUTEX
|
||||
#define configUSE_OS2_MUTEX configUSE_MUTEXES
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
CMSIS-RTOS2 FreeRTOS configuration check (FreeRTOSConfig.h).
|
||||
|
||||
Note: CMSIS-RTOS API requires functions included by using following definitions.
|
||||
In case if certain API function is not used compiler will optimize it away.
|
||||
*/
|
||||
#if (INCLUDE_xSemaphoreGetMutexHolder == 0)
|
||||
/*
|
||||
CMSIS-RTOS2 function osMutexGetOwner uses FreeRTOS function xSemaphoreGetMutexHolder. In case if
|
||||
osMutexGetOwner is not used in the application image, compiler will optimize it away.
|
||||
Set #define INCLUDE_xSemaphoreGetMutexHolder 1 to fix this error.
|
||||
*/
|
||||
#error "Definition INCLUDE_xSemaphoreGetMutexHolder must equal 1 to implement Mutex Management API."
|
||||
#endif
|
||||
#if (INCLUDE_vTaskDelay == 0)
|
||||
/*
|
||||
CMSIS-RTOS2 function osDelay uses FreeRTOS function vTaskDelay. In case if
|
||||
osDelay is not used in the application image, compiler will optimize it away.
|
||||
Set #define INCLUDE_vTaskDelay 1 to fix this error.
|
||||
*/
|
||||
#error "Definition INCLUDE_vTaskDelay must equal 1 to implement Generic Wait Functions API."
|
||||
#endif
|
||||
#if (INCLUDE_xTaskDelayUntil == 0)
|
||||
/*
|
||||
CMSIS-RTOS2 function osDelayUntil uses FreeRTOS function xTaskDelayUntil. In case if
|
||||
osDelayUntil is not used in the application image, compiler will optimize it away.
|
||||
Set #define INCLUDE_xTaskDelayUntil 1 to fix this error.
|
||||
*/
|
||||
#error "Definition INCLUDE_xTaskDelayUntil must equal 1 to implement Generic Wait Functions API."
|
||||
#endif
|
||||
#if (INCLUDE_vTaskDelete == 0)
|
||||
/*
|
||||
CMSIS-RTOS2 function osThreadTerminate and osThreadExit uses FreeRTOS function
|
||||
vTaskDelete. In case if they are not used in the application image, compiler
|
||||
will optimize them away.
|
||||
Set #define INCLUDE_vTaskDelete 1 to fix this error.
|
||||
*/
|
||||
#error "Definition INCLUDE_vTaskDelete must equal 1 to implement Thread Management API."
|
||||
#endif
|
||||
#if (INCLUDE_xTaskGetCurrentTaskHandle == 0)
|
||||
/*
|
||||
CMSIS-RTOS2 API uses FreeRTOS function xTaskGetCurrentTaskHandle to implement
|
||||
functions osThreadGetId, furi_thread_flags_clear and furi_thread_flags_get. In case if these
|
||||
functions are not used in the application image, compiler will optimize them away.
|
||||
Set #define INCLUDE_xTaskGetCurrentTaskHandle 1 to fix this error.
|
||||
*/
|
||||
#error "Definition INCLUDE_xTaskGetCurrentTaskHandle must equal 1 to implement Thread Management API."
|
||||
#endif
|
||||
#if (INCLUDE_xTaskGetSchedulerState == 0)
|
||||
/*
|
||||
CMSIS-RTOS2 API uses FreeRTOS function xTaskGetSchedulerState to implement Kernel
|
||||
tick handling and therefore it is vital that xTaskGetSchedulerState is included into
|
||||
the application image.
|
||||
Set #define INCLUDE_xTaskGetSchedulerState 1 to fix this error.
|
||||
*/
|
||||
#error "Definition INCLUDE_xTaskGetSchedulerState must equal 1 to implement Kernel Information and Control API."
|
||||
#endif
|
||||
#if (INCLUDE_uxTaskGetStackHighWaterMark == 0)
|
||||
/*
|
||||
CMSIS-RTOS2 function furi_thread_get_stack_space uses FreeRTOS function uxTaskGetStackHighWaterMark.
|
||||
In case if furi_thread_get_stack_space is not used in the application image, compiler will
|
||||
optimize it away.
|
||||
Set #define INCLUDE_uxTaskGetStackHighWaterMark 1 to fix this error.
|
||||
*/
|
||||
#error "Definition INCLUDE_uxTaskGetStackHighWaterMark must equal 1 to implement Thread Management API."
|
||||
#endif
|
||||
#if (INCLUDE_uxTaskPriorityGet == 0)
|
||||
/*
|
||||
CMSIS-RTOS2 function osThreadGetPriority uses FreeRTOS function uxTaskPriorityGet. In case if
|
||||
osThreadGetPriority is not used in the application image, compiler will optimize it away.
|
||||
Set #define INCLUDE_uxTaskPriorityGet 1 to fix this error.
|
||||
*/
|
||||
#error "Definition INCLUDE_uxTaskPriorityGet must equal 1 to implement Thread Management API."
|
||||
#endif
|
||||
#if (INCLUDE_vTaskPrioritySet == 0)
|
||||
/*
|
||||
CMSIS-RTOS2 function osThreadSetPriority uses FreeRTOS function vTaskPrioritySet. In case if
|
||||
osThreadSetPriority is not used in the application image, compiler will optimize it away.
|
||||
Set #define INCLUDE_vTaskPrioritySet 1 to fix this error.
|
||||
*/
|
||||
#error "Definition INCLUDE_vTaskPrioritySet must equal 1 to implement Thread Management API."
|
||||
#endif
|
||||
#if (INCLUDE_eTaskGetState == 0)
|
||||
/*
|
||||
CMSIS-RTOS2 API uses FreeRTOS function vTaskDelayUntil to implement functions osThreadGetState
|
||||
and osThreadTerminate. In case if these functions are not used in the application image,
|
||||
compiler will optimize them away.
|
||||
Set #define INCLUDE_eTaskGetState 1 to fix this error.
|
||||
*/
|
||||
#error "Definition INCLUDE_eTaskGetState must equal 1 to implement Thread Management API."
|
||||
#endif
|
||||
#if (INCLUDE_vTaskSuspend == 0)
|
||||
/*
|
||||
CMSIS-RTOS2 API uses FreeRTOS functions vTaskSuspend and vTaskResume to implement
|
||||
functions osThreadSuspend and osThreadResume. In case if these functions are not
|
||||
used in the application image, compiler will optimize them away.
|
||||
Set #define INCLUDE_vTaskSuspend 1 to fix this error.
|
||||
|
||||
Alternatively, if the application does not use osThreadSuspend and
|
||||
osThreadResume they can be excluded from the image code by setting:
|
||||
#define configUSE_OS2_THREAD_SUSPEND_RESUME 0 (in FreeRTOSConfig.h)
|
||||
*/
|
||||
#if (configUSE_OS2_THREAD_SUSPEND_RESUME == 1)
|
||||
#error "Definition INCLUDE_vTaskSuspend must equal 1 to implement Kernel Information and Control API."
|
||||
#endif
|
||||
#endif
|
||||
#if (INCLUDE_xTimerPendFunctionCall == 0)
|
||||
/*
|
||||
CMSIS-RTOS2 function osEventFlagsSet and osEventFlagsClear, when called from
|
||||
the ISR, call FreeRTOS functions xEventGroupSetBitsFromISR and
|
||||
xEventGroupClearBitsFromISR which are only enabled if timers are operational and
|
||||
xTimerPendFunctionCall in enabled.
|
||||
Set #define INCLUDE_xTimerPendFunctionCall 1 and #define configUSE_TIMERS 1
|
||||
to fix this error.
|
||||
|
||||
Alternatively, if the application does not use osEventFlagsSet and osEventFlagsClear
|
||||
from the ISR their operation from ISR can be restricted by setting:
|
||||
#define configUSE_OS2_EVENTFLAGS_FROM_ISR 0 (in FreeRTOSConfig.h)
|
||||
*/
|
||||
#if (configUSE_OS2_EVENTFLAGS_FROM_ISR == 1)
|
||||
#error "Definition INCLUDE_xTimerPendFunctionCall must equal 1 to implement Event Flags API."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (configUSE_TIMERS == 0)
|
||||
/*
|
||||
CMSIS-RTOS2 Timer Management API functions use FreeRTOS timer functions to implement
|
||||
timer management. In case if these functions are not used in the application image,
|
||||
compiler will optimize them away.
|
||||
Set #define configUSE_TIMERS 1 to fix this error.
|
||||
|
||||
Alternatively, if the application does not use timer functions they can be
|
||||
excluded from the image code by setting:
|
||||
#define configUSE_OS2_TIMER 0 (in FreeRTOSConfig.h)
|
||||
*/
|
||||
#if (configUSE_OS2_TIMER == 1)
|
||||
#error "Definition configUSE_TIMERS must equal 1 to implement Timer Management API."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (configUSE_MUTEXES == 0)
|
||||
/*
|
||||
CMSIS-RTOS2 Mutex Management API functions use FreeRTOS mutex functions to implement
|
||||
mutex management. In case if these functions are not used in the application image,
|
||||
compiler will optimize them away.
|
||||
Set #define configUSE_MUTEXES 1 to fix this error.
|
||||
|
||||
Alternatively, if the application does not use mutex functions they can be
|
||||
excluded from the image code by setting:
|
||||
#define configUSE_OS2_MUTEX 0 (in FreeRTOSConfig.h)
|
||||
*/
|
||||
#if (configUSE_OS2_MUTEX == 1)
|
||||
#error "Definition configUSE_MUTEXES must equal 1 to implement Mutex Management API."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (configUSE_COUNTING_SEMAPHORES == 0)
|
||||
/*
|
||||
CMSIS-RTOS2 Memory Pool functions use FreeRTOS function xSemaphoreCreateCounting
|
||||
to implement memory pools. In case if these functions are not used in the application image,
|
||||
compiler will optimize them away.
|
||||
Set #define configUSE_COUNTING_SEMAPHORES 1 to fix this error.
|
||||
*/
|
||||
#error "Definition configUSE_COUNTING_SEMAPHORES must equal 1 to implement Memory Pool API."
|
||||
#endif
|
||||
#if (configUSE_TASK_NOTIFICATIONS == 0)
|
||||
/*
|
||||
CMSIS-RTOS2 Thread Flags API functions use FreeRTOS Task Notification functions to implement
|
||||
thread flag management. In case if these functions are not used in the application image,
|
||||
compiler will optimize them away.
|
||||
Set #define configUSE_TASK_NOTIFICATIONS 1 to fix this error.
|
||||
|
||||
Alternatively, if the application does not use thread flags functions they can be
|
||||
excluded from the image code by setting:
|
||||
#define configUSE_OS2_THREAD_FLAGS 0 (in FreeRTOSConfig.h)
|
||||
*/
|
||||
#if (configUSE_OS2_THREAD_FLAGS == 1)
|
||||
#error "Definition configUSE_TASK_NOTIFICATIONS must equal 1 to implement Thread Flags API."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (configUSE_TRACE_FACILITY == 0)
|
||||
/*
|
||||
CMSIS-RTOS2 function furi_thread_enumerate requires FreeRTOS function uxTaskGetSystemState
|
||||
which is only enabled if configUSE_TRACE_FACILITY == 1.
|
||||
Set #define configUSE_TRACE_FACILITY 1 to fix this error.
|
||||
|
||||
Alternatively, if the application does not use furi_thread_enumerate it can be
|
||||
excluded from the image code by setting:
|
||||
#define configUSE_OS2_THREAD_ENUMERATE 0 (in FreeRTOSConfig.h)
|
||||
*/
|
||||
#if (configUSE_OS2_THREAD_ENUMERATE == 1)
|
||||
#error "Definition configUSE_TRACE_FACILITY must equal 1 to implement furi_thread_enumerate."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (configUSE_16_BIT_TICKS == 1)
|
||||
/*
|
||||
CMSIS-RTOS2 wrapper for FreeRTOS relies on 32-bit tick timer which is also optimal on
|
||||
a 32-bit CPU architectures.
|
||||
Set #define configUSE_16_BIT_TICKS 0 to fix this error.
|
||||
*/
|
||||
#error "Definition configUSE_16_BIT_TICKS must be zero to implement CMSIS-RTOS2 API."
|
||||
#endif
|
||||
|
||||
#endif /* FREERTOS_OS2_H_ */
|
@@ -26,7 +26,7 @@ int32_t rfal_platform_irq_thread(void* context) {
|
||||
UNUSED(context);
|
||||
|
||||
while(1) {
|
||||
uint32_t flags = furi_thread_flags_wait(0x1, osFlagsWaitAny, osWaitForever);
|
||||
uint32_t flags = furi_thread_flags_wait(0x1, FuriFlagWaitAny, FuriWaitForever);
|
||||
if(flags & 0x1) {
|
||||
rfal_platform.callback();
|
||||
}
|
||||
|
@@ -4,7 +4,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <limits.h>
|
||||
#include <cmsis_os2.h>
|
||||
#include "timer.h"
|
||||
#include "math.h"
|
||||
#include <furi_hal_gpio.h>
|
||||
@@ -104,10 +103,9 @@ void rfal_platform_spi_release();
|
||||
timerCalculateTimer(t) /*!< Create a timer with the given time (ms) */
|
||||
#define platformTimerIsExpired(timer) \
|
||||
timerIsExpired(timer) /*!< Checks if the given timer is expired */
|
||||
#define platformDelay(t) osDelay(t) /*!< Performs a delay for the given time (ms) */
|
||||
#define platformDelay(t) furi_delay_ms(t) /*!< Performs a delay for the given time (ms) */
|
||||
|
||||
#define platformGetSysTick() \
|
||||
osKernelGetTickCount() /*!< Get System Tick (1 tick = 1 ms) */
|
||||
#define platformGetSysTick() furi_get_tick() /*!< Get System Tick (1 tick = 1 ms) */
|
||||
|
||||
#define platformAssert(exp) assert_param(exp) /*!< Asserts whether the given expression is true*/
|
||||
|
||||
|
@@ -41,7 +41,7 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
#include "timer.h"
|
||||
#include <furi_hal_delay.h>
|
||||
#include <furi.h>
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
@@ -65,7 +65,7 @@ static uint32_t timerStopwatchTick;
|
||||
|
||||
/*******************************************************************************/
|
||||
uint32_t timerCalculateTimer(uint16_t time) {
|
||||
return (furi_hal_get_tick() + time);
|
||||
return (furi_get_tick() + time);
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
@@ -73,7 +73,7 @@ bool timerIsExpired(uint32_t timer) {
|
||||
uint32_t uDiff;
|
||||
int32_t sDiff;
|
||||
|
||||
uDiff = (timer - furi_hal_get_tick()); /* Calculate the diff between the timers */
|
||||
uDiff = (timer - furi_get_tick()); /* Calculate the diff between the timers */
|
||||
sDiff = uDiff; /* Convert the diff to a signed var */
|
||||
|
||||
/* Check if the given timer has expired already */
|
||||
@@ -96,10 +96,10 @@ void timerDelay(uint16_t tOut) {
|
||||
|
||||
/*******************************************************************************/
|
||||
void timerStopwatchStart(void) {
|
||||
timerStopwatchTick = furi_hal_get_tick();
|
||||
timerStopwatchTick = furi_get_tick();
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
uint32_t timerStopwatchMeasure(void) {
|
||||
return (uint32_t)(furi_hal_get_tick() - timerStopwatchTick);
|
||||
return (uint32_t)(furi_get_tick() - timerStopwatchTick);
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include <furi/record.h>
|
||||
#include <core/record.h>
|
||||
|
||||
/**
|
||||
* @brief Class for opening, casting, holding and closing records
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "view_modules/generic_view_module.h"
|
||||
#include <map>
|
||||
#include <furi/check.h>
|
||||
#include <core/check.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <callback-connector.h>
|
||||
#include "typeindex_no_rtti.hpp"
|
||||
@@ -15,7 +15,7 @@
|
||||
template <typename TApp, typename... TViewModules> class ViewController {
|
||||
public:
|
||||
ViewController() {
|
||||
event_queue = osMessageQueueNew(10, sizeof(typename TApp::Event), NULL);
|
||||
event_queue = furi_message_queue_alloc(10, sizeof(typename TApp::Event));
|
||||
|
||||
view_dispatcher = view_dispatcher_alloc();
|
||||
previous_view_callback_pointer = cbc::obtain_connector(
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
}
|
||||
|
||||
view_dispatcher_free(view_dispatcher);
|
||||
osMessageQueueDelete(event_queue);
|
||||
furi_message_queue_free(event_queue);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
* @param event event pointer
|
||||
*/
|
||||
void receive_event(typename TApp::Event* event) {
|
||||
if(osMessageQueueGet(event_queue, event, NULL, 100) != osOK) {
|
||||
if(furi_message_queue_get(event_queue, event, 100) != FuriStatusOk) {
|
||||
event->type = TApp::EventType::Tick;
|
||||
}
|
||||
}
|
||||
@@ -92,8 +92,8 @@ public:
|
||||
* @param event event pointer
|
||||
*/
|
||||
void send_event(typename TApp::Event* event) {
|
||||
osStatus_t result = osMessageQueuePut(event_queue, event, 0, osWaitForever);
|
||||
furi_check(result == osOK);
|
||||
FuriStatus result = furi_message_queue_put(event_queue, event, FuriWaitForever);
|
||||
furi_check(result == FuriStatusOk);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -107,7 +107,7 @@ private:
|
||||
* @brief App event queue
|
||||
*
|
||||
*/
|
||||
osMessageQueueId_t event_queue;
|
||||
FuriMessageQueue* event_queue;
|
||||
|
||||
/**
|
||||
* @brief Main ViewDispatcher pointer
|
||||
|
@@ -1,8 +1,7 @@
|
||||
#include "bq27220.h"
|
||||
#include "bq27220_reg.h"
|
||||
|
||||
#include <furi_hal_delay.h>
|
||||
#include <furi/log.h>
|
||||
#include <furi.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define TAG "Gauge"
|
||||
@@ -42,7 +41,7 @@ bool bq27220_set_parameter_u16(FuriHalI2cBusHandle* handle, uint16_t address, ui
|
||||
ret = furi_hal_i2c_write_mem(
|
||||
handle, BQ27220_ADDRESS, CommandSelectSubclass, buffer, 4, BQ27220_I2C_TIMEOUT);
|
||||
|
||||
furi_hal_delay_us(10000);
|
||||
furi_delay_us(10000);
|
||||
|
||||
uint8_t checksum = bq27220_get_checksum(buffer, 4);
|
||||
buffer[0] = checksum;
|
||||
@@ -50,7 +49,7 @@ bool bq27220_set_parameter_u16(FuriHalI2cBusHandle* handle, uint16_t address, ui
|
||||
ret &= furi_hal_i2c_write_mem(
|
||||
handle, BQ27220_ADDRESS, CommandMACDataSum, buffer, 2, BQ27220_I2C_TIMEOUT);
|
||||
|
||||
furi_hal_delay_us(10000);
|
||||
furi_delay_us(10000);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -96,7 +95,7 @@ bool bq27220_init(FuriHalI2cBusHandle* handle, const ParamCEDV* cedv) {
|
||||
bq27220_set_parameter_u16(handle, AddressEDV2, cedv->EDV2);
|
||||
|
||||
bq27220_control(handle, Control_EXIT_CFG_UPDATE_REINIT);
|
||||
furi_hal_delay_us(10000);
|
||||
furi_delay_us(10000);
|
||||
design_cap = bq27220_get_design_capacity(handle);
|
||||
if(cedv->design_cap == design_cap) {
|
||||
FURI_LOG_I(TAG, "Battery profile update success");
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#include "cc1101.h"
|
||||
#include <cmsis_os2.h>
|
||||
#include <furi_hal_delay.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#include "lp5562.h"
|
||||
#include "furi/common_defines.h"
|
||||
#include <core/common_defines.h>
|
||||
#include "lp5562_reg.h"
|
||||
#include <furi_hal.h>
|
||||
|
||||
@@ -27,7 +27,7 @@ void lp5562_enable(FuriHalI2cBusHandle* handle) {
|
||||
Reg00_Enable reg = {.CHIP_EN = true, .LOG_EN = true};
|
||||
furi_hal_i2c_write_reg_8(handle, LP5562_ADDRESS, 0x00, *(uint8_t*)®, LP5562_I2C_TIMEOUT);
|
||||
//>488μs delay is required after writing to 0x00 register, otherwise program engine will not work
|
||||
furi_hal_delay_us(500);
|
||||
furi_delay_us(500);
|
||||
}
|
||||
|
||||
void lp5562_set_channel_current(FuriHalI2cBusHandle* handle, LP5562Channel channel, uint8_t value) {
|
||||
@@ -127,7 +127,7 @@ void lp5562_execute_program(
|
||||
reg_val &= ~(0x3 << bit_offset);
|
||||
reg_val |= (0x01 << bit_offset); // load
|
||||
furi_hal_i2c_write_reg_8(handle, LP5562_ADDRESS, 0x01, reg_val, LP5562_I2C_TIMEOUT);
|
||||
furi_hal_delay_us(100);
|
||||
furi_delay_us(100);
|
||||
|
||||
// Program load
|
||||
for(uint8_t i = 0; i < 16; i++) {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include <furi/check.h>
|
||||
#include <core/check.h>
|
||||
#include <toolbox/stream/stream.h>
|
||||
#include <toolbox/stream/string_stream.h>
|
||||
#include <toolbox/stream/file_stream.h>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include <inttypes.h>
|
||||
#include <toolbox/hex.h>
|
||||
#include <furi/check.h>
|
||||
#include <core/check.h>
|
||||
#include "flipper_format_stream.h"
|
||||
#include "flipper_format_stream_i.h"
|
||||
|
||||
|
@@ -20,7 +20,6 @@ libenv.ApplyLibFlags()
|
||||
sources = libenv.Glob("FreeRTOS-Kernel/*.c", source=True)
|
||||
sources += [
|
||||
"FreeRTOS-Kernel/portable/GCC/ARM_CM4F/port.c",
|
||||
"FreeRTOS-glue/cmsis_os2.c",
|
||||
]
|
||||
|
||||
lib = libenv.StaticLibrary("${FW_LIB_NAME}", sources)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#include "furi/check.h"
|
||||
#include "furi/common_defines.h"
|
||||
#include <core/check.h>
|
||||
#include <core/common_defines.h>
|
||||
#include "infrared.h"
|
||||
#include "infrared_common_i.h"
|
||||
#include <stdbool.h>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "furi/check.h"
|
||||
#include <core/check.h>
|
||||
#include "infrared.h"
|
||||
#include "infrared_common_i.h"
|
||||
#include <stdbool.h>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#include "infrared.h"
|
||||
#include "furi/check.h"
|
||||
#include <core/check.h>
|
||||
#include "common/infrared_common_i.h"
|
||||
#include "infrared_protocol_defs_i.h"
|
||||
#include <stdbool.h>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "furi/check.h"
|
||||
#include <core/check.h>
|
||||
#include "infrared.h"
|
||||
#include "common/infrared_common_i.h"
|
||||
#include <stdint.h>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "furi/memmgr.h"
|
||||
#include <core/memmgr.h>
|
||||
#include "infrared.h"
|
||||
#include "common/infrared_common_i.h"
|
||||
#include "infrared_protocol_defs_i.h"
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "furi/memmgr.h"
|
||||
#include <core/memmgr.h>
|
||||
#include "infrared.h"
|
||||
#include "common/infrared_common_i.h"
|
||||
#include "infrared_protocol_defs_i.h"
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "furi/check.h"
|
||||
#include <core/check.h>
|
||||
#include "common/infrared_common_i.h"
|
||||
#include <stdint.h>
|
||||
#include "../infrared_i.h"
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "furi/check.h"
|
||||
#include <core/check.h>
|
||||
#include "infrared.h"
|
||||
#include "common/infrared_common_i.h"
|
||||
#include <stdint.h>
|
||||
|
@@ -4,7 +4,6 @@
|
||||
#include <stddef.h>
|
||||
#include <furi.h>
|
||||
#include <furi_hal_infrared.h>
|
||||
#include <furi_hal_delay.h>
|
||||
|
||||
static uint32_t infrared_tx_number_of_transmissions = 0;
|
||||
static uint32_t infrared_tx_raw_timings_index = 0;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#include "furi/check.h"
|
||||
#include "furi/common_defines.h"
|
||||
#include <core/check.h>
|
||||
#include <core/common_defines.h>
|
||||
#include "sys/_stdint.h"
|
||||
#include "infrared_worker.h"
|
||||
#include <infrared.h>
|
||||
@@ -167,7 +167,7 @@ static int32_t infrared_worker_rx_thread(void* thread_context) {
|
||||
TickType_t last_blink_time = 0;
|
||||
|
||||
while(1) {
|
||||
events = furi_thread_flags_wait(INFRARED_WORKER_ALL_RX_EVENTS, 0, osWaitForever);
|
||||
events = furi_thread_flags_wait(INFRARED_WORKER_ALL_RX_EVENTS, 0, FuriWaitForever);
|
||||
furi_check(events & INFRARED_WORKER_ALL_RX_EVENTS); /* at least one caught */
|
||||
|
||||
if(events & INFRARED_WORKER_RX_RECEIVED) {
|
||||
@@ -506,7 +506,7 @@ static int32_t infrared_worker_tx_thread(void* thread_context) {
|
||||
|
||||
break;
|
||||
case InfraredWorkerStateRunTx:
|
||||
events = furi_thread_flags_wait(INFRARED_WORKER_ALL_TX_EVENTS, 0, osWaitForever);
|
||||
events = furi_thread_flags_wait(INFRARED_WORKER_ALL_TX_EVENTS, 0, FuriWaitForever);
|
||||
furi_check(events & INFRARED_WORKER_ALL_TX_EVENTS); /* at least one caught */
|
||||
|
||||
if(events & INFRARED_WORKER_EXIT) {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "emv.h"
|
||||
|
||||
#include <furi/common_defines.h>
|
||||
#include <core/common_defines.h>
|
||||
|
||||
#define TAG "Emv"
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include <furi_hal.h>
|
||||
|
||||
#define CYFRAL_DATA_SIZE sizeof(uint16_t)
|
||||
#define CYFRAL_PERIOD (125 * furi_hal_delay_instructions_per_microsecond())
|
||||
#define CYFRAL_PERIOD (125 * furi_hal_cortex_instructions_per_microsecond())
|
||||
#define CYFRAL_0_LOW (CYFRAL_PERIOD * 0.66f)
|
||||
#define CYFRAL_0_HI (CYFRAL_PERIOD * 0.33f)
|
||||
#define CYFRAL_1_LOW (CYFRAL_PERIOD * 0.33f)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include <furi_hal.h>
|
||||
|
||||
#define METAKOM_DATA_SIZE sizeof(uint32_t)
|
||||
#define METAKOM_PERIOD (125 * furi_hal_delay_instructions_per_microsecond())
|
||||
#define METAKOM_PERIOD (125 * furi_hal_cortex_instructions_per_microsecond())
|
||||
#define METAKOM_0_LOW (METAKOM_PERIOD * 0.33f)
|
||||
#define METAKOM_0_HI (METAKOM_PERIOD * 0.66f)
|
||||
#define METAKOM_1_LOW (METAKOM_PERIOD * 0.66f)
|
||||
|
@@ -32,7 +32,7 @@ iButtonWorker* ibutton_worker_alloc() {
|
||||
worker->pulse_decoder = pulse_decoder_alloc();
|
||||
worker->protocol_cyfral = protocol_cyfral_alloc();
|
||||
worker->protocol_metakom = protocol_metakom_alloc();
|
||||
worker->messages = osMessageQueueNew(1, sizeof(iButtonMessage), NULL);
|
||||
worker->messages = furi_message_queue_alloc(1, sizeof(iButtonMessage));
|
||||
worker->mode_index = iButtonWorkerIdle;
|
||||
worker->last_dwt_value = 0;
|
||||
worker->read_cb = NULL;
|
||||
@@ -90,22 +90,26 @@ void ibutton_worker_emulate_set_callback(
|
||||
|
||||
void ibutton_worker_read_start(iButtonWorker* worker, iButtonKey* key) {
|
||||
iButtonMessage message = {.type = iButtonMessageRead, .data.key = key};
|
||||
furi_check(osMessageQueuePut(worker->messages, &message, 0, osWaitForever) == osOK);
|
||||
furi_check(
|
||||
furi_message_queue_put(worker->messages, &message, FuriWaitForever) == FuriStatusOk);
|
||||
}
|
||||
|
||||
void ibutton_worker_write_start(iButtonWorker* worker, iButtonKey* key) {
|
||||
iButtonMessage message = {.type = iButtonMessageWrite, .data.key = key};
|
||||
furi_check(osMessageQueuePut(worker->messages, &message, 0, osWaitForever) == osOK);
|
||||
furi_check(
|
||||
furi_message_queue_put(worker->messages, &message, FuriWaitForever) == FuriStatusOk);
|
||||
}
|
||||
|
||||
void ibutton_worker_emulate_start(iButtonWorker* worker, iButtonKey* key) {
|
||||
iButtonMessage message = {.type = iButtonMessageEmulate, .data.key = key};
|
||||
furi_check(osMessageQueuePut(worker->messages, &message, 0, osWaitForever) == osOK);
|
||||
furi_check(
|
||||
furi_message_queue_put(worker->messages, &message, FuriWaitForever) == FuriStatusOk);
|
||||
}
|
||||
|
||||
void ibutton_worker_stop(iButtonWorker* worker) {
|
||||
iButtonMessage message = {.type = iButtonMessageStop};
|
||||
furi_check(osMessageQueuePut(worker->messages, &message, 0, osWaitForever) == osOK);
|
||||
furi_check(
|
||||
furi_message_queue_put(worker->messages, &message, FuriWaitForever) == FuriStatusOk);
|
||||
}
|
||||
|
||||
void ibutton_worker_free(iButtonWorker* worker) {
|
||||
@@ -123,7 +127,7 @@ void ibutton_worker_free(iButtonWorker* worker) {
|
||||
encoder_cyfral_free(worker->encoder_cyfral);
|
||||
encoder_metakom_free(worker->encoder_metakom);
|
||||
|
||||
osMessageQueueDelete(worker->messages);
|
||||
furi_message_queue_free(worker->messages);
|
||||
|
||||
furi_thread_free(worker->thread);
|
||||
free(worker->key_data);
|
||||
@@ -136,7 +140,8 @@ void ibutton_worker_start_thread(iButtonWorker* worker) {
|
||||
|
||||
void ibutton_worker_stop_thread(iButtonWorker* worker) {
|
||||
iButtonMessage message = {.type = iButtonMessageEnd};
|
||||
furi_check(osMessageQueuePut(worker->messages, &message, 0, osWaitForever) == osOK);
|
||||
furi_check(
|
||||
furi_message_queue_put(worker->messages, &message, FuriWaitForever) == FuriStatusOk);
|
||||
furi_thread_join(worker->thread);
|
||||
}
|
||||
|
||||
@@ -148,7 +153,7 @@ void ibutton_worker_switch_mode(iButtonWorker* worker, iButtonWorkerMode mode) {
|
||||
|
||||
void ibutton_worker_notify_emulate(iButtonWorker* worker) {
|
||||
iButtonMessage message = {.type = iButtonMessageNotifyEmulate};
|
||||
furi_check(osMessageQueuePut(worker->messages, &message, 0, 0) == osOK);
|
||||
furi_check(furi_message_queue_put(worker->messages, &message, 0) == FuriStatusOk);
|
||||
}
|
||||
|
||||
void ibutton_worker_set_key_p(iButtonWorker* worker, iButtonKey* key) {
|
||||
@@ -159,14 +164,14 @@ static int32_t ibutton_worker_thread(void* thread_context) {
|
||||
iButtonWorker* worker = thread_context;
|
||||
bool running = true;
|
||||
iButtonMessage message;
|
||||
osStatus_t status;
|
||||
FuriStatus status;
|
||||
|
||||
ibutton_worker_modes[worker->mode_index].start(worker);
|
||||
|
||||
while(running) {
|
||||
status = osMessageQueueGet(
|
||||
worker->messages, &message, NULL, ibutton_worker_modes[worker->mode_index].quant);
|
||||
if(status == osOK) {
|
||||
status = furi_message_queue_get(
|
||||
worker->messages, &message, ibutton_worker_modes[worker->mode_index].quant);
|
||||
if(status == FuriStatusOk) {
|
||||
switch(message.type) {
|
||||
case iButtonMessageEnd:
|
||||
ibutton_worker_switch_mode(worker, iButtonWorkerIdle);
|
||||
@@ -195,7 +200,7 @@ static int32_t ibutton_worker_thread(void* thread_context) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if(status == osErrorTimeout) {
|
||||
} else if(status == FuriStatusErrorTimeout) {
|
||||
ibutton_worker_modes[worker->mode_index].tick(worker);
|
||||
} else {
|
||||
furi_crash("iButton worker error");
|
||||
|
@@ -52,7 +52,7 @@ struct iButtonWorker {
|
||||
OneWireDevice* device;
|
||||
iButtonWriter* writer;
|
||||
iButtonWorkerMode mode_index;
|
||||
osMessageQueueId_t messages;
|
||||
FuriMessageQueue* messages;
|
||||
FuriThread* thread;
|
||||
|
||||
PulseDecoder* pulse_decoder;
|
||||
|
@@ -21,7 +21,7 @@ void ibutton_worker_mode_write_stop(iButtonWorker* worker);
|
||||
|
||||
const iButtonWorkerModeType ibutton_worker_modes[] = {
|
||||
{
|
||||
.quant = osWaitForever,
|
||||
.quant = FuriWaitForever,
|
||||
.start = ibutton_worker_mode_idle_start,
|
||||
.tick = ibutton_worker_mode_idle_tick,
|
||||
.stop = ibutton_worker_mode_idle_stop,
|
||||
@@ -86,7 +86,7 @@ bool ibutton_worker_read_comparator(iButtonWorker* worker) {
|
||||
furi_hal_rfid_comp_start();
|
||||
|
||||
// TODO: rework with thread events, "pulse_decoder_get_decoded_index_with_timeout"
|
||||
furi_hal_delay_ms(100);
|
||||
furi_delay_ms(100);
|
||||
int32_t decoded_index = pulse_decoder_get_decoded_index(worker->pulse_decoder);
|
||||
if(decoded_index >= 0) {
|
||||
pulse_decoder_get_data(
|
||||
@@ -121,7 +121,7 @@ bool ibutton_worker_read_comparator(iButtonWorker* worker) {
|
||||
bool ibutton_worker_read_dallas(iButtonWorker* worker) {
|
||||
bool result = false;
|
||||
onewire_host_start(worker->host);
|
||||
furi_hal_delay_ms(100);
|
||||
furi_delay_ms(100);
|
||||
FURI_CRITICAL_ENTER();
|
||||
if(onewire_host_search(worker->host, worker->key_data, NORMAL_SEARCH)) {
|
||||
onewire_host_reset_search(worker->host);
|
||||
|
@@ -11,13 +11,13 @@ struct iButtonWriter {
|
||||
|
||||
static void writer_write_one_bit(iButtonWriter* writer, bool value, uint32_t delay) {
|
||||
onewire_host_write_bit(writer->host, value);
|
||||
furi_hal_delay_us(delay);
|
||||
furi_delay_us(delay);
|
||||
}
|
||||
|
||||
static void writer_write_byte_ds1990(iButtonWriter* writer, uint8_t data) {
|
||||
for(uint8_t n_bit = 0; n_bit < 8; n_bit++) {
|
||||
onewire_host_write_bit(writer->host, data & 1);
|
||||
furi_hal_delay_us(5000);
|
||||
furi_delay_us(5000);
|
||||
data = data >> 1;
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ static bool writer_write_TM2004(iButtonWriter* writer, iButtonKey* key) {
|
||||
// TODO: check answer CRC
|
||||
|
||||
// pulse indicating that data is correct
|
||||
furi_hal_delay_us(600);
|
||||
furi_delay_us(600);
|
||||
writer_write_one_bit(writer, 1, 50000);
|
||||
|
||||
// read written key byte
|
||||
@@ -104,7 +104,7 @@ static bool writer_write_1990_1(iButtonWriter* writer, iButtonKey* key) {
|
||||
// unlock
|
||||
onewire_host_reset(writer->host);
|
||||
onewire_host_write(writer->host, RW1990_1_CMD_WRITE_RECORD_FLAG);
|
||||
furi_hal_delay_us(10);
|
||||
furi_delay_us(10);
|
||||
writer_write_one_bit(writer, 0, 5000);
|
||||
|
||||
// write key
|
||||
@@ -113,7 +113,7 @@ static bool writer_write_1990_1(iButtonWriter* writer, iButtonKey* key) {
|
||||
for(uint8_t i = 0; i < ibutton_key_get_data_size(key); i++) {
|
||||
// inverted key for RW1990.1
|
||||
writer_write_byte_ds1990(writer, ~ibutton_key_get_data_p(key)[i]);
|
||||
furi_hal_delay_us(30000);
|
||||
furi_delay_us(30000);
|
||||
}
|
||||
|
||||
// lock
|
||||
@@ -139,7 +139,7 @@ static bool writer_write_1990_2(iButtonWriter* writer, iButtonKey* key) {
|
||||
// unlock
|
||||
onewire_host_reset(writer->host);
|
||||
onewire_host_write(writer->host, RW1990_2_CMD_WRITE_RECORD_FLAG);
|
||||
furi_hal_delay_us(10);
|
||||
furi_delay_us(10);
|
||||
writer_write_one_bit(writer, 1, 5000);
|
||||
|
||||
// write key
|
||||
@@ -147,7 +147,7 @@ static bool writer_write_1990_2(iButtonWriter* writer, iButtonKey* key) {
|
||||
onewire_host_write(writer->host, RW1990_2_CMD_WRITE_ROM);
|
||||
for(uint8_t i = 0; i < ibutton_key_get_data_size(key); i++) {
|
||||
writer_write_byte_ds1990(writer, ibutton_key_get_data_p(key)[i]);
|
||||
furi_hal_delay_us(30000);
|
||||
furi_delay_us(30000);
|
||||
}
|
||||
|
||||
// lock
|
||||
@@ -191,7 +191,7 @@ static bool writer_write_TM01(
|
||||
//} else {
|
||||
for(uint8_t i = 0; i < key->get_type_data_size(); i++) {
|
||||
write_byte_ds1990(key->get_data()[i]);
|
||||
furi_hal_delay_us(10000);
|
||||
furi_delay_us(10000);
|
||||
}
|
||||
//}
|
||||
|
||||
@@ -271,9 +271,9 @@ void ibutton_writer_free(iButtonWriter* writer) {
|
||||
iButtonWriterResult ibutton_writer_write(iButtonWriter* writer, iButtonKey* key) {
|
||||
iButtonWriterResult result = iButtonWriterNoDetect;
|
||||
|
||||
osKernelLock();
|
||||
furi_kernel_lock();
|
||||
bool blank_present = onewire_host_reset(writer->host);
|
||||
osKernelUnlock();
|
||||
furi_kernel_unlock();
|
||||
|
||||
if(blank_present) {
|
||||
switch(ibutton_key_get_type(key)) {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#include "protocol_cyfral.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <furi/check.h>
|
||||
#include <furi_hal_delay.h>
|
||||
#include <furi.h>
|
||||
#include <furi_hal.h>
|
||||
|
||||
#define CYFRAL_DATA_SIZE 2
|
||||
#define CYFRAL_MAX_PERIOD_US 230
|
||||
@@ -104,7 +104,7 @@ static void cyfral_reset(void* context) {
|
||||
cyfral->nibble = 0;
|
||||
cyfral->data_valid = true;
|
||||
|
||||
cyfral->max_period = CYFRAL_MAX_PERIOD_US * furi_hal_delay_instructions_per_microsecond();
|
||||
cyfral->max_period = CYFRAL_MAX_PERIOD_US * furi_hal_cortex_instructions_per_microsecond();
|
||||
}
|
||||
|
||||
static bool cyfral_process_bit(
|
||||
|
@@ -1,8 +1,7 @@
|
||||
#include "protocol_metakom.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <furi/check.h>
|
||||
#include <furi_hal_delay.h>
|
||||
#include <core/check.h>
|
||||
|
||||
#define METAKOM_DATA_SIZE 4
|
||||
#define METAKOM_PERIOD_SAMPLE_COUNT 10
|
||||
|
@@ -31,23 +31,23 @@ bool onewire_host_reset(OneWireHost* host) {
|
||||
furi_hal_ibutton_pin_high();
|
||||
do {
|
||||
if(--retries == 0) return 0;
|
||||
furi_hal_delay_us(2);
|
||||
furi_delay_us(2);
|
||||
} while(!furi_hal_ibutton_pin_get_level());
|
||||
|
||||
// pre delay
|
||||
furi_hal_delay_us(OWH_RESET_DELAY_PRE);
|
||||
furi_delay_us(OWH_RESET_DELAY_PRE);
|
||||
|
||||
// drive low
|
||||
furi_hal_ibutton_pin_low();
|
||||
furi_hal_delay_us(OWH_RESET_DRIVE);
|
||||
furi_delay_us(OWH_RESET_DRIVE);
|
||||
|
||||
// release
|
||||
furi_hal_ibutton_pin_high();
|
||||
furi_hal_delay_us(OWH_RESET_RELEASE);
|
||||
furi_delay_us(OWH_RESET_RELEASE);
|
||||
|
||||
// read and post delay
|
||||
r = !furi_hal_ibutton_pin_get_level();
|
||||
furi_hal_delay_us(OWH_RESET_DELAY_POST);
|
||||
furi_delay_us(OWH_RESET_DELAY_POST);
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -58,15 +58,15 @@ bool onewire_host_read_bit(OneWireHost* host) {
|
||||
|
||||
// drive low
|
||||
furi_hal_ibutton_pin_low();
|
||||
furi_hal_delay_us(OWH_READ_DRIVE);
|
||||
furi_delay_us(OWH_READ_DRIVE);
|
||||
|
||||
// release
|
||||
furi_hal_ibutton_pin_high();
|
||||
furi_hal_delay_us(OWH_READ_RELEASE);
|
||||
furi_delay_us(OWH_READ_RELEASE);
|
||||
|
||||
// read and post delay
|
||||
result = furi_hal_ibutton_pin_get_level();
|
||||
furi_hal_delay_us(OWH_READ_DELAY_POST);
|
||||
furi_delay_us(OWH_READ_DELAY_POST);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -94,19 +94,19 @@ void onewire_host_write_bit(OneWireHost* host, bool value) {
|
||||
if(value) {
|
||||
// drive low
|
||||
furi_hal_ibutton_pin_low();
|
||||
furi_hal_delay_us(OWH_WRITE_1_DRIVE);
|
||||
furi_delay_us(OWH_WRITE_1_DRIVE);
|
||||
|
||||
// release
|
||||
furi_hal_ibutton_pin_high();
|
||||
furi_hal_delay_us(OWH_WRITE_1_RELEASE);
|
||||
furi_delay_us(OWH_WRITE_1_RELEASE);
|
||||
} else {
|
||||
// drive low
|
||||
furi_hal_ibutton_pin_low();
|
||||
furi_hal_delay_us(OWH_WRITE_0_DRIVE);
|
||||
furi_delay_us(OWH_WRITE_0_DRIVE);
|
||||
|
||||
// release
|
||||
furi_hal_ibutton_pin_high();
|
||||
furi_hal_delay_us(OWH_WRITE_0_RELEASE);
|
||||
furi_delay_us(OWH_WRITE_0_RELEASE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2,8 +2,7 @@
|
||||
#include "one_wire_slave_i.h"
|
||||
#include "one_wire_device.h"
|
||||
#include <furi.h>
|
||||
#include <furi_hal_delay.h>
|
||||
#include <furi_hal_ibutton.h>
|
||||
#include <furi_hal.h>
|
||||
|
||||
#define OWS_RESET_MIN 270
|
||||
#define OWS_RESET_MAX 960
|
||||
@@ -39,14 +38,14 @@ struct OneWireSlave {
|
||||
uint32_t onewire_slave_wait_while_gpio_is(OneWireSlave* bus, uint32_t time, const bool pin_value) {
|
||||
UNUSED(bus);
|
||||
uint32_t start = DWT->CYCCNT;
|
||||
uint32_t time_ticks = time * furi_hal_delay_instructions_per_microsecond();
|
||||
uint32_t time_ticks = time * furi_hal_cortex_instructions_per_microsecond();
|
||||
uint32_t time_captured;
|
||||
|
||||
do {
|
||||
time_captured = DWT->CYCCNT;
|
||||
if(furi_hal_ibutton_pin_get_level() != pin_value) {
|
||||
uint32_t remaining_time = time_ticks - (time_captured - start);
|
||||
remaining_time /= furi_hal_delay_instructions_per_microsecond();
|
||||
remaining_time /= furi_hal_cortex_instructions_per_microsecond();
|
||||
return remaining_time;
|
||||
}
|
||||
} while((time_captured - start) < time_ticks);
|
||||
@@ -60,7 +59,7 @@ bool onewire_slave_show_presence(OneWireSlave* bus) {
|
||||
|
||||
// show presence
|
||||
furi_hal_ibutton_pin_low();
|
||||
furi_hal_delay_us(OWS_PRESENCE_MIN);
|
||||
furi_delay_us(OWS_PRESENCE_MIN);
|
||||
furi_hal_ibutton_pin_high();
|
||||
|
||||
// somebody also can show presence
|
||||
@@ -127,7 +126,7 @@ bool onewire_slave_send_bit(OneWireSlave* bus, bool value) {
|
||||
}
|
||||
|
||||
// hold line for ZERO or ONE time
|
||||
furi_hal_delay_us(time);
|
||||
furi_delay_us(time);
|
||||
furi_hal_ibutton_pin_high();
|
||||
|
||||
return true;
|
||||
@@ -213,7 +212,7 @@ static void exti_cb(void* context) {
|
||||
|
||||
if(input_state) {
|
||||
uint32_t pulse_length =
|
||||
(DWT->CYCCNT - pulse_start) / furi_hal_delay_instructions_per_microsecond();
|
||||
(DWT->CYCCNT - pulse_start) / furi_hal_cortex_instructions_per_microsecond();
|
||||
if(pulse_length >= OWS_RESET_MIN) {
|
||||
if(pulse_length <= OWS_RESET_MAX) {
|
||||
// reset cycle ok
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include <stdlib.h>
|
||||
#include "pulse_decoder.h"
|
||||
#include <string.h>
|
||||
#include <furi/check.h>
|
||||
#include <core/check.h>
|
||||
|
||||
#define MAX_PROTOCOL 5
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "encoder.h"
|
||||
#include "math.h"
|
||||
#include <furi/check.h>
|
||||
#include <core/check.h>
|
||||
|
||||
#define TAG "SubGhzBlockEncoder"
|
||||
|
||||
@@ -42,4 +42,4 @@ size_t subghz_protocol_blocks_get_upload(
|
||||
upload[size_upload++] = level_duration_make(
|
||||
subghz_protocol_blocks_get_bit_array(data_array, index_bit - 1), duration);
|
||||
return size_upload;
|
||||
}
|
||||
}
|
||||
|
@@ -76,9 +76,8 @@ void subghz_encoder_princeton_for_testing_set(
|
||||
|
||||
instance->count_key = instance->count_key_package + 3;
|
||||
|
||||
if((furi_hal_get_tick() - instance->time_stop) < instance->timeout) {
|
||||
instance->time_stop =
|
||||
(instance->timeout - (furi_hal_get_tick() - instance->time_stop)) * 1000;
|
||||
if((furi_get_tick() - instance->time_stop) < instance->timeout) {
|
||||
instance->time_stop = (instance->timeout - (furi_get_tick() - instance->time_stop)) * 1000;
|
||||
} else {
|
||||
instance->time_stop = 0;
|
||||
}
|
||||
|
@@ -287,7 +287,7 @@ static bool subghz_protocol_encoder_raw_worker_init(SubGhzProtocolEncoderRAW* in
|
||||
if(subghz_file_encoder_worker_start(
|
||||
instance->file_worker_encoder, string_get_cstr(instance->file_name))) {
|
||||
//the worker needs a file in order to open and read part of the file
|
||||
osDelay(100);
|
||||
furi_delay_ms(100);
|
||||
instance->is_runing = true;
|
||||
} else {
|
||||
subghz_protocol_encoder_raw_stop(instance);
|
||||
|
@@ -153,19 +153,19 @@ static int32_t subghz_file_encoder_worker_thread(void* context) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
osDelay(5);
|
||||
furi_delay_ms(5);
|
||||
}
|
||||
//waiting for the end of the transfer
|
||||
FURI_LOG_I(TAG, "End read file");
|
||||
while(!furi_hal_subghz_is_async_tx_complete() && instance->worker_running) {
|
||||
osDelay(5);
|
||||
furi_delay_ms(5);
|
||||
}
|
||||
FURI_LOG_I(TAG, "End transmission");
|
||||
while(instance->worker_running) {
|
||||
if(instance->worker_stoping) {
|
||||
if(instance->callback_end) instance->callback_end(instance->context_end);
|
||||
}
|
||||
osDelay(50);
|
||||
furi_delay_ms(50);
|
||||
}
|
||||
flipper_format_file_close(instance->flipper_format);
|
||||
|
||||
|
@@ -68,11 +68,11 @@ bool subghz_tx_rx_worker_rx(SubGhzTxRxWorker* instance, uint8_t* data, uint8_t*
|
||||
if(instance->status != SubGhzTxRxWorkerStatusRx) {
|
||||
furi_hal_subghz_rx();
|
||||
instance->status = SubGhzTxRxWorkerStatusRx;
|
||||
osDelay(1);
|
||||
furi_delay_tick(1);
|
||||
}
|
||||
//waiting for reception to complete
|
||||
while(furi_hal_gpio_read(&gpio_cc1101_g0)) {
|
||||
osDelay(1);
|
||||
furi_delay_tick(1);
|
||||
if(!--timeout) {
|
||||
FURI_LOG_W(TAG, "RX cc1101_g0 timeout");
|
||||
furi_hal_subghz_flush_rx();
|
||||
@@ -106,14 +106,14 @@ void subghz_tx_rx_worker_tx(SubGhzTxRxWorker* instance, uint8_t* data, size_t si
|
||||
furi_hal_subghz_tx(); //start send
|
||||
instance->status = SubGhzTxRxWorkerStatusTx;
|
||||
while(!furi_hal_gpio_read(&gpio_cc1101_g0)) { // Wait for GDO0 to be set -> sync transmitted
|
||||
osDelay(1);
|
||||
furi_delay_tick(1);
|
||||
if(!--timeout) {
|
||||
FURI_LOG_W(TAG, "TX !cc1101_g0 timeout");
|
||||
break;
|
||||
}
|
||||
}
|
||||
while(furi_hal_gpio_read(&gpio_cc1101_g0)) { // Wait for GDO0 to be cleared -> end of packet
|
||||
osDelay(1);
|
||||
furi_delay_tick(1);
|
||||
if(!--timeout) {
|
||||
FURI_LOG_W(TAG, "TX cc1101_g0 timeout");
|
||||
break;
|
||||
@@ -189,7 +189,7 @@ static int32_t subghz_tx_rx_worker_thread(void* context) {
|
||||
}
|
||||
|
||||
if(timeout_tx) timeout_tx--;
|
||||
osDelay(1);
|
||||
furi_delay_tick(1);
|
||||
}
|
||||
|
||||
furi_hal_subghz_set_path(FuriHalSubGhzPathIsolate);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#include "stream.h"
|
||||
#include "stream_i.h"
|
||||
#include "file_stream.h"
|
||||
#include <furi/check.h>
|
||||
#include <furi/common_defines.h>
|
||||
#include <core/check.h>
|
||||
#include <core/common_defines.h>
|
||||
|
||||
void stream_free(Stream* stream) {
|
||||
furi_assert(stream);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "stream.h"
|
||||
#include "stream_i.h"
|
||||
#include "string_stream.h"
|
||||
#include <furi/common_defines.h>
|
||||
#include <core/common_defines.h>
|
||||
|
||||
typedef struct {
|
||||
Stream stream_base;
|
||||
|
@@ -213,7 +213,7 @@ static int archive_extract_foreach_cb(mtar_t* tar, const mtar_header_t* header,
|
||||
}
|
||||
FURI_LOG_W(TAG, "Failed to open '%s', reties: %d", string_get_cstr(fname), n_tries);
|
||||
storage_file_close(out_file);
|
||||
osDelay(FILE_OPEN_RETRY_DELAY);
|
||||
furi_delay_ms(FILE_OPEN_RETRY_DELAY);
|
||||
}
|
||||
|
||||
if(!storage_file_is_open(out_file)) {
|
||||
@@ -265,7 +265,7 @@ bool tar_archive_add_file(
|
||||
}
|
||||
FURI_LOG_W(TAG, "Failed to open '%s', reties: %d", fs_file_path, n_tries);
|
||||
storage_file_close(src_file);
|
||||
osDelay(FILE_OPEN_RETRY_DELAY);
|
||||
furi_delay_ms(FILE_OPEN_RETRY_DELAY);
|
||||
}
|
||||
|
||||
if(!storage_file_is_open(src_file) ||
|
||||
|
@@ -10,10 +10,10 @@ uint8_t u8g2_gpio_and_delay_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, vo
|
||||
/* HAL initialization contains all what we need so we can skip this part. */
|
||||
break;
|
||||
case U8X8_MSG_DELAY_MILLI:
|
||||
furi_hal_delay_ms(arg_int);
|
||||
furi_delay_ms(arg_int);
|
||||
break;
|
||||
case U8X8_MSG_DELAY_10MICRO:
|
||||
furi_hal_delay_us(10);
|
||||
furi_delay_us(10);
|
||||
break;
|
||||
case U8X8_MSG_DELAY_100NANO:
|
||||
asm("nop");
|
||||
|
Reference in New Issue
Block a user