started work on interrupts for spi

master
polymurph 2 years ago
parent b6bbacfffa
commit 5e4725ef7b

@ -65,6 +65,23 @@ typedef enum {
TIM17_COMMUNICATION, TIM17_COMMUNICATION,
TIM17_CAPTURECOMPARE_1, TIM17_CAPTURECOMPARE_1,
TIM17_UPDATE, TIM17_UPDATE,
SPI1_TX_FIFO_EMPTY,
SPI1_TX_FIFO_1_4,
SPI1_TX_FIFO_1_2,
SPI1_TX_FIFO_FULL,
SPI1_RX_FIFO_EMPTY,
SPI1_RX_FIFO_1_4,
SPI1_RX_FIFO_1_2,
SPI1_RX_FIFO_FULL,
SPI1_FRAME_FORMAT_ERROR,
SPI1_BUSY,
SPI1_OVERRUN,
SPI1_MODE_FAULT,
SPI1_CRC_ERROR,
SPI1_UNDERRUN,
SPI1_CHANNEL_SIDE,
SPI1_TX_BUFFER_EMPTY,
SPI1_RX_BUFFER_NOT_EMPTY,
intTypeEND intTypeEND
}intrType_t; }intrType_t;

@ -53,7 +53,24 @@ const uint8_t interruptTypeIndexList[intTypeEND] =
TIM17_IRQn, TIM17_IRQn,
TIM17_IRQn, TIM17_IRQn,
TIM17_IRQn, TIM17_IRQn,
TIM17_IRQn TIM17_IRQn,
SPI1_IRQn,
SPI1_IRQn,
SPI1_IRQn,
SPI1_IRQn,
SPI1_IRQn,
SPI1_IRQn,
SPI1_IRQn,
SPI1_IRQn,
SPI1_IRQn,
SPI1_IRQn,
SPI1_IRQn,
SPI1_IRQn,
SPI1_IRQn,
SPI1_IRQn,
SPI1_IRQn,
SPI1_IRQn,
SPI1_IRQn
}; };
void intInit( void intInit(

@ -1,5 +1,7 @@
#include "spi.h" #include "spi.h"
#include "hardwareDescription.h" #include "hardwareDescription.h"
#include "hwd_spi.h"
#include "interrupt.h"
#define SPI_BASE ((SPI_TypeDef *)spiBase_Addr_List[spi_hw_ch]) #define SPI_BASE ((SPI_TypeDef *)spiBase_Addr_List[spi_hw_ch])
@ -145,3 +147,15 @@ uint8_t spiTrx8BitPolling(spiCH_t spi_hw_ch, uint8_t tx_data)
return *(uint8_t*)&(SPI_BASE->DR); return *(uint8_t*)&(SPI_BASE->DR);
} }
// Interrupt Service Routines
void SPI1_IRQHandle()
{
//HANDLE_INT_FLAG(SPI1->SR, );
}
void SPI2_IRQHandle()
{
}

@ -5,12 +5,6 @@
#define BASE ((TIM_TypeDef *)timerBase_Addr_List[timer]) #define BASE ((TIM_TypeDef *)timerBase_Addr_List[timer])
// debug notes: the makro works. what seems to not work is the indexing and calling the handler! // debug notes: the makro works. what seems to not work is the indexing and calling the handler!
#define HANDLE_INT_FLAG(flagReg, flagMask, intType)\
do {if ((flagReg) & (flagMask)) {\
(flagReg) &= ~(flagMask);\
if(intHandlerArray[(intType)] == NULL) continue;\
intHandlerArray[(intType)]();\
}} while (0)
static const uint32_t DIER_list[TIM16_UPDATE - TIM1_BREAK] = { static const uint32_t DIER_list[TIM16_UPDATE - TIM1_BREAK] = {
TIM_DIER_BIE,// timer 1 TIM_DIER_BIE,// timer 1

@ -24,6 +24,14 @@ extern "C" {
#include <stdlib.h> #include <stdlib.h>
#include "hwd_interrupt.h" #include "hwd_interrupt.h"
#define HANDLE_INT_FLAG(flagReg, flagMask, intType)\
do {if ((flagReg) & (flagMask)) {\
(flagReg) &= ~(flagMask);\
if(intHandlerArray[(intType)] == NULL) continue;\
intHandlerArray[(intType)]();\
}} while (0)
/*! interrupt callback type for the handler */ /*! interrupt callback type for the handler */
typedef void (*intHandler_t)(void); typedef void (*intHandler_t)(void);
//void (*intHandlerArray[intTypeEND])()={NULL}; //void (*intHandlerArray[intTypeEND])()={NULL};

Loading…
Cancel
Save