I'm trying to get the most performance per mA out of my nRF52, for test purposes I've used the nrfx libraries to communicate to the peripherals but I want to make my own.
I’ve successfully created a TWI driver using the HAL library direct register modification. (600ish bytes compared to the 4k optimized nrfx library)
The issue I have now is that I check using a while loop if the transmission is done.
I want to implement interrupts but this seems to be harder than I thought.
I’ve tried to enable interrupts on specific events like error and stop.
nrf_twim_int_enable(p_twim, NRF_TWIM_INT_STOPPED_MASK | NRF_TWIM_INT_ERROR_MASK);
NRFX_IRQ_PRIORITY_SET(SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn, 2);
NRFX_IRQ_ENABLE(SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn);
I’ve also created a function to be called when the interrupt fires.
#define TWIM0_HANDLER SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler
Yet, whatever I try I cannot get the interrupt to work and I cannot get more information in example projects due to lots of nested functions and structures.
Is it possible to show me a example how to setup the handler properly without the use of higher level libraries other than the HAL?
Kind Regards