in AZ3166/src/libraries/Sensors/src/IoT_DevKit_HW.cpp [57:160]
int initIoTDevKit(int isShowInfo)
{
if (isShowInfo)
{
// Init the screen
Screen.init();
Screen.print(0, "IoT DevKit");
Screen.print(2, "Initializing...");
}
// Serial
Serial.begin(115200);
// Init pins
pinMode(LED_WIFI, OUTPUT);
pinMode(LED_AZURE, OUTPUT);
pinMode(LED_USER, OUTPUT);
pinMode(USER_BUTTON_A, INPUT);
pinMode(USER_BUTTON_B, INPUT);
// Turn off the RGB Led
rgbLed.turnOff();
// Init I2C bus
if (isShowInfo)
{
Screen.print(3, " I2C");
}
if ((ext_i2c = new DevI2C(D14, D15)) == NULL)
{
LogError("Failed to initialize I2C.");
return -101;
}
// Init the gyroscope and accelerator sensor
if (isShowInfo)
{
Screen.print(3, " LSM6DSL");
}
if ((acc_gyro = new LSM6DSLSensor(*ext_i2c, D4, D5)) == NULL)
{
LogError("Failed to initialize gyroscope and accelerator sensor.");
return -102;
}
acc_gyro->init(NULL);
acc_gyro->enableAccelerator();
acc_gyro->enableGyroscope();
// Init the humidity and temperature sensor
if (isShowInfo)
{
Screen.print(3, " HTS221");
}
if ((ht_sensor = new HTS221Sensor(*ext_i2c)) == NULL)
{
LogError("Failed to initialize humidity and temperature sensor.");
return -103;
}
ht_sensor->init(NULL);
ht_sensor->reset();
// Init the magnetometer sensor
if (isShowInfo)
{
Screen.print(3, " LIS2MDL");
}
if ((magnetometer = new LIS2MDLSensor(*ext_i2c)) == NULL)
{
LogError("Failed to initialize magnetometer sensor.");
return -104;
}
magnetometer->init(NULL);
// Init IrDA
if (isShowInfo)
{
Screen.print(3, " IrDA");
}
if ((IrdaSensor = new IRDASensor()) == NULL)
{
LogError("Failed to initialize IrDa sensor.");
return -105;
}
IrdaSensor->init();
// Init pressure sensor
if (isShowInfo)
{
Screen.print(3, " LPS22HB");
}
if ((pressureSensor = new LPS22HBSensor(*ext_i2c)) == NULL)
{
LogError("Failed to initialize pressure sensor.");
return -106;
}
pressureSensor->init(NULL);
// Init WiFi
if (isShowInfo)
{
Screen.print(3, " Wi-Fi");
}
return initWiFi();
}