Python can block the light sensor
A code like this:
import os
while True: print(os.read_battery())
Leads to a log like this:
4.15646
4.15646
4.15646
4.15646
4.15646
4.152076
4.15646
4.152076
4.15646
4.15646
4.15646
[ 419615] hwlock: Lock 1 is busy.
4.15646
4.15646
4.15646
4.15646
4.15646
4.15646
4.15646
4.15646
4.152076
4.15646
4.15646
4.15646
4.15646
4.15646
4.15646
4.15646
[ 419715] hwlock: Lock 1 is busy.
4.15646
4.15646
4.15646
4.15646
4.15646
4.15646
4.152076
4.15646
4.15646
4.15646
4.15646
4.15646
Code is like this:
static void readAdcCallback()
{
if (hwlock_acquire(HWLOCK_ADC, 0) != 0) {
/* Can't do much about this here ... Retry next time */
return;
}
ADC_StartConvert(ADC_CH_7, 0, 0);
ADC_GetData(&last_value);
hwlock_release(HWLOCK_ADC);
}
I guess we should give the lock a bit of time to acquire.