AnsweredAssumed Answered

Unused return value causes warning

Question asked by Ray Hall on Jun 13, 2013
Latest reply on Jun 13, 2013 by Ray Hall

I am converting code from a Atmel AVR project into S12XE. I am getting warnings that relate to return values not being used. What is the work around for this.


This is typical of the items that are causing the warnings SpiWriteRead(AT45DB041B_CMD_STATUS_REGISTER_READ);


Below is the offending code.




//----------------------------- SPI Write ----------------------------------

void SpiWrite(uint8_t data)

  while (!SPI0SR_SPTEF);   /* Wait for empty data register */    


  SPI0DRL = data;      // initiate write              




//-------------------------------- SPI Read -------------------------------------

uint8_t SpiRead(void) {


   while ((SPI0SR & SPI0SR_SPIF_MASK));  /* Wait for data in the receive buffer */


   return(SPI0DRL);     /* Return received data */      




//---------------------------- SPI Write Read ------------------------------

uint8_t SpiWriteRead(uint8_t data)


  uint8_t rxdat;



  rxdat = SpiRead();





//---------------------------------------------- AT45DB Get Status --------------------------------------------------

uint8_t at45db041b_get_status(void)


   uint8_t data;

    // Select serial Flash




    // Send command




    // Read status

    data = SpiWriteRead(0x00);



    // Deselect serial Flash




    return data;