This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Change from char array to int array R/W nvram over spi

I am having a problem with get and set nvram over a spi bus. The set function shown below has always worked with "Char array" and "int" types, but will not work with "int array'.

Thanks in advance for any help.



Call;

NewPreheatMinutes[3]

NVRAM_GetVariable(NVRAM_PREHEAT_MINUTES, NewPreheatMinutes);

Function definition:

void NVRAM_SetVariable(enum NVRAM_VARIABLE VariableID, void *Value)
{
char spi_buff[3];

case NVRAM_RETHERM_MINUTES:

spi_buff[0] = RethermMinutesByte0MsbAddr | WriteBit;
spi_buff[1] = (*(int*)(Value + 0) & 0xFF00) >> 8;
Spi_SendData(CLOCK, 2, spi_buff);

spi_buff[0] = RethermMinutesByte0LsbAddr | WriteBit;
spi_buff[1] = *(int*)(Value + 0) & 0xFF;
Spi_SendData(CLOCK, 2, spi_buff);

spi_buff[0] = RethermMinutesByte1MsbAddr | WriteBit;
spi_buff[1] = (*(int*)(Value + 1) & 0xFF00) >> 8;
Spi_SendData(CLOCK, 2, spi_buff);

spi_buff[0] = RethermMinutesByte1LsbAddr | WriteBit;
spi_buff[1] = *(int*)(Value + 1) & 0xFF;
Spi_SendData(CLOCK, 2, spi_buff);

spi_buff[0] = RethermMinutesByte2MsbAddr | WriteBit;
spi_buff[1] = (*(int*)(Value + 2) & 0xFF00) >> 8;
Spi_SendData(CLOCK, 2, spi_buff);

spi_buff[0] = RethermMinutesByte2LsbAddr | WriteBit;
spi_buff[1] = *(int*)(Value + 2) & 0xFF;
Spi_SendData(CLOCK, 2, spi_buff);

break;

0