//***************************************************************************** // // CS Rising Edge Interrupt Handler // //***************************************************************************** void gpioQ1IntHandler(void) { uint32_t ui32Status; ui32Status = ROM_GPIOIntStatus(GPIO_PORTQ_BASE, 1); ROM_GPIOIntClear(GPIO_PORTQ_BASE, ui32Status); uint32_t xferSize = ROM_uDMAChannelSizeGet(UDMA_CH14_SSI3RX | UDMA_PRI_SELECT); //Calculate next RxWriteIndex (buffer in which to write the next set of data) uint8_t nextIndex = g_ui8RxWriteIndex + 1; if(nextIndex >= SSI_RX_BUFFER_COUNT) nextIndex = 0; //Get the size of the completed transfer uint32_t msgSize = SSI_BUFFER_SIZE - xferSize; g_ui32MessageSizes[g_ui8RxWriteIndex] = msgSize; //Store index value of this transaction for print debug message uint8_t previousIndex = g_ui8RxWriteIndex; //Move current rx write index to the next buffer g_ui8RxWriteIndex = nextIndex; ROM_uDMAChannelDisable(UDMA_CH14_SSI3RX); //Enable DMA channel to write in the next buffer position ROM_uDMAChannelTransferSet(UDMA_CH14_SSI3RX | UDMA_PRI_SELECT, UDMA_MODE_BASIC, (void *)(SSI3_BASE + SSI_O_DR), g_ui8SSIRxBuf[g_ui8RxWriteIndex], sizeof(g_ui8SSIRxBuf[g_ui8RxWriteIndex])); ROM_uDMAChannelEnable(UDMA_CH14_SSI3RX); //Increment receive count g_ui32SSIRxWriteCount++; //UARTprintf("%d\t%d\t%x\t%x\n", previousIndex, msgSize, g_ui8SSIRxBuf[previousIndex][0], g_ui8SSIRxBuf[previousIndex][msgSize - 1]); }
//***************************************************************************** // // The interrupt handler for the button interrupt. // //***************************************************************************** void ButtonIntHandler(void) { // // Delay here on button push for simple debouncing. // SysCtlDelay(g_ui32SysClock / 10); // // Clear the timer interrupt. // ROM_GPIOIntClear(GPIO_PORTJ_AHB_BASE, GPIO_INT_PIN_0); // // Increment Mode. // g_ui32SleepMode = (g_ui32SleepMode + 1) % 3; switch (g_ui32SleepMode) { // // Enter Run Mode. // case 0: // // Disable the PWM. // ROM_PWMGenDisable(PWM0_BASE, PWM_GEN_0); // // Configure Toggle LED as a GPIO output. // ROM_GPIOPinTypeGPIOOutput(TOGGLE_GPIO_BASE, TOGGLE_GPIO_PIN); // // Enable the timer. // ROM_TimerEnable(TIMER0_BASE, TIMER_A); // // Print mode over the UART. // UARTprintf("\033[100D"); UARTprintf("\033[K"); UARTprintf("Run\t\tMOSC with PLL\tTimer"); SysCtlDelay(10000); break; // // Enter Sleep Mode. // case 1: // // Print mode over the UART. // Delay to let the UART finish before going to Sleep. // UARTprintf("\033[100D"); UARTprintf("\033[K"); UARTprintf("Sleep\t\tPIOSC\t\tTimer"); SysCtlDelay(10000); // // Switch clock to PIOSC and power down the MOSC before going into // Sleep. // g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_OSC_INT | SYSCTL_USE_OSC | SYSCTL_MAIN_OSC_DIS), 16000000); break; // // Enter Deep-Sleep Mode. // case 2: // // Switch back to the MOSC + PLL. // g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_320), 16000000); // // Disable the timer. // ROM_TimerDisable(TIMER0_BASE, TIMER_A); // // Configure the toggle pin as a PWM pin. // ROM_GPIOPinConfigure(GPIO_PF0_M0PWM0); ROM_GPIOPinTypePWM(TOGGLE_GPIO_BASE, TOGGLE_GPIO_PIN); // // Enable the PWM. // ROM_PWMGenEnable(PWM0_BASE, PWM_GEN_0); // // Print mode over the UART. // Delay to let the UART finish before going to Sleep. // UARTprintf("\033[100D"); UARTprintf("\033[K"); UARTprintf("Deep-Sleep\tLFIOSC\t\tPWM"); SysCtlDelay(10000); break; default: break; } // // Set LEDs to show what mode we are in. // PowerLEDsSet(); }