test: platform: mic_test: reformat code to new coding style

This commit is contained in:
Silvano Seva 2025-09-12 16:23:34 +02:00
parent d18905aeb4
commit b2e289e6fd
2 changed files with 14 additions and 12 deletions

View File

@ -84,6 +84,7 @@ platform/drivers/USB/usb.h
platform/targets/GDx/hwconfig.h platform/targets/GDx/hwconfig.h
platform/targets/linux/emulator/sdl_engine.h platform/targets/linux/emulator/sdl_engine.h
platform/targets/ttwrplus/pmu.h platform/targets/ttwrplus/pmu.h
tests/platform/mic_test.c
EOF EOF
) )

View File

@ -35,11 +35,12 @@ int main()
dsp_resetFilterState(&dcrState); dsp_resetFilterState(&dcrState);
static const size_t numSamples = 45 * 1024; // 90kB static const size_t numSamples = 45 * 1024; // 90kB
stream_sample_t *sampleBuf = ((stream_sample_t *) malloc(numSamples * void *sampleBuf = malloc(numSamples * sizeof(stream_sample_t));
sizeof(stream_sample_t)));
pathId pi = audioPath_request(SOURCE_MIC, SINK_MCU, PRIO_TX); pathId pi = audioPath_request(SOURCE_MIC, SINK_MCU, PRIO_TX);
streamId id = audioStream_start(pi, sampleBuf, numSamples, 8000, BUF_LINEAR | STREAM_INPUT); streamId id = audioStream_start(pi, (stream_sample_t *)sampleBuf,
numSamples, 8000,
BUF_LINEAR | STREAM_INPUT);
sleepFor(3u, 0u); sleepFor(3u, 0u);
platform_ledOn(GREEN); platform_ledOn(GREEN);
@ -51,22 +52,22 @@ int main()
sleepFor(10u, 0u); sleepFor(10u, 0u);
// Pre-processing gain // Pre-processing gain
for(size_t i = 0; i < audio.len; i++) audio.data[i] <<= 3; for (size_t i = 0; i < audio.len; i++)
audio.data[i] <<= 3;
// DC removal // DC removal
dsp_dcRemoval(&dcrState, audio.data, audio.len); dsp_dcRemoval(&dcrState, audio.data, audio.len);
// Post-processing gain // Post-processing gain
for(size_t i = 0; i < audio.len; i++) audio.data[i] *= 10; for (size_t i = 0; i < audio.len; i++)
audio.data[i] *= 10;
uint16_t *ptr = ((uint16_t *)audio.data); uint16_t *ptr = ((uint16_t *)audio.data);
for (size_t i = 0; i < audio.len; i++) for (size_t i = 0; i < audio.len; i++)
{
iprintf("%04x ", ptr[i]); iprintf("%04x ", ptr[i]);
}
while(1) ; while (1)
;
return 0; return 0;
} }