Home | Installation | Getting Started | CMSIS-DSP
---
Nimphea includes a comprehensive wrapper for ARM's CMSIS-DSP library, providing hardware-accelerated math functions optimized for the Cortex-M7 processor.
All CMSIS functions are designed to be real-time safe (no heap allocations).
import nimphea/cmsis/dsp_fastmath let s = fastSin(PI / 2.0) let root = fastSqrt(16.0)
import nimphea/cmsis/dsp_basic var v1 = [1.0'f32, 2.0, 3.0, 4.0] var v2 = [10.0'f32, 20.0, 30.0, 40.0] var res: array[4, float32] add(res, v1, v2) # res = [11, 22, 33, 44]
Filters use compile-time sizing for maximum efficiency.
import nimphea/cmsis/dsp_filtering const coeffs: array[3, float32] = [0.5, 0.5, 0.5] var filter: FirFilter[3, 48] # 3 taps, max block size 48 filter.init(addr coeffs[0]) proc audioCallback(input, output: AudioBuffer, size: int) {.cdecl.} = filter.process(input[0], output[0])
import nimphea/cmsis/dsp_transforms var fft: FftInstance[256] # 256-point complex FFT fft.init() var data: array[512, float32] # Interleaved [re, im, re, im, ...] fft.forward(data) # In-place FFT