What can I initialize elsewhere and only get temperature in
// main_rtos Board_init(); GPIO_init(); I2C_init(); GPIO_setConfig(CONFIG_GPIO_LED_0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW); #ifdef CONFIG_GPIO_TMP_EN GPIO_setConfig(CONFIG_GPIO_TMP_EN, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_HIGH); /* Allow the sensor to power on */ sleep(1); #endif /* Set priority and stack size attributes */ //... // tcpecho.c void static i2c0 (void){ uint16_t sample; int16_t temperature; uint8_t txBuffer[1]; uint8_t rxBuffer[2]; int8_t i; I2C_Handle i2c; I2C_Params i2cParams; I2C_Transaction i2cTransaction; /* Call driver init functions */ //Display_init(); //GPIO_init(); I2C_init(); /* Configure the LED and if applicable, the TMP_EN pin */ // GPIO_setConfig(CONFIG_GPIO_LED_0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW); #ifdef CONFIG_GPIO_TMP_EN GPIO_setConfig(CONFIG_GPIO_TMP_EN, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_HIGH); /* Allow the sensor to power on */ sleep(1); #endif /* Turn on user LED */ GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON); Display_printf(display, 0, 0, "Starting the i2ctmp example\n"); /* Create I2C for usage */ I2C_Params_init(&i2cParams); i2cParams.bitRate = I2C_400kHz; i2c = I2C_open(CONFIG_I2C_TMP, &i2cParams); if (i2c == NULL) { Display_printf(display, 0, 0, "Error Initializing I2C\n"); while (1) {} } else { Display_printf(display, 0, 0, "I2C Initialized!\n"); } /* Common I2C transaction setup */ i2cTransaction.writeBuf = txBuffer; i2cTransaction.writeCount = 1; i2cTransaction.readBuf = rxBuffer; i2cTransaction.readCount = 0; /* * Determine which I2C sensors are present by querying known I2C * target addresses. */ for (i = TMP_COUNT - 1; i >= 0; i--) { i2cTransaction.targetAddress = sensors[i].address; txBuffer[0] = sensors[i].resultReg; if (I2C_transfer(i2c, &i2cTransaction)) { targetAddress = sensors[i].address; Display_printf(display, 0, 0, "Detected TMP%s sensor with target" " address 0x%x", sensors[i].id, sensors[i].address); } else { i2cErrorHandler(&i2cTransaction, display); } } /* If we never assigned a target address */ if (targetAddress == 0) { Display_printf(display, 0, 0, "Failed to detect a sensor!"); I2C_close(i2c); while (1) {} } Display_printf(display, 0, 0, "\nUsing last known sensor for samples."); i2cTransaction.targetAddress = targetAddress; /* Take 3 samples and print them out onto the console */ i2cTransaction.readCount = 2; for (sample = 0; sample < 3; sample++) { if (I2C_transfer(i2c, &i2cTransaction)) { /* * Extract degrees C from the received data; * see TMP sensor datasheet */ temperature = (rxBuffer[0] << 8) | (rxBuffer[1]); temperature *= 0.0078125; Display_printf(display, 0, 0, "Sample %u: %d C", sample, temperature); } else { i2cErrorHandler(&i2cTransaction, display); } /* Sleep for 1 second */ sleep(1); } I2C_close(i2c); Display_printf(display, 0, 0, "I2C closed!"); }
So many attempts with moved omissions seem to fail. And with so miny failures I seem to have perplexed router and/or local AP by using a hostname in platform.c rather than a fixed ip address. I guess that should be another question.