//-------------------------------------------------------- // Application Programming Interface (API) functions //-------------------------------------------------------- #include "EDK_CM0.h" #include #include "edk_driver.h" #include "edk_api.h" #include "core_cm0.h" #include "core_cmFunc.h" #include "core_cmInstr.h" //--------------------------------------------- // SoC initialization //--------------------------------------------- void SoC_init(void){ NVIC_SetPriority (Timer_IRQn, 0x00); //Set timer a higher priority NVIC_SetPriority (UART_IRQn, 0x40); //Set UART a lower priority seven_seg_write(0,0,0,0); //Clean 7-segment display clear_screen(); SCB -> SCR = 1<1; //Enable sleep-on-exit bit } //--------------------------------------------- // Display the number of interrupts on the 7-segment display //--------------------------------------------- void Display_Int_Times(void){ dig4++; if(dig4==10){ dig4=0; dig3++; if (dig3==10){ dig3=0; dig2++; if (dig2==10){ dig2=0; dig1++; } } } seven_seg_write( dig1, dig2, dig3, dig4); } //--------------------------------------------- // Draw a rectangle on the screen //--------------------------------------------- void rectangle(int x1,int y1,int x2,int y2, int color){ int i,j; for (i=x1;iCURVALUE)&0xff; //Load LSB from timer while (imax) i=i/2; return i; }