From aa3e5c0c6f6f7bb9df02ae5d333dc6c4a6d2e744 Mon Sep 17 00:00:00 2001 From: JF Date: Wed, 22 Jan 2020 19:45:53 +0100 Subject: [WIP] Use IRQ in SPI driver to improve performances --- src/main.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 062a36e4..14be5ca2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -158,6 +158,20 @@ void OnNewTime(current_time_char_t* currentTime) { dayOfWeek, hour, minute, second, nrf_rtc_counter_get(portNRF_RTC_REG)); } +extern Pinetime::Drivers::SpiMaster* spiInstance; +void SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler(void) { + if(((NRF_SPIM0->INTENSET & (1<<6)) != 0) && NRF_SPIM0->EVENTS_END == 1) { + NRF_SPIM0->EVENTS_END = 0; + spiInstance->irq(); + } + + + if(((NRF_SPIM0->INTENSET & (1<<1)) != 0) && NRF_SPIM0->EVENTS_STOPPED == 1) { + NRF_SPIM0->EVENTS_STOPPED = 0; + } + + return; +} int main(void) { displayApp.reset(new Pinetime::Applications::DisplayApp(batteryController, bleController, dateTimeController)); logger.Init(); -- cgit v1.2.3-70-g09d2