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
- Committer:
- Cotzo
- Date:
- 2016-06-14
- Revision:
- 0:88345d07348b
- Child:
- 1:9110a3da84c9
File content as of revision 0:88345d07348b:
/*
* MathFunc.h
*
* Created on: 22 de may. de 2016
* Author: Fede Pinna
*/
#include "mbed.h"
#ifndef FASTATAN_H_
#define FASTATAN_H_
#define QFORMAT 15
#define PI_Q15 0x19220 // Pi fp16
#define PI2_Q15 0xC910 // Pi/2 fp16
#define PI4_Q15 0x6488// Pi/4 fp16
#define PIx2_Q15 0x32440
#define C1 0x1F52 // constante c1 = 0.2447
#define C2 0x819 // constante c2 = 0.0663
#define FSUBI(a,b,q) ((a)-((b)<<(q)))
#define FMUL(a,b,q) (((a)*(b))>>(q))
#define TOFIX(d,q) ((int32_t)( (d)*(float)(1<<(q)) ))
#define TOFLT(a,q) ((float)(a)/(float)(1<<(q)))
#define RAD_Q15_TODEG(rad) ((rad*57)+0x25DC)
int32_t atan_q15(uint32_t x,uint32_t y);
int32_t atan2_q15(int32_t x,int32_t y);
#endif /* FASTATAN_H_ */