Ejemplo n.º 1
0
bool imu6Test(void)
{
  bool testStatus = true;

  if (!isInit)
  {
    DEBUG_PRINT("Uninitialized");
    testStatus = false;
  }

#ifdef IMU_ENABLE_MAG_AK8963
  testStatus &= isMagPresent;
  if (testStatus)
  {
    isAK8963TestPassed = ak8963SelfTest();
    testStatus = isAK8963TestPassed;
  }
#endif

#ifdef IMU_ENABLE_PRESSURE_LPS25H
  testStatus &= isBaroPresent;
  if (testStatus)
  {
    isLPS25HTestPassed = lps25hSelfTest();
    testStatus = isLPS25HTestPassed;
  }
#endif
  ///testStatus &= imu6ManufacturingTest(); /* TODO Remove */
  while (imu6ManufacturingTest() == false);

  return testStatus;
}
Ejemplo n.º 2
0
bool expbrdTest()
{
  bool status = true;

  if(!isInit)
    return false;

  // For production test
  if (expbrdIsPresent(EXPBRD_VID_BITCRAZE, EXPBRD_PID_ET))
  {
    status &= imu6ManufacturingTest();
    status &= exptestRun();
    if (status)
    {
      DEBUG_PRINT("Expansion port test [OK].\n");
    }
    else
    {
      DEBUG_PRINT("Expansion port test [FAIL].\n");
    }
  }
  status &= owTest();

  return status;
}
Ejemplo n.º 3
0
static bool exptestRun(void)
{
  int i;
  volatile int delay;
  bool status = true;
  GPIO_InitTypeDef GPIO_InitStructure;
  GpioRegBuf gpioSaved;

  isInit = true;

  status &= imu6ManufacturingTest();


  // Enable GPIOs
  RCC_AHB1PeriphClockCmd(ET_GPIO_PERIF, ENABLE);

  decktestSaveGPIOStatesABC(&gpioSaved);

  for (i = 0; i < ET_NBR_PINS; i++)
  {
    //Initialize the pins as inputs
    GPIO_InitStructure.GPIO_Pin = etGpioIn[i].pin;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
    GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
    GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
    GPIO_InitStructure.GPIO_Speed = GPIO_Low_Speed;
    GPIO_Init(etGpioIn[i].port, &GPIO_InitStructure);
  }

  for (i = 0; i < ET_NBR_PINS && status; i++)
  {
    // Configure pin as output to poke others
    GPIO_InitStructure.GPIO_Pin = etGpioIn[i].pin;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
    GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Low_Speed;
    GPIO_Init(etGpioIn[i].port, &GPIO_InitStructure);

    // Test high
    GPIO_SetBits(etGpioIn[i].port, etGpioIn[i].pin);
    for (delay = 0; delay < 1000; delay++);
    if (!exptestTestAllPins(1))
    {
      status = false;
    }

    // Test low
    GPIO_ResetBits(etGpioIn[i].port, etGpioIn[i].pin);
    for (delay = 0; delay < 1000; delay++);
    if (!exptestTestAllPins(0))
    {
      status = false;
    }

    // Restore
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
    GPIO_Init(etGpioIn[i].port, &GPIO_InitStructure);
  }

  decktestRestoreGPIOStatesABC(&gpioSaved);

  if (status)
  {
    // Configure SDA & SCL to turn on OK leds
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
    GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Low_Speed;
    GPIO_InitStructure.GPIO_Pin = etGpioSDA.pin;
    GPIO_Init(etGpioSDA.port, &GPIO_InitStructure);
    GPIO_InitStructure.GPIO_Pin = etGpioSCL.pin;
    GPIO_Init(etGpioSCL.port, &GPIO_InitStructure);
    // Turn on OK LEDs.
    GPIO_ResetBits(etGpioSDA.port, etGpioSDA.pin);
    GPIO_ResetBits(etGpioSCL.port, etGpioSCL.pin);
  }

  return status;
}