Convert Digital and Analog values to dB SPL
The INMP510 microphone sensitivity is -38 dBV with a sound pressure level of 94 dB at 1 kHz. -38 dBV is 12.6 mV RMS. So if you measure 12.6 mV RMS then your SPL is 94 dB. If you measured twice that voltage then your SPL will be 6 dB higher. If you measured half the voltage your SPL would be 6 dB lower.

Do you know how the decibel works with rising and falling signals?

For the digital microphone, it has a specification of -26 dBFS for the same 94 dB SPL. FS refers to full scale and full scale appears to be 18 bits if you read the small print. So the RMS value it would produce is 26 dB down on a full scale of 18 bits but remember this is likely to be peak to peak. In other words a full scale signal would be +/- 131072 counts.

So, what do you do with the stream of digital numbers after conversion? First you subtract the midpoint because that is the mean numerical value and represents a large dc offset that ruins the calculation. So now you are dealing in signed integers. To calculate RMS (because that's what you need to do), square each value, accumulate many values then divide by the number of values you accumulated. Finally take the square root and that gives you RMS. 

However, make sure you accumulate enough samples or there will be an error term. The alternative is to try and be clever and calculate just as many samples as you need to cover one period of the sound source frequency.

Take note - once you have signed integers, the sign becomes unimportant because of the operation of squaring.

Can you take it from here?