Skip to content

Commit be1e805

Browse files
bcostm0xc0170
authored andcommitted
NUCLEO_WB55RG: add WB Cube files reused for BLE transport layer
1 parent 2b257fa commit be1e805

File tree

19 files changed

+3993
-0
lines changed

19 files changed

+3993
-0
lines changed
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/**
2+
******************************************************************************
3+
* File Name : app_common.h
4+
* Description : App Common application configuration file for BLE
5+
* middleWare.
6+
******************************************************************************
7+
* @attention
8+
*
9+
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
10+
* All rights reserved.</center></h2>
11+
*
12+
* This software component is licensed by ST under Ultimate Liberty license
13+
* SLA0044, the "License"; You may not use this file except in compliance with
14+
* the License. You may obtain a copy of the License at:
15+
* www.st.com/SLA0044
16+
*
17+
******************************************************************************
18+
*/
19+
20+
/* Define to prevent recursive inclusion -------------------------------------*/
21+
#ifndef APP_COMMON_H
22+
#define APP_COMMON_H
23+
24+
#ifdef __cplusplus
25+
extern "C"{
26+
#endif
27+
28+
#include <stdint.h>
29+
#include <string.h>
30+
#include <stdio.h>
31+
#include <stdlib.h>
32+
#include <stdarg.h>
33+
34+
#include "app_conf.h"
35+
36+
/* -------------------------------- *
37+
* Basic definitions *
38+
* -------------------------------- */
39+
40+
#undef NULL
41+
#define NULL 0
42+
43+
#undef FALSE
44+
#define FALSE 0
45+
46+
#undef TRUE
47+
#define TRUE (!0)
48+
49+
/* -------------------------------- *
50+
* Critical Section definition *
51+
* -------------------------------- */
52+
#define BACKUP_PRIMASK() uint32_t primask_bit= __get_PRIMASK()
53+
#define DISABLE_IRQ() __disable_irq()
54+
#define RESTORE_PRIMASK() __set_PRIMASK(primask_bit)
55+
56+
/* -------------------------------- *
57+
* Macro delimiters *
58+
* -------------------------------- */
59+
60+
#define M_BEGIN do {
61+
62+
#define M_END } while(0)
63+
64+
/* -------------------------------- *
65+
* Some useful macro definitions *
66+
* -------------------------------- */
67+
68+
#define MAX( x, y ) (((x)>(y))?(x):(y))
69+
70+
#define MIN( x, y ) (((x)<(y))?(x):(y))
71+
72+
#define MODINC( a, m ) M_BEGIN (a)++; if ((a)>=(m)) (a)=0; M_END
73+
74+
#define MODDEC( a, m ) M_BEGIN if ((a)==0) (a)=(m); (a)--; M_END
75+
76+
#define MODADD( a, b, m ) M_BEGIN (a)+=(b); if ((a)>=(m)) (a)-=(m); M_END
77+
78+
#define MODSUB( a, b, m ) MODADD( a, (m)-(b), m )
79+
80+
#define PAUSE( t ) M_BEGIN \
81+
__IO int _i; \
82+
for ( _i = t; _i > 0; _i -- ); \
83+
M_END
84+
85+
#define DIVF( x, y ) ((x)/(y))
86+
87+
#define DIVC( x, y ) (((x)+(y)-1)/(y))
88+
89+
#define DIVR( x, y ) (((x)+((y)/2))/(y))
90+
91+
#define SHRR( x, n ) ((((x)>>((n)-1))+1)>>1)
92+
93+
#define BITN( w, n ) (((w)[(n)/32] >> ((n)%32)) & 1)
94+
95+
#define BITNSET( w, n, b ) M_BEGIN (w)[(n)/32] |= ((U32)(b))<<((n)%32); M_END
96+
97+
/* -------------------------------- *
98+
* Compiler *
99+
* -------------------------------- */
100+
#define PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__)))
101+
102+
#ifdef WIN32
103+
#define ALIGN(n)
104+
#else
105+
#define ALIGN(n) __attribute__((aligned(n)))
106+
#endif
107+
108+
#ifdef __cplusplus
109+
} /* extern "C" */
110+
#endif
111+
112+
#endif /*APP_COMMON_H */
113+
114+
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

0 commit comments

Comments
 (0)