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.
Dependencies: mbed-dev-f303 FastPWM3
FastMath/FastMath.cpp@52:15a8de8af562, 2019-08-04 (annotated)
- Committer:
- Rushu
- Date:
- Sun Aug 04 12:12:20 2019 +0000
- Revision:
- 52:15a8de8af562
- Parent:
- 20:bf9ea5125d52
serial 115200, current I is limited by user, and weak current is controled.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| benkatz | 0:4e1c4df6aabd | 1 | #include "FastMath.h" |
| benkatz | 0:4e1c4df6aabd | 2 | #include "LUT.h" |
| benkatz | 0:4e1c4df6aabd | 3 | |
| benkatz | 0:4e1c4df6aabd | 4 | const float Multiplier = 81.4873308631f; |
| benkatz | 0:4e1c4df6aabd | 5 | |
| benkatz | 0:4e1c4df6aabd | 6 | float FastMath::FastSin(float theta){ |
| benkatz | 20:bf9ea5125d52 | 7 | while (theta < 0.0f) theta += 6.28318530718f; |
| benkatz | 20:bf9ea5125d52 | 8 | while (theta >= 6.28318530718f) theta -= 6.28318530718f; |
| benkatz | 0:4e1c4df6aabd | 9 | return SinTable[(int) (Multiplier*theta)] ; |
| benkatz | 0:4e1c4df6aabd | 10 | } |
| benkatz | 0:4e1c4df6aabd | 11 | |
| benkatz | 0:4e1c4df6aabd | 12 | float FastMath::FastCos(float theta){ |
| benkatz | 0:4e1c4df6aabd | 13 | return FastSin(1.57079632679f - theta); |
| benkatz | 0:4e1c4df6aabd | 14 | } |