int main()                                    // Main function
{
  All_LED( 0 );
  InitSerial();

  Sensors_Start( PIN_SDI, PIN_SDO, PIN_SCL, PIN_CS_AG, PIN_CS_M, PIN_CS_ALT, PIN_LED, (int)&LEDValue[0], LED_COUNT );

  loopTimer = CNT;
  int filter = 256;

  while(1)
  {
    //Read ALL inputs from the sensors into local memory, starting at Temperature
    memcpy( &sens, Sensors_Address(), Sensors_ParamsSize );


    S4_Put( 0, '$' );   // Send a $ as a signature (like a packet start)

    LogInt( sens.GyroY );    // Sends an integer, followed by a space
    LogInt( sens.AccelX );   // Sends an integer, followed by a space
    LogInt( sens.AccelZ );   // Sends an integer, followed by a space

    S4_Put( 0, 13 );    // Send a carriage return


    ++counter;
    loopTimer += 80000000 / 100;

    waitcnt( loopTimer );
  }
}
예제 #2
0
//## Stat System.fstat(int fd)
static KMETHOD System_fstat(KonohaContext *kctx, KonohaStack *sfp)
{
	KMakeTrace(trace, sfp);
	int fd = (int)sfp[1].intValue;
	struct stat buf = {}; /* zero */
	int ret = fstat(fd, &buf);
	if(ret == -1) {
		KTraceErrorPoint(trace, SystemFault|SoftwareFault, "fstat", LogInt("fildes", fd), LogErrno);
	}
	KReturn(KLIB new_kObject(kctx, OnStack, KGetReturnType(sfp), (uintptr_t)&buf));
}