mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-27 23:10:22 +00:00
68a3f6b4b7
* Add F5 target, lp5562 driver and api-hal-light. Update api-usage, switch to F5 by default. * API HAL: add i2c and hardware version api. Dolphin: show hardware version. * OTP version generator and flashing utility. * Assets script: fix code formatting * Backport F5 changes to F4 * F4: disable insomnia, prevent damage to BLE RX path * F5 HAL API Light: remove magic delay to fix magic BLE * Dolphin: HW target validation on start * invert RSSI indication in sub-1 * API HAL: rename board to body in version api * Gpio tester: detach and release viewport on exit Co-authored-by: aanper <mail@s3f.ru>
119 lines
3.3 KiB
C
119 lines
3.3 KiB
C
/* USER CODE BEGIN Header */
|
|
/**
|
|
******************************************************************************
|
|
* File Name : app_common.h
|
|
* Description : App Common application configuration file for STM32WPAN Middleware.
|
|
*
|
|
******************************************************************************
|
|
* @attention
|
|
*
|
|
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
|
* All rights reserved.</center></h2>
|
|
*
|
|
* This software component is licensed by ST under Ultimate Liberty license
|
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
|
* the License. You may obtain a copy of the License at:
|
|
* www.st.com/SLA0044
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
/* USER CODE END Header */
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
#ifndef APP_COMMON_H
|
|
#define APP_COMMON_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"{
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdarg.h>
|
|
|
|
#include "app_conf.h"
|
|
|
|
/* -------------------------------- *
|
|
* Basic definitions *
|
|
* -------------------------------- */
|
|
|
|
#undef NULL
|
|
#define NULL 0
|
|
|
|
#undef FALSE
|
|
#define FALSE 0
|
|
|
|
#undef TRUE
|
|
#define TRUE (!0)
|
|
|
|
/* -------------------------------- *
|
|
* Critical Section definition *
|
|
* -------------------------------- */
|
|
#define BACKUP_PRIMASK() uint32_t primask_bit= __get_PRIMASK()
|
|
#define DISABLE_IRQ() __disable_irq()
|
|
#define RESTORE_PRIMASK() __set_PRIMASK(primask_bit)
|
|
|
|
/* -------------------------------- *
|
|
* Macro delimiters *
|
|
* -------------------------------- */
|
|
|
|
#define M_BEGIN do {
|
|
|
|
#define M_END } while(0)
|
|
|
|
/* -------------------------------- *
|
|
* Some useful macro definitions *
|
|
* -------------------------------- */
|
|
|
|
#ifndef MAX
|
|
#define MAX( x, y ) (((x)>(y))?(x):(y))
|
|
#endif
|
|
|
|
#ifndef MIN
|
|
#define MIN( x, y ) (((x)<(y))?(x):(y))
|
|
#endif
|
|
|
|
#define MODINC( a, m ) M_BEGIN (a)++; if ((a)>=(m)) (a)=0; M_END
|
|
|
|
#define MODDEC( a, m ) M_BEGIN if ((a)==0) (a)=(m); (a)--; M_END
|
|
|
|
#define MODADD( a, b, m ) M_BEGIN (a)+=(b); if ((a)>=(m)) (a)-=(m); M_END
|
|
|
|
#define MODSUB( a, b, m ) MODADD( a, (m)-(b), m )
|
|
|
|
#define PAUSE( t ) M_BEGIN \
|
|
__IO int _i; \
|
|
for ( _i = t; _i > 0; _i -- ); \
|
|
M_END
|
|
|
|
#define DIVF( x, y ) ((x)/(y))
|
|
|
|
#define DIVC( x, y ) (((x)+(y)-1)/(y))
|
|
|
|
#define DIVR( x, y ) (((x)+((y)/2))/(y))
|
|
|
|
#define SHRR( x, n ) ((((x)>>((n)-1))+1)>>1)
|
|
|
|
#define BITN( w, n ) (((w)[(n)/32] >> ((n)%32)) & 1)
|
|
|
|
#define BITNSET( w, n, b ) M_BEGIN (w)[(n)/32] |= ((U32)(b))<<((n)%32); M_END
|
|
|
|
/* -------------------------------- *
|
|
* Compiler *
|
|
* -------------------------------- */
|
|
#define PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__)))
|
|
|
|
#ifdef WIN32
|
|
#define ALIGN(n)
|
|
#else
|
|
#define ALIGN(n) __attribute__((aligned(n)))
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
} /* extern "C" */
|
|
#endif
|
|
|
|
#endif /*APP_COMMON_H */
|
|
|
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|