Okay, here it is

This is just int32_t data in and two int32_t out, like this:

```
CORDIC->WDATA = input_q31_sin;
cordic_sine = CORDIC->RDATA;
cordic_cosine = CORDIC->RDATA;
```

This is fast, but the math.h lib is heavy

```
radian: 0.48
elapsed_ticks: 29
Cordic_sine: 990459904.00
Cordic_cosine: 1905432576.00
```

Lets convert those with this:

```
#define q31_to_f32(x) ldexp((int32_t) x, -31)
float converted_cordic_sine = 0.0f;
float converted_cordic_cosine = 0.0f;
...
converted_cordic_sine = q31_to_f32(cordic_sine);
converted_cordic_cosine = q31_to_f32(cordic_cosine);
```

Hurray! SimpleFOC is faster

```
elapsed_ticks: 957
Cordic_sine: 990459904.00
Cordic_cosine: 1905432576.00
converted_Cordic_sine: 0.46
converted_Cordic_cosine: 0.89
```

Lets try to run 2 cycles and not 6…

```
elapsed_ticks: 953
Cordic_sine: 994251008.00
Cordic_cosine: 1903432192.00
converted_Cordic_sine: 0.46
converted_Cordic_cosine: 0.89
```

Lets try a different approach. Above conversion was taken from the ST video series (PART2) on the CORDIC. This should convert the int32_t to float (f32) as described here.

```
value_f32_sine = (float)cordic_sine/(float)0x8000000;
value_f32_cosine = (float)cordic_cosine/(float)0x8000000;
```

Muy muy better…

```
elapsed_ticks: 29
Cordic_sine: 994251008.00
Cordic_cosine: 1903432192.00
converted_Cordic_sine: 7.41
converted_Cordic_cosine: 14.18
```

So how can we convert the f32 format to something usable by SFOC?

Hmmm… another 0 and this is what I get:

```
elapsed_ticks: 29
Cordic_sine: 994251008.00
Cordic_cosine: 1903432192.00
converted_Cordic_sine: 0.46
converted_Cordic_cosine: 0.89
```

Weird how that conversion takes 0 SysTick´s?

Bumped the CORDIC back to 6 cycles:

```
elapsed_ticks: 33
Cordic_sine: 990459904.00
Cordic_cosine: 1905432576.00
converted_Cordic_sine: 0.46
converted_Cordic_cosine: 0.89
```

I love how they call it a co-processor