int main() { XScuTimer_Config *TMRConfigPtr; //timer config //Disable cache on OCM Xil_SetTlbAttributes(0xFFFF0000,0x14de2); // S=b1 TEX=b100 AP=b11, Domain=b1111, C=b0, B=b0 print("CPU1: starting\n\r"); //GPIO Initilization XGpio_Initialize(&Gpio, GPIO_DEVICE_ID); XGpio_SetDataDirection(&Gpio, CHANNEL, 0x00); XGpio_DiscreteWrite(&Gpio,CHANNEL, 0xff); //timer initialisation TMRConfigPtr = XScuTimer_LookupConfig(TIMER_DEVICE_ID); XScuTimer_CfgInitialize(&Timer, TMRConfigPtr,TMRConfigPtr->BaseAddr); XScuTimer_SelfTest(&Timer); //load the timer XScuTimer_LoadTimer(&Timer, TIMER_LOAD_VALUE); SetupInterruptSystem(&Intc, &Timer,TIMER_IRPT_INTR); XScuTimer_Start(&Timer); print("CPU1: configured\n\r"); while(1){ } return 0; }
int Init_ScuTimer(void) { int Status = XST_SUCCESS; XScuTimer_Config *ConfigPtr; int TimerLoadValue = 0; ConfigPtr = XScuTimer_LookupConfig(TIMER_DEVICE_ID); Status = XScuTimer_CfgInitialize(&TimerInstance, ConfigPtr, ConfigPtr->BaseAddr); if (Status != XST_SUCCESS) { xil_printf("In %s: Scutimer Cfg initialization failed...\r\n", __func__); return XST_FAILURE; } Status = XScuTimer_SelfTest(&TimerInstance); if (Status != XST_SUCCESS) { xil_printf("In %s: Scutimer Self test failed...\r\n", __func__); return XST_FAILURE; } XScuTimer_EnableAutoReload(&TimerInstance); /* * Set for 250 milli seconds timeout. */ TimerLoadValue = XPAR_CPU_CORTEXA9_0_CPU_CLK_FREQ_HZ / 8; XScuTimer_LoadTimer(&TimerInstance, TimerLoadValue); return XST_SUCCESS; }
/* * The application must provide a function that configures a peripheral to * create the FreeRTOS tick interrupt, then define configSETUP_TICK_INTERRUPT() * in FreeRTOSConfig.h to call the function. This file contains a function * that is suitable for use on the Zynq SoC. */ void vConfigureTickInterrupt( void ) { static XScuGic xInterruptController; /* Interrupt controller instance */ BaseType_t xStatus; extern void FreeRTOS_Tick_Handler( void ); XScuTimer_Config *pxTimerConfig; XScuGic_Config *pxGICConfig; const uint8_t ucRisingEdge = 3; /* This function is called with the IRQ interrupt disabled, and the IRQ interrupt should be left disabled. It is enabled automatically when the scheduler is started. */ /* Ensure XScuGic_CfgInitialize() has been called. In this demo it has already been called from prvSetupHardware() in main(). */ pxGICConfig = XScuGic_LookupConfig( XPAR_SCUGIC_SINGLE_DEVICE_ID ); xStatus = XScuGic_CfgInitialize( &xInterruptController, pxGICConfig, pxGICConfig->CpuBaseAddress ); configASSERT( xStatus == XST_SUCCESS ); ( void ) xStatus; /* Remove compiler warning if configASSERT() is not defined. */ /* The priority must be the lowest possible. */ XScuGic_SetPriorityTriggerType( &xInterruptController, XPAR_SCUTIMER_INTR, portLOWEST_USABLE_INTERRUPT_PRIORITY << portPRIORITY_SHIFT, ucRisingEdge ); /* Install the FreeRTOS tick handler. */ xStatus = XScuGic_Connect( &xInterruptController, XPAR_SCUTIMER_INTR, (Xil_ExceptionHandler) FreeRTOS_Tick_Handler, ( void * ) &xTimer ); configASSERT( xStatus == XST_SUCCESS ); ( void ) xStatus; /* Remove compiler warning if configASSERT() is not defined. */ /* Initialise the timer. */ pxTimerConfig = XScuTimer_LookupConfig( XPAR_SCUTIMER_DEVICE_ID ); xStatus = XScuTimer_CfgInitialize( &xTimer, pxTimerConfig, pxTimerConfig->BaseAddr ); configASSERT( xStatus == XST_SUCCESS ); ( void ) xStatus; /* Remove compiler warning if configASSERT() is not defined. */ /* Enable Auto reload mode. */ XScuTimer_EnableAutoReload( &xTimer ); /* Ensure there is no prescale. */ XScuTimer_SetPrescaler( &xTimer, 0 ); /* Load the timer counter register. */ XScuTimer_LoadTimer( &xTimer, XSCUTIMER_CLOCK_HZ / configTICK_RATE_HZ ); /* Start the timer counter and then wait for it to timeout a number of times. */ XScuTimer_Start( &xTimer ); /* Enable the interrupt for the xTimer in the interrupt controller. */ XScuGic_Enable( &xInterruptController, XPAR_SCUTIMER_INTR ); /* Enable the interrupt in the xTimer itself. */ vClearTickInterrupt(); XScuTimer_EnableInterrupt( &xTimer ); }
int main() { init_platform(); // Declare some variables that we'll use later int Status; int timer_value; int counter = 0; // Declare two structs. One for the Timer instance, and // the other for the timer's config information XScuTimer my_Timer; XScuTimer_Config *Timer_Config; // Look up the the config information for the timer Timer_Config = XScuTimer_LookupConfig(XPAR_PS7_SCUTIMER_0_DEVICE_ID); // Initialise the timer using the config information Status = XScuTimer_CfgInitialize(&my_Timer, Timer_Config, Timer_Config->BaseAddr); // Load the timer with a value that represents one second // The SCU Timer is clocked at half the freq of the CPU. XScuTimer_LoadTimer(&my_Timer, XPAR_PS7_CORTEXA9_0_CPU_CLK_FREQ_HZ / 2); // Start the timer running (it counts down) XScuTimer_Start(&my_Timer); // An infinite loop while(1) { // Read the value of the timer timer_value = XScuTimer_GetCounterValue(&my_Timer); // If the timer has reached zero if (timer_value == 0) { // Re-load the original value into the timer and re-start it XScuTimer_RestartTimer(&my_Timer); // Write something to the UART (and count the seconds) printf("Timer has reached zero %d times\n\r", counter++); } else { // Show the value of the timer's counter value, for debugging purposes //printf("Timer is still running (Timer value = %d)\n\r", timer_value); } } cleanup_platform(); return 0; }
/** * * This function does a minimal test on the SCU Private timer device and driver. * The purpose of this function is to illustrate how to use the XScuTimer driver. * * @param DeviceId is the unique device id of the device. * * @return XST_SUCCESS if successful, otherwise XST_FAILURE. * * @note None. * ****************************************************************************/ int ScuTimerPolledExample(u16 DeviceId) { int Status; volatile u32 CntValue1 = 0; volatile u32 CntValue2 = 0; XScuTimer_Config *ConfigPtr; XScuTimer *TimerInstancePtr = &Timer; /* * Initialize the Scu Private Timer so that it is ready to use. */ ConfigPtr = XScuTimer_LookupConfig(DeviceId); /* * This is where the virtual address would be used, this example * uses physical address. */ Status = XScuTimer_CfgInitialize(TimerInstancePtr, ConfigPtr, ConfigPtr->BaseAddr); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Load the timer counter register. */ XScuTimer_LoadTimer(TimerInstancePtr, TIMER_LOAD_VALUE); /* * Get a snapshot of the timer counter value before it's started * to compare against later. */ CntValue1 = XScuTimer_GetCounterValue(TimerInstancePtr); /* * Start the Scu Private Timer device. */ XScuTimer_Start(TimerInstancePtr); /* * Read the value of the timer counter and wait for it to change, * since it's decrementing it should change, if the hardware is not * working for some reason, this loop could be infinite such that the * function does not return. */ while (1) { CntValue2 = XScuTimer_GetCounterValue(TimerInstancePtr); if (CntValue1 != CntValue2) { break; } } return XST_SUCCESS; }
int Timer_init(u16 DeviceId) { XScuTimer_Config *ConfigPtr; int Status; ConfigPtr = XScuTimer_LookupConfig(DeviceId); Status = XScuTimer_CfgInitialize(&Timer, ConfigPtr, ConfigPtr->BaseAddr); if (Status != XST_SUCCESS) { xil_printf("XScuTimer_CfgInitialize: Failed\r\n"); return XST_FAILURE; } return XST_SUCCESS; }
int WaitForStart::ScuTimerWait(u16 DeviceId, u32 timeOut) { int Status; XScuTimer_Config *ConfigPtr; XScuTimer *TimerInstancePtr = &Timer; /* * Initialize the Scu Private Timer so that it is ready to use. */ ConfigPtr = XScuTimer_LookupConfig(DeviceId); /* * This is where the virtual address would be used, this example * uses physical address. */ Status = XScuTimer_CfgInitialize(TimerInstancePtr, ConfigPtr, ConfigPtr->BaseAddr); if (Status != XST_SUCCESS) { return XST_FAILURE; } // XScuTimer_SetPrescaler(TimerInstancePtr,16); XScuTimer_SetPrescaler(TimerInstancePtr, 1); /* * Load the timer decrement register. */ XScuTimer_LoadTimer(TimerInstancePtr, timeOut); /* * Start the Scu Private Timer device. */ XScuTimer_Start(TimerInstancePtr); while (XScuTimer_GetCounterValue(TimerInstancePtr) != 0) { // Wait for timer to expire } // Stop timer after use XScuTimer_Stop(TimerInstancePtr); return XST_SUCCESS; }
/** * * This function initializes SCU Private timer device and driver. * * @param DeviceId is the unique device id of the device. * * @return XST_SUCCESS if successful, otherwise XST_FAILURE. * * @note None. * ****************************************************************************/ int ScuTimerInit(void) { int Status; XScuTimer_Config *ConfigPtr; XScuTimer *TimerInstancePtr = &Timer; /* * Initialize the Scu Private Timer so that it is ready to use. */ ConfigPtr = XScuTimer_LookupConfig(TIMER_DEVICE_ID); /* * This is where the virtual address would be used, this example * uses physical address. */ Status = XScuTimer_CfgInitialize(TimerInstancePtr, ConfigPtr, ConfigPtr->BaseAddr); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Disable auto reload of timer */ XScuTimer_DisableAutoReload(TimerInstancePtr); /* * Load the timer counter register. */ XScuTimer_LoadTimer(TimerInstancePtr, 0); /* * Start the Scu Private Timer device. */ XScuTimer_Start(TimerInstancePtr); return 0; }
int main(void) { XGpio dip, push; XScuTimer Timer; /* Cortex A9 SCU Private Timer Instance */ XScuTimer_Config *ConfigPtr; int value, skip, psb_check, dip_check, status, timerCounter, time1, time2; VectorArray AInst; VectorArray BTinst; VectorArray PInst; xil_printf("-- Start of the Program --\r\n"); xil_printf("Enter choice: 1 (SW->Leds), 2 (Timer->Leds), 3 (Matrix), 4 (Exit) \r\n"); XGpio_Initialize(&dip, XPAR_SW_8BIT_DEVICE_ID); XGpio_SetDataDirection(&dip, 1, 0xffffffff); XGpio_Initialize(&push, XPAR_BTNS_5BIT_DEVICE_ID); XGpio_SetDataDirection(&push, 1, 0xffffffff); ConfigPtr = XScuTimer_LookupConfig (XPAR_PS7_SCUTIMER_0_DEVICE_ID); status = XScuTimer_CfgInitialize (&Timer, ConfigPtr, ConfigPtr->BaseAddr); if(status != XST_SUCCESS){ xil_printf("Timer init() failed\r\n"); return XST_FAILURE; } // Load timer with delay XScuTimer_LoadTimer(&Timer, ONE_SECOND); // Set AutoLoad mode XScuTimer_EnableAutoReload(&Timer); while (1) { xil_printf("CMD:> "); // Read an input value from the console. value = inbyte(); skip = inbyte(); //CR skip = inbyte(); //LF switch (value) { case '1': while(!XGpio_DiscreteRead(&push, 1)) { dip_check = XGpio_DiscreteRead(&dip, 1); LED_IP_mWriteReg(XPAR_LED_IP_S_AXI_BASEADDR, 0, dip_check); for (skip = 0; skip < 9999999; skip++); } break; case '2': timerCounter = 0; XScuTimer_Start(&Timer); while(!XGpio_DiscreteRead(&push, 1)) { if(XScuTimer_IsExpired(&Timer)) { XScuTimer_ClearInterruptStatus(&Timer); timerCounter = (timerCounter + 1) % 256; LED_IP_mWriteReg(XPAR_LED_IP_S_AXI_BASEADDR, 0, timerCounter); } } break; case '3': setInputMatrices(AInst, BTinst); displayMatrix(AInst); displayMatrix(BTinst); XScuTimer_Start(&Timer); // Software matrix time1 = XScuTimer_GetCounterValue(&Timer); multiMatrixSoft(AInst, BTinst, PInst); time2 = XScuTimer_GetCounterValue(&Timer); xil_printf("SW time: %d\n\n", time1-time2); displayMatrix(PInst); // Hardware matrix time1 = XScuTimer_GetCounterValue(&Timer); multiMatrixHard(AInst, BTinst, PInst); time2 = XScuTimer_GetCounterValue(&Timer); XScuTimer_Stop(&Timer); xil_printf("HW time: %d\n\n", time1-time2); displayMatrix(PInst); break; case '4': // Exit return XST_SUCCESS; break; default : break; } } }
/*Copyright (c) 2015, Adam Taylor All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project*/ int main() { XScuTimer_Config *TMRConfigPtr; //timer config XBram_Config *ConfigPtr; unsigned int inchar; unsigned int newlr; int rx_pix; int r, g, b; unsigned int state = 0; init_platform(); ConfigPtr = XBram_LookupConfig(BRAM_DEVICE_ID); XBram_CfgInitialize(&Bram, ConfigPtr,ConfigPtr->CtrlBaseAddress); TMRConfigPtr = XScuTimer_LookupConfig(TIMER_DEVICE_ID); XScuTimer_CfgInitialize(&Timer, TMRConfigPtr,TMRConfigPtr->BaseAddr); SetupInterruptSystem(&Intc,&Timer,TIMER_IRPT_INTR); while(1){ // printf(":>"); if (state == 0){ numb_pixels = max_pixel; inchar = getchar(); newlr = getchar(); printf("option %x",inchar); switch (inchar){ case 0x02: printf("<STX>"); state = 1; break; case 0x03: printf("<ETX>\n"); break; } } if (state == 1){ inchar = getchar(); newlr = getchar(); rx_pix = inchar; state = 2; printf("pixel number = %d",rx_pix); } if (state == 2){ inchar = getchar(); newlr = getchar(); g = inchar; state = 3; printf("green = %x",g); } if (state == 3){ inchar = getchar(); newlr = getchar(); r = inchar; state = 4; printf("red = %x",r); } if (state == 4){ inchar = getchar(); newlr = getchar(); b = inchar; state = 5; printf("blue = %x",b); } if (state == 5){ inchar = getchar(); newlr = getchar(); switch (inchar){ case 0x02: printf("<STX>"); state = 6; break; case 0x03: printf("<ETX>\n"); state = 6; break; } } if (state == 6){ pixel[rx_pix] = (u32)b | ((u32)r << 8) | ((u32)g <<16); load_ram(); state = 0; } } return 0; }
int main (void) { XGpio dip, push; int psb_check, dip_check, dip_check_prev, count, Status; // PS Timer related definitions XScuTimer_Config *ConfigPtr; XScuTimer *TimerInstancePtr = &Timer; xil_printf("-- Start of the Program --\r\n"); XGpio_Initialize(&dip, XPAR_SW_4BIT_DEVICE_ID); XGpio_SetDataDirection(&dip, 1, 0xffffffff); XGpio_Initialize(&push, XPAR_BTNS_4BIT_DEVICE_ID); XGpio_SetDataDirection(&push, 1, 0xffffffff); count = 0; // Initialize the timer ConfigPtr = XScuTimer_LookupConfig(XPAR_PS7_SCUTIMER_0_DEVICE_ID); Status = XScuTimer_CfgInitialize(TimerInstancePtr, ConfigPtr, ConfigPtr->BaseAddr); if(Status != XST_SUCCESS){ return XST_FAILURE; } // Read dip switch values dip_check_prev = XGpio_DiscreteRead(&dip, 1); // Load timer with delay in multiple of ONE_SECOND XScuTimer_LoadTimer(TimerInstancePtr, ONE_SECOND*dip_check_prev); // Set AutoLoad mode XScuTimer_EnableAutoReload(TimerInstancePtr); // Start the timer XScuTimer_Start(TimerInstancePtr); while (1) { // Read push buttons and break the loop if Center button pressed psb_check = XGpio_DiscreteRead(&push, 1); if(psb_check & 0x1) { XScuTimer_Stop(TimerInstancePtr); break; } dip_check = XGpio_DiscreteRead(&dip, 1); if (dip_check != dip_check_prev) { xil_printf("DIP Switch Status %x, %x\r\n", dip_check_prev, dip_check); dip_check_prev = dip_check; // load timer with the new switch settings XScuTimer_LoadTimer(TimerInstancePtr, ONE_SECOND*dip_check_prev); count = 0; } if(XScuTimer_IsExpired(TimerInstancePtr)) { // clear status bit XScuTimer_ClearInterruptStatus(TimerInstancePtr); // output the count to LED and increment the count LED_IP_mWriteReg(XPAR_LED_IP_S_AXI_BASEADDR, 0, count); count++; } } return 0; }
/* * Setup the A9 internal timer to generate the tick interrupts at the * required frequency. */ static void prvSetupTimerInterrupt( void ) { extern void vTickISR (void); int Status; XScuTimer_Config *ScuConfig; prvSetupInterruptController(); Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_IRQ_INT, (Xil_ExceptionHandler)XScuGic_InterruptHandler, &InterruptController); /* * Connect to the interrupt controller */ Status = XScuGic_Connect(&InterruptController, XPAR_SCUTIMER_INTR, (Xil_ExceptionHandler)vTickISR, (void *)&Timer); if (Status != XST_SUCCESS) { return; } /* Timer Setup */ /* * Initialize the A9Timer driver. */ ScuConfig = XScuTimer_LookupConfig(XPAR_SCUTIMER_DEVICE_ID); Status = XScuTimer_CfgInitialize(&Timer, ScuConfig, ScuConfig->BaseAddr); if (Status != XST_SUCCESS) { return; } /* * Enable Auto reload mode. */ XScuTimer_EnableAutoReload(&Timer); /* * Load the timer counter register. */ XScuTimer_LoadTimer(&Timer, XSCUTIMER_CLOCK_HZ / configTICK_RATE_HZ); /* * Start the timer counter and then wait for it * to timeout a number of times. */ XScuTimer_Start(&Timer); /* * Enable the interrupt for the Timer in the interrupt controller */ XScuGic_Enable(&InterruptController, XPAR_SCUTIMER_INTR); /* * Enable the timer interrupts for timer mode. */ XScuTimer_EnableInterrupt(&Timer); /* * Do NOT enable interrupts in the ARM processor here. * This happens when the scheduler is started. */ }
int main() { init_platform(); XScuTimer Timer; XGpio ce, axis_data, axis_sw, btn, rst, sw; //setup of the timer XScuTimer_Config *TimerConfigPtr; XScuTimer *TimerInstancePtr = &Timer; TimerConfigPtr = XScuTimer_LookupConfig(TIMER_DEVICE_ID); int status, readFlag, switchVal, i = 0; int16_t rawData = 0; //the raw binary from the ACL chip float res = 0.003921568627; //resolution of each bit in the raw binary double gData, angle, sumAngle = 0; /* Initialize all the GPIOs used */ status = XGpio_Initialize(&btn, BTN_ID); if (status != XST_SUCCESS) { return XST_FAILURE; } status = XGpio_Initialize(&sw, SW_ID); if (status != XST_SUCCESS) { return XST_FAILURE; } status = XGpio_Initialize(&ce, CE_ID); if (status != XST_SUCCESS) { return XST_FAILURE; } status = XGpio_Initialize(&axis_data, AXIS_DATA_ID); if (status != XST_SUCCESS) { return XST_FAILURE; } status = XGpio_Initialize(&axis_sw, AXIS_SW_ID); if (status != XST_SUCCESS) { return XST_FAILURE; } status = XGpio_Initialize(&rst, RST_ID); if (status != XST_SUCCESS) { return XST_FAILURE; } /* Private Timer Initialization */ status = XScuTimer_CfgInitialize(&Timer, TimerConfigPtr, TimerConfigPtr->BaseAddr); if (status != XST_SUCCESS) { return XST_FAILURE; } XScuTimer_LoadTimer(TimerInstancePtr, TIMER_LOAD_VALUE); //loaded with 65 XScuTimer_EnableAutoReload(TimerInstancePtr); XScuTimer_Start(TimerInstancePtr); while(1){ /* Constantly read the switches */ switchVal = XGpio_DiscreteRead(&sw, 1); /* Constantly looking for when the reset button (btn0) is pressed */ XGpio_DiscreteWrite(&rst, 1, XGpio_DiscreteRead(&btn, 1)); /* Tells the PmodACL HW model what switches are active */ XGpio_DiscreteWrite(&axis_sw, 1, switchVal); /* Used to see if the axis data gpio has been read yet */ readFlag = 0; if (XGpio_DiscreteRead(&ce, 1) == 0){ XScuTimer_LoadTimer(TimerInstancePtr, TIMER_LOAD_VALUE); /* This keeps us in here until it's done sending/receiving */ while (XGpio_DiscreteRead(&ce, 1) == 0){ if (XScuTimer_IsExpired(TimerInstancePtr)){ rawData = XGpio_DiscreteRead(&axis_data, 1); readFlag = 1; //you've read! XScuTimer_ClearInterruptStatus(TimerInstancePtr); } } } if (readFlag == 1){ /* This state is used to see if the number received is negative or not (rawData > 512 is negative) */ if (rawData < 512){ gData = rawData * res; //res is the resolution of each bit received }else{ gData = (512 - rawData) * res; //subtracting rawData from 512 is used to get the actual negative number } //not the binary unsigned /* This switch is used to see what axis you're using and what to display * NOTE: The Z-axis is setup to do angle measurement! */ switch(switchVal){ case 0: printf("x-axis:%fg\r\n", gData); break; case 1: printf("y-axis:%fg\r\n", gData); break; case 2: gData += .0991; //add the offset gData = (gData>1)? 1 : gData; //if gData is greater than 1, gData = 1 (because you can't take the acos angle = acos(gData); //of a number greater than 1) angle *= (180 / 3.14159); //acos gives you the angle in radians, this converts it to degrees sumAngle += angle; //used for finding the average i++; /* After 20 samples it prints the average value out */ if (i == 20){ printf("z-axis:%f degrees\r\n", (sumAngle / 20) ); i = 0; sumAngle = 0; } break; default: printf("x-axis:%fg\r\n", gData); //chooses x-axis by default break; } readFlag = 0; } } cleanup_platform(); return 0; }