3 ms·
Due to all the medical scans I've had done, I can confidently say that my heart is in perfect health other than the nerves being flaky. The pacemaker is a nearl
by sgtnoodle 6y ago
Due to all the medical scans I've had done, I can confidently say that my heart is in perfect health other than the nerves being flaky. The pacemaker is a nearly flawless replacement, but it has its technical limitations. It's been very handy to see what's going on when my heart is beating funny.
Here's the relevant section. I was getting pretty fed up with battling the ESP32, so it's probably not the prettiest.
http://sgtnoodle.com/files/adc_snippet.txt http://sgtnoodle.com/files/adc_snippet.txt
The function runs as an RTOS task, woken up once every millisecond by a timer. I also pinned it to one of the two CPUs because I was originally doing software triggered sampling at 8Khz. The timer and pinning is rather overkill since I2S clocks the sampling and has tons of buffer.
In an effort to get better data, I have the I2S sample at 40Khz. The function copies the samples out the I2S buffers, and down-samples to 8Khz. The 8Kz samples are pushed into a circular buffer that uses a std::atomic head pointer to make it thread safex.
- elcritch 6y agoThanks! I'll take a look at it and try and port it over. Hopefully it'll help some other poor souls (possibly myself) who have to deal with the same issues.