/*====================================================================================================*/
void System_Init( void )
{
  MPU_InitTypeDef MPU_InitStruct;

  HAL_Init();
  GPIO_Config();
  Serial_Config();
  MPU6050_Config();

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

  LED_B_Reset();
  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;
  while(MPU6050_Init(&MPU_InitStruct) != SUCCESS) {
    LED_R_Toggle();
    Delay_100ms(1);
  }
  LED_R_Set();
  LED_B_Set();
  Delay_100ms(1);
}
Ejemplo n.º 2
0
void SIMU_Loop( void )
{
  LED_R_Toggle();
  LED_G_Toggle();
  LED_B_Toggle();
  delay_ms(200);
}
Ejemplo n.º 3
0
void demo_rx( void )
{
  NRF24_OperationMode(NRF_OPMODE_STANDBY);

  while (1) {
    NRF24_RxPacketDef();
    NRF24_OperationMode(NRF_OPMODE_STANDBY);

    if (nrf.rxFlag == NRF_STA_RX_DR) {
      LED_G_Toggle();
      nrf.txFlag = NRF_STA_NULL;
      rxCount = nrf.rxBuff[TX_LENS - 1];
      printf("RX_RXD, %i\r\n", rxCount);
    }
    else if (nrf.rxFlag == NRF_STA_TIMUOUT) {
      LED_B_Toggle();
      nrf.rxFlag = NRF_STA_NULL;
      printf("RX_TIMOUT\r\n");
    }
    else {
      LED_R_Toggle();
      nrf.txFlag = NRF_STA_NULL;
      printf("RX_ELS\r\n");
    }
  }
}
Ejemplo n.º 4
0
int main( void )
{
  System_Init();

  while(1) {
    LED_R_Toggle();
    LED_G_Toggle();
    LED_B_Toggle();
    delay_ms(500);
  }
}
Ejemplo n.º 5
0
int main( void )
{
  System_Init();

  while(1) {
    LED_R_Toggle();
    LED_G_Toggle();
    LED_B_Toggle();
    Delay_100ms(5);
  }
}
Ejemplo n.º 6
0
/*====================================================================================================*/
void QMV_Loop( void )
{
  LCD_TestFunction();

  while(1) {
    LED_R_Toggle();
    LED_G_Toggle();
    LED_B_Toggle();
    delay_ms(100);
  }
}
Ejemplo n.º 7
0
int main( void )
{
  System_Init();

#if FLASH_RW_U8
  Flash_ErasePages(FLASH_USER_START_ADDR, WRITE_PAGE_NBPAGE);
  Flash_WritePageU8(FLASH_USER_START_ADDR, WriteDataU8, 1024);
  Flash_ReadPageU8(FLASH_USER_START_ADDR, ReadDataU8, 1024);
  if(Cmp_ArrU8(WriteDataU8, ReadDataU8, 1024) == SUCCESS)
    LED_R_Reset();
#endif
  Delay_100ms(5);

#if FLASH_RW_U16
  Flash_ErasePages(FLASH_USER_START_ADDR, WRITE_PAGE_NBPAGE);
  Flash_WritePageU16(FLASH_USER_START_ADDR, WriteDataU16, 512);
  Flash_ReadPageU16(FLASH_USER_START_ADDR, ReadDataU16, 512);
  if(Cmp_ArrU16(WriteDataU16, ReadDataU16, 512) == SUCCESS)
    LED_G_Reset();
#endif
  Delay_100ms(5);

#if FLASH_RW_U32
  Flash_ErasePages(FLASH_USER_START_ADDR, WRITE_PAGE_NBPAGE);
  Flash_WritePageU32(FLASH_USER_START_ADDR, WriteDataU32, 256);
  Flash_ReadPageU32(FLASH_USER_START_ADDR, ReadDataU32, 256);
  if(Cmp_ArrU32(WriteDataU32, ReadDataU32, 256) == SUCCESS)
    LED_B_Reset();
#endif
  Delay_100ms(5);

#if FLASH_RW_U64
  Flash_ErasePages(FLASH_USER_START_ADDR, WRITE_SECTOR_NSECTOR);
  Flash_WritePageU64(FLASH_USER_START_ADDR, WriteDataU64, 128);
  Flash_ReadPageU64(FLASH_USER_START_ADDR, ReadDataU64, 128);
  if(Cmp_ArrU64(WriteDataU64, ReadDataU64, 128) == SUCCESS) {
    LED_R_Toggle;
    Delay_100ms(5);
    LED_R_Toggle;
    Delay_100ms(5);
  }
#endif
  Delay_100ms(20);

  while (1) {
    LED_R_Toggle();
    LED_G_Toggle();
    LED_B_Toggle();
    Delay_100ms(2);
  }
}
Ejemplo n.º 8
0
int main( void )
{
  System_Init();

  while(1) {
    LED_R_Toggle();
    LED_G_Toggle();
    LED_B_Toggle();
    delay_ms(100);
 
    while(KEY_WU_Read()) {
      LED_R_Toggle();
      LED_G_Toggle();
      LED_B_Toggle();
      delay_ms(200);
    }
    while(KEY_BO_Read()) {
      LED_R_Toggle();
      LED_G_Toggle();
      LED_B_Toggle();
      delay_ms(50);
    }
  }
}
Ejemplo n.º 9
0
int main( void )
{
  uint8_t state = 0;
  uint32_t i = PWM_MIN;

  System_Init();

  while(1) {
    
    i = (state) ? (i - 1) : (i + 1);
    PWM = i;
    if(i == PWM_MAX){ state = 1; }
    if(i == PWM_MIN){ state = 0; Delay_1ms(1000);}

    LED_R_Toggle();
    LED_G_Toggle();
    LED_B_Toggle();
    Delay_10ms(4);
  }
}
Ejemplo n.º 10
0
/*====================================================================================================*/
void QMV_IMU_Config( void )
{
  MPU_ConfigTypeDef MPU_ConfigStruct;

  MPU6500_Config();
  delay_ms(10);

  printf("IMU Init ...");
  MPU_ConfigStruct.MPU_Gyr_FullScale     = MPU_GyrFS_2000dps;
  MPU_ConfigStruct.MPU_Gyr_LowPassFilter = MPU_GyrLPS_41Hz;
  MPU_ConfigStruct.MPU_Acc_FullScale     = MPU_AccFS_4g;
  MPU_ConfigStruct.MPU_Acc_LowPassFilter = MPU_AccLPS_41Hz;
  if(MPU6500_Init(&MPU_ConfigStruct) != SUCCESS) {
    printf("ERROR\r\n");
    while(1) {
      LED_R_Toggle();
      delay_ms(100);
    }
  }
  printf("SUCCESS\r\n");
  delay_ms(50);
}
Ejemplo n.º 11
0
void demo_tx( void )
{
  nrf.txBuff[0] = 'K';
  nrf.txBuff[1] = 'i';
  nrf.txBuff[2] = 't';
  nrf.txBuff[3] = 'S';
  nrf.txBuff[4] = 'p';
  nrf.txBuff[5] = 'r';
  nrf.txBuff[6] = 'o';
  nrf.txBuff[7] = 'u';
  nrf.txBuff[8] = 't';
  nrf.txBuff[9] = 0;
  nrf.txLens    = TX_LENS;

  NRF24_OperationMode(NRF_OPMODE_STANDBY);

	while (1) {
    nrf.txBuff[9] = txCount;
    NRF24_TxPacketDef();
    NRF24_OperationMode(NRF_OPMODE_STANDBY);

    if (nrf.txFlag == NRF_STA_TX_DS) {
      LED_G_Toggle();
      nrf.txFlag = NRF_STA_NULL;
      printf("TX_TXD, %i\r\n", txCount);
      txCount++;
    }
    else if (nrf.txFlag == NRF_STA_MAX_RT) {
      LED_B_Toggle();
      nrf.txFlag = NRF_STA_NULL;
      printf("TX_MAX_RT\r\n");
    }
    else {
      LED_R_Toggle();
      nrf.txFlag = NRF_STA_NULL;
      printf("TX_ELS\r\n");
    }
  }
}