//ISR INIT void ctl_buttons_isr_init(CTL_ISR_FN_t fn) { int en; int32u proba; en=ctl_global_interrupts_set(0); buttons_isr=fn; SysCtlPeripheralEnable(PUSHBUTTON_PERIPH); //UNLOCKOLNI KELL A PF0 REGISZTERT MERT NMI-RE VAN ALLITVA HWREG(PUSHBUTTON_PORT + GPIO_O_LOCK) = GPIO_LOCK_KEY_DD; HWREG(PUSHBUTTON_PORT + GPIO_O_CR) |= 0x01; HWREG(PUSHBUTTON_PORT + GPIO_O_LOCK) = 0; GPIODirModeSet(PUSHBUTTON_PORT, LEFT_SWITCH | RIGHT_SWITCH , GPIO_DIR_MODE_IN); GPIOPadConfigSet(PUSHBUTTON_PORT,LEFT_SWITCH | RIGHT_SWITCH , GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); GPIOPinIntDisable(PUSHBUTTON_PORT, LEFT_SWITCH | RIGHT_SWITCH); if((GPIOPinIntStatus(PUSHBUTTON_PORT, 1)) == LEFT_SWITCH ) { GPIOPinIntClear(PUSHBUTTON_PORT, LEFT_SWITCH ); } if((GPIOPinIntStatus(PUSHBUTTON_PORT, 1)) == RIGHT_SWITCH ) { GPIOPinIntClear(PUSHBUTTON_PORT, RIGHT_SWITCH ); } ctl_set_priority(PUSHBUTTON_IRQ_PRIORITY, 1); ctl_unmask_isr(PUSHBUTTON_IRQ_PRIORITY); ctl_global_interrupts_set(en); GPIOIntTypeSet(PUSHBUTTON_PORT, LEFT_SWITCH | RIGHT_SWITCH , GPIO_BOTH_EDGES); //GPIO_BOTH_EDGES GPIOPinIntEnable(PUSHBUTTON_PORT, LEFT_SWITCH | RIGHT_SWITCH ); }
//get/set ctl_timeslice_period int timesliceCmd(char **argv,unsigned short argc){ if(argc>1){ printf("Error: too many arguments.\r\n"); return 0; } //if one argument given then set otherwise get if(argc==1){ int en; CTL_TIME_t val=atol(argv[1]); //check value if(val==0){ printf("Error: bad value.\r\n"); return -1; } //disable interrupts so that opperation is atomic en=ctl_global_interrupts_set(0); ctl_timeslice_period=val; ctl_global_interrupts_set(en); } printf("ctl_timeslice_period = %ul\r\n",ctl_timeslice_period); return 0; }