Improved thread syncronisation

Use a semaphore to wake up nap exti thread - This fixes a race condition where the interrupt could happen before the thread went to sleep and then gone unprocessed.
Use a mutex to lock the SPI bus - This fixes a priority inversion problem which left nap interrupts unserviced for long period.