Hello,
The following code snippet is from the Launchpad's lab14:
"g_sISL29023Inst" is a pointer to structure that's passed to the "ISL29023Init" function.
But I don't see that the structure is initialized with any data before the ISL29023Init function call - can you please explain this
int
main(void)
{
float fAmbient;
uint8_t ui8Mask;
ROM_SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C3);
ROM_GPIOPinConfigure(GPIO_PD0_I2C3SCL);
ROM_GPIOPinConfigure(GPIO_PD1_I2C3SDA);
GPIOPinTypeI2CSCL(GPIO_PORTD_BASE, GPIO_PIN_0);
ROM_GPIOPinTypeI2C(GPIO_PORTD_BASE, GPIO_PIN_1);
ROM_IntMasterEnable();
I2CMInit(&g_sI2CInst, I2C3_BASE, INT_I2C3, 0xFF, 0xFF, ROM_SysCtlClockGet());
SysCtlDelay(SysCtlClockGet() / 3);
ISL29023Init(&g_sISL29023Inst, &g_sI2CInst,
ISL29023_I2C_ADDRESS,ISL29023AppCallback, &g_sISL29023Inst);
ISL29023AppI2CWait(__FILE__, __LINE__);
ui8Mask = (ISL29023_CMD_I_OP_MODE_M );
ISL29023ReadModifyWrite(&g_sISL29023Inst, ISL29023_O_CMD_I, ~ui8Mask,
(ISL29023_CMD_I_OP_MODE_ALS_CONT),
ISL29023AppCallback, &g_sISL29023Inst);
ISL29023AppI2CWait(__FILE__, __LINE__);
while(1)
{
ISL29023DataRead(&g_sISL29023Inst, ISL29023AppCallback, &g_sISL29023Inst);
ISL29023AppI2CWait(__FILE__, __LINE__);
ISL29023DataLightVisibleGetFloat(&g_sISL29023Inst, &fAmbient);
}
}