void InitBot(void) { //Call initialization functions. LockoutProtection(); InitializeMCU(); initUART(); InitializeEncoders(true,false); PresetEncoderCounts(0,0); InitializeMotors(true,true); InitializeServos(); InitializeLineSensor(); SetDischargeTime(350); //Modified for 4 ADC Ports (assuming all are IR). initADCPorts(); //Initialize state variables. angle = 90; shooting = false; rotate = rotate_time; move = move_time; IRtrig = false; lose_obj = false; //Pin PA3 is James. 0xff is off; 0x00 is on. GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_3); GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_3, 0xff); //Pin PA2 is the trigger; set the pin to perform weak pull-up (not open-drain). SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); GPIOPinTypeGPIOInput(GPIO_PORTA_BASE, GPIO_PIN_2); GPIOPadConfigSet(GPIO_PORTA_BASE, GPIO_PIN_2,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPU); //Setup an interrupt on pin PA2 (flipPancake). IntEnable(INT_GPIOA); GPIOIntTypeSet(GPIO_PORTA_BASE, GPIO_PIN_2,GPIO_FALLING_EDGE); GPIOPinIntEnable(GPIO_PORTA_BASE, GPIO_PIN_2); }
void initLineSensor(void) { tI2C *bus = InitializeI2C(PIN_B3, PIN_B2); ls = InitializeLineSensor(bus, 0); }