Part Number: MSP430FR2355
Hello...
I have the following driver file. I am passing in a pointer to the function....the function is called from main AND the pointer has no assignment....Once inside the function the pointer is getting an assignment....Part of the assignment comes from a type that is defined within main. If I place a breakpoint after the assignments I can see that the pointer takes on the size value (which is calculated within the function) BUT the address assignment prior to this it does not take on yet I can see within the function that applicationI2C.pSysCommsB is pointing to the correct memory location 0x0540...Can someone tell me how to get this assignment. I don't want to create a new instance within the function that points to the existing piece of data that has been created at the top level (main).
Thanks
pVal->pSysComms_Handle->pSysCommsB = applicationI2C.pSysCommsB;
uint8_t InitializeDisplay(I2C_txHandle_t *pVal)
{
/*
* turn on display, turn
* on cursor, position
* cursor line 1 , position 1
*/
uint8_t InitializeLCD[] = {0x3C, 0x0E, 0x01};
extern uint8_t *pI2CStream;
extern SysComms_Handle_t applicationI2C;
uint8_t err = 0;
uint8_t k = sizeof(InitializeLCD);
pI2CStream = malloc(k * 2);
for (uint8_t t = 0; t < k; t++)
{
if (k - t > 1)
*(pI2CStream + (2 * t)) = 0x80;
else
*(pI2CStream + (2 * t)) = 0x00;
*(pI2CStream + (2 * t + 1)) = InitializeLCD[t];
}
pVal->pSysComms_Handle->pSysCommsB = applicationI2C.pSysCommsB;
pVal->size = k*2;
if (!(ERR_INIT_LCD == config_I2CSendData(pVal)))
err = 0;
//pInit.pSysCommsB->UCBxCTLW[0] |= UCTR | UCTXSTT;
else
err = 1;
return err;
}