Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
FastAtan2.h@0:88345d07348b, 2016-06-14 (annotated)
- Committer:
- Cotzo
- Date:
- Tue Jun 14 17:02:30 2016 +0000
- Revision:
- 0:88345d07348b
- Child:
- 1:9110a3da84c9
Initial commit library
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Cotzo | 0:88345d07348b | 1 | /* |
| Cotzo | 0:88345d07348b | 2 | * MathFunc.h |
| Cotzo | 0:88345d07348b | 3 | * |
| Cotzo | 0:88345d07348b | 4 | * Created on: 22 de may. de 2016 |
| Cotzo | 0:88345d07348b | 5 | * Author: Fede Pinna |
| Cotzo | 0:88345d07348b | 6 | */ |
| Cotzo | 0:88345d07348b | 7 | #include "mbed.h" |
| Cotzo | 0:88345d07348b | 8 | |
| Cotzo | 0:88345d07348b | 9 | #ifndef FASTATAN_H_ |
| Cotzo | 0:88345d07348b | 10 | #define FASTATAN_H_ |
| Cotzo | 0:88345d07348b | 11 | |
| Cotzo | 0:88345d07348b | 12 | #define QFORMAT 15 |
| Cotzo | 0:88345d07348b | 13 | #define PI_Q15 0x19220 // Pi fp16 |
| Cotzo | 0:88345d07348b | 14 | #define PI2_Q15 0xC910 // Pi/2 fp16 |
| Cotzo | 0:88345d07348b | 15 | #define PI4_Q15 0x6488// Pi/4 fp16 |
| Cotzo | 0:88345d07348b | 16 | #define PIx2_Q15 0x32440 |
| Cotzo | 0:88345d07348b | 17 | #define C1 0x1F52 // constante c1 = 0.2447 |
| Cotzo | 0:88345d07348b | 18 | #define C2 0x819 // constante c2 = 0.0663 |
| Cotzo | 0:88345d07348b | 19 | |
| Cotzo | 0:88345d07348b | 20 | #define FSUBI(a,b,q) ((a)-((b)<<(q))) |
| Cotzo | 0:88345d07348b | 21 | #define FMUL(a,b,q) (((a)*(b))>>(q)) |
| Cotzo | 0:88345d07348b | 22 | |
| Cotzo | 0:88345d07348b | 23 | #define TOFIX(d,q) ((int32_t)( (d)*(float)(1<<(q)) )) |
| Cotzo | 0:88345d07348b | 24 | #define TOFLT(a,q) ((float)(a)/(float)(1<<(q))) |
| Cotzo | 0:88345d07348b | 25 | #define RAD_Q15_TODEG(rad) ((rad*57)+0x25DC) |
| Cotzo | 0:88345d07348b | 26 | |
| Cotzo | 0:88345d07348b | 27 | |
| Cotzo | 0:88345d07348b | 28 | int32_t atan_q15(uint32_t x,uint32_t y); |
| Cotzo | 0:88345d07348b | 29 | int32_t atan2_q15(int32_t x,int32_t y); |
| Cotzo | 0:88345d07348b | 30 | |
| Cotzo | 0:88345d07348b | 31 | |
| Cotzo | 0:88345d07348b | 32 | #endif /* FASTATAN_H_ */ |