/*====================================================================================================*/
int main( void )
{
  u8 UART_BUF[32] = {0};

  System_Init();
  System_Corr(SampleRateFreg);   // SampleRateFreg = 500 Hz

  LED_G = LED_ON;
  Delay_100ms(5);
  LED_G = LED_OFF;

  while(1) {
    LED_B = !LED_B;

    UART_BUF[0]  = Byte8L((s16)(Acc.TrueX*1000)); // Acc.X 1 mg/LSB
    UART_BUF[1]  = Byte8H((s16)(Acc.TrueX*1000)); 
    UART_BUF[2]  = Byte8L((s16)(Acc.TrueY*1000)); // Acc.Y 1 mg/LSB
    UART_BUF[3]  = Byte8H((s16)(Acc.TrueY*1000));   
    UART_BUF[4]  = Byte8L((s16)(Acc.TrueZ*1000)); // Acc.Z 1 mg/LSB
    UART_BUF[5]  = Byte8H((s16)(Acc.TrueZ*1000));

    UART_BUF[6]  = Byte8L((s16)(Gyr.TrueX*100));  // Gyr.X 10 mdps/LSB
    UART_BUF[7]  = Byte8H((s16)(Gyr.TrueX*100));
    UART_BUF[8]  = Byte8L((s16)(Gyr.TrueY*100));  // Gyr.Y 10 mdps/LSB
    UART_BUF[9]  = Byte8H((s16)(Gyr.TrueY*100));
    UART_BUF[10] = Byte8L((s16)(Gyr.TrueZ*100));  // Gyr.Z 10 mdps/LSB
    UART_BUF[11] = Byte8H((s16)(Gyr.TrueZ*100));

//    UART_BUF[12] = Byte8L((s16)(Mag.TrueX));      // 100 nTesla/LSB
//    UART_BUF[13] = Byte8L((s16)(Mag.TrueX));
//    UART_BUF[14] = Byte8L((s16)(Mag.TrueY));      // 100 nTesla/LSB
//    UART_BUF[15] = Byte8H((s16)(Mag.TrueY));
//    UART_BUF[16] = Byte8L((s16)(Mag.TrueZ));      // 100 nTesla/LSB
//    UART_BUF[17] = Byte8H((s16)(Mag.TrueZ));

    UART_BUF[18] = Byte8L((s16)(Temp.TrueT*100)); // 0.01 degC/LSB
    UART_BUF[19] = Byte8H((s16)(Temp.TrueT*100));

    UART_BUF[20] = Byte8L((s16)(AngE.Pitch*100)); // 0.01 deg/LSB
    UART_BUF[21] = Byte8H((s16)(AngE.Pitch*100)); // 0.01 deg/LSB
    UART_BUF[22] = Byte8L((s16)(AngE.Roll*100));  // 0.01 deg/LSB
    UART_BUF[23] = Byte8H((s16)(AngE.Roll*100));  // 0.01 deg/LSB
    UART_BUF[24] = Byte8L((s16)(AngE.Yaw*10));    // 100 nTesla/LSB
    UART_BUF[25] = Byte8H((s16)(AngE.Yaw*10));    // 0.1 deg/LSB

//    UART_BUF[26] = Byte8L((s16)(Baro.Temp*100));  // 0.01 degC/LSB
//    UART_BUF[27] = Byte8H((s16)(Baro.Temp*100));

//    UART_BUF[28] = Byte8L((s16)(Baro.Press*10));  // 0.1 mbar/LSB
//    UART_BUF[29] = Byte8H((s16)(Baro.Press*10));

//    UART_BUF[30] = Byte8L((s16)(Baro.Height));
//    UART_BUF[31] = Byte8H((s16)(Baro.Height));

    if(KEY == 1)
      RS232_VisualScope(UART_BUF);    // Print Acc
    else
      RS232_VisualScope(UART_BUF+20); // Print AngE
  }
}
예제 #2
0
/*====================================================================================================*/
void LCD_SetCursor( uint16_t coordiX, uint16_t coordiY )
{
  LCD_WriteCmd(0x2A);
  LCD_WriteData(Byte8H(coordiX));
  LCD_WriteData(Byte8L(coordiX));
  LCD_WriteCmd(0x2B);
  LCD_WriteData(Byte8H(coordiY));
  LCD_WriteData(Byte8L(coordiY));
  LCD_WriteCmd(0x2C);
}
/*=====================================================================================================*/
void LCD_SetCursor( u16 CoordiX, u16 CoordiY )
{
	LCD_WriteCmd(0x2A);
  LCD_WriteData(Byte8H(CoordiX));
	LCD_WriteData(Byte8L(CoordiX));
	LCD_WriteCmd(0x2B);
  LCD_WriteData(Byte8H(CoordiY));
	LCD_WriteData(Byte8L(CoordiY));
	LCD_WriteCmd(0x2C);
}
/*=====================================================================================================*/
void LCD_SetWindow( u16 StartX, u16 StartY, u16 EndX, u16 EndY )
{
	LCD_WriteCmd(0x2A);
  LCD_WriteData(Byte8H(StartX));
	LCD_WriteData(Byte8L(StartX));
  LCD_WriteData(Byte8H(EndX));
	LCD_WriteData(Byte8L(EndX));
	LCD_WriteCmd(0x2B);
  LCD_WriteData(Byte8H(StartY));
	LCD_WriteData(Byte8L(StartY));
  LCD_WriteData(Byte8H(EndY));
	LCD_WriteData(Byte8L(EndY));
	LCD_WriteCmd(0x2C);
}
예제 #5
0
/*====================================================================================================*/
void LCD_SetWindow( uint16_t startX, uint16_t startY, uint16_t endX, uint16_t endY )
{
  LCD_WriteCmd(0x2A);
  LCD_WriteData(Byte8H(startX));
  LCD_WriteData(Byte8L(startX));
  LCD_WriteData(Byte8H(endX));
  LCD_WriteData(Byte8L(endX));
  LCD_WriteCmd(0x2B);
  LCD_WriteData(Byte8H(startY));
  LCD_WriteData(Byte8L(startY));
  LCD_WriteData(Byte8H(endY));
  LCD_WriteData(Byte8L(endY));
  LCD_WriteCmd(0x2C);
}
/*=====================================================================================================*/
static void LCD_WriteColor( u16 Color )
{
  LCD_CST = 0;
  LCD_DC = 1;
  SPI_RW(SPI1, Byte8H(Color));
  SPI_RW(SPI1, Byte8L(Color));
  LCD_CST = 1;
}
/*====================================================================================================*/
static void LCD_WriteColor( uint16_t Color )
{
  LCD_CST_L;
  LCD_DC_H;
  SPI_RW(LCD_SPIx, Byte8H(Color));
  SPI_RW(LCD_SPIx, Byte8L(Color));
  LCD_CST_H;
}
예제 #8
0
/*====================================================================================================*/
static void LCD_WriteColor( uint16_t color )
{
  LCD_CST_L();
  LCD_DC_H();
  SPI_RW(LCD_SPIx, Byte8H(color));
  SPI_RW(LCD_SPIx, Byte8L(color));
  LCD_CST_H();
}
예제 #9
0
/*=====================================================================================================*/
void VisualScope_Send( USART_TypeDef* USARTx )
{
  u8 VisualScopeBuf[8] = {0};

  RF_SendData.Ang.X = (s16)(AngE.Pitch*100);  // 10 mdeg/LSB
  RF_SendData.Ang.Y = (s16)(AngE.Roll*100);   // 10 mdeg/LSB
  RF_SendData.Ang.Z = (s16)(AngE.Yaw*10);     // 100 mdeg/LSB

  VisualScopeBuf[0] = (u8)Byte8L(RF_SendData.Ang.X);
  VisualScopeBuf[1] = (u8)Byte8H(RF_SendData.Ang.X);
  VisualScopeBuf[2] = (u8)Byte8L(RF_SendData.Ang.Y);
  VisualScopeBuf[3] = (u8)Byte8H(RF_SendData.Ang.Y);
  VisualScopeBuf[4] = (u8)Byte8L(RF_SendData.Ang.Z);
  VisualScopeBuf[5] = (u8)Byte8H(RF_SendData.Ang.Z);
  VisualScopeBuf[6] = (u8)(0);
  VisualScopeBuf[7] = (u8)(0);

  RS232_VisualScope(USARTx, VisualScopeBuf, 8);
}
예제 #10
0
/*=====================================================================================================*/
void Flash_ReadPageU8(u32 ReadPage, u8 *ReadData, u32 DataLen)
{
	u16 Count = 0;
	u16 ReadBuf = 0;

	while (Count < DataLen) {
		ReadBuf = (u16)(*(vu32 *)(ReadPage + Count));
		ReadData[Count++] = Byte8H(ReadBuf);
		ReadData[Count++] = Byte8L(ReadBuf);
	}
}