Ejemplo n.º 1
0
/*====================================================================================================*/
void System_Init( void )
{
  MPU_InitTypeDef MPU_InitStruct;

  CLOCK_SourceXTAL(NRF_CLOCK_XTALFREQ_16MHz);
  CLOCK_SourceLFCLK(NRF_CLOCK_LF_SRC_RC);
  CLOCK_CmdHFCLK(ENABLE);
  CLOCK_CmdLFCLK(ENABLE);

  GPIO_Config();
  Serial_Config();
  MPU9250_Config();

  Delay_100ms(1);
  printf("\r\nHello World!\r\n\r\n");

  MPU_InitStruct.MPU_Gyr_FullScale     = MPU_GyrFS_2000dps;
  MPU_InitStruct.MPU_Gyr_LowPassFilter = MPU_GyrLPS_41Hz;
  MPU_InitStruct.MPU_Acc_FullScale     = MPU_AccFS_4g;
  MPU_InitStruct.MPU_Acc_LowPassFilter = MPU_AccLPS_41Hz;
  printf("MPU9250 Init ...");
  if(MPU9250_Init(&MPU_InitStruct) != SUCCESS) {
    printf("ERROR\r\n");
    while(1) {
      LED2_Toggle();
      Delay_100ms(1);
    }
  }
  printf("SUCCESS\r\n");
  LED2_Set();
  Delay_100ms(1);
}
Ejemplo n.º 2
0
/*====================================================================================================*/
void NRF51_GPIO_Config( void )
{
  nrf_gpio_range_cfg_output(LED_1, LED_4);
  nrf_gpio_range_cfg_input(KEY_1, KEY_4, NRF_GPIO_PIN_PULLUP);

  LED1_Set();
  LED2_Set();
  LED3_Set();
  LED4_Set();
}