void InitiateRefresh (void)
{
RAMpnt=&cMatrix[0][1];
cRowCount=0;
//Initiate the transmission by writing the first byte
//The rest get sent in assembler
PRT0DR |= FLM;
cByteCount=4;
//Update the display here
//Display();
SPIM_1_SendTxData(cMatrix[0][0]);
}
void RefreshMatrix (void)
{
if (cStatus & LP_DONE)
{
cStatus &= ~LP_DONE;
if (cRowCount<23)
{
cRowCount++;
RAMpnt=&cMatrix[cRowCount][1];
cByteCount=4;
//Sending four more bytes
SPIM_1_SendTxData(cMatrix[cRowCount][0]);
//Send first byte
}
else {
InitiateRefresh();
//Only update here
}
//Only get here every 1 ms
//So can use as basis of ms timer
if (cFlashCount!=0)
{
cFlashCount--;
}
if (cYellowCount!=0)
{
cYellowCount--;
}
if (cCount!=0)
{
cCount--;
}
}
}