/* * ECE 3849 Lab2 starter project * * Gene Bogdanov 9/13/2017 */ /* XDCtools Header files */ #include #include #include /* BIOS Header files */ #include #include #include #include #include "driverlib/fpu.h" #include "driverlib/sysctl.h" #include "driverlib/interrupt.h" #include "driverlib/timer.h" #include "Crystalfontz128x128_ST7735.h" #include #include "grlib/grlib.h" #include #include #include "inc/hw_memmap.h" #include "driverlib/gpio.h" #include "driverlib/pwm.h" #include "driverlib/pin_map.h" #include "sampling.h" #include "buttons.h" #define PWM_FREQUENCY 20000 // PWM frequency = 20 kHz uint32_t gSystemClock = 120000000; // [Hz] system clock frequency // start a pwm test signal void start_signal() { // configure M0PWM2, at GPIO PF2, BoosterPack 1 header C1 pin 2 SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_2); GPIOPinConfigure(GPIO_PF2_M0PWM2); GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); // configure the PWM0 peripheral, gen 1, outputs 2 and 3 SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0); // use system clock without division PWMClockSet(PWM0_BASE, PWM_SYSCLK_DIV_1); PWMGenConfigure(PWM0_BASE, PWM_GEN_1, PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_1, roundf((float)gSystemClock / PWM_FREQUENCY)); PWMPulseWidthSet(PWM0_BASE, PWM_OUT_2, roundf((float)gSystemClock / PWM_FREQUENCY * 0.4f)); PWMOutputState(PWM0_BASE, PWM_OUT_2_BIT, true); PWMGenEnable(PWM0_BASE, PWM_GEN_1); } /* * ======== main ======== */ int main(void) { IntMasterDisable(); // hardware initialization goes here start_signal(); start_sampler(); /* Start BIOS */ BIOS_start(); return (0); } void task0_func(UArg arg1, UArg arg2) { IntMasterEnable(); while (true) { // do nothing } }