Hi i got following code:
with sendBuffer and sendBufferPos beeing class members:Code:void STM32SPI::handleInterrupt() { if (SPI_I2S_GetITStatus(spiport, SPI_I2S_IT_TXE) == SET) { if (sendBufferPos != sendBuffer.end()) { SPI_I2S_SendData(spiport, *sendBufferPos); sendBufferPos++; } else { enableInterrupt(false); sendBuffer.clear(); } } if (SPI_I2S_GetITStatus(spiport, SPI_I2S_IT_RXNE) == SET) { receiveBuffer.push_back((u8) SPI_I2S_ReceiveData(spiport)); } } void STM32SPI::send() { sendBufferPos == sendBuffer.begin(); enableInterrupt(); }
i am trying to do this:Code:class STM32SPI{ vector<u8>::iterator sendBufferPos; vector<u8> sendBuffer; }
after calling send the iterator is set to the begin of the vector and the interrupt is enabled, now everytime the interrupt handler is called, the iterator *should* move to
the next position till end(). but it doesnt. sendBufferPos != sendBuffer.end() is never true.
I am not touching the vector, so the iterator should not be invalidated as far as i know.
P.S.
the code is running on a microprocessor


