//------------------------------------------------------------------------------ // ===== Sub Menu 01 ===== //------------------------------------------------------------------------------ void View_SubMenu01(void) { ANSI_GotoXY(0,11); ANSI_ClearScreen(FROM); ANSI_Normal(); ANSI_GotoXY(41,12); Uart_Print(UART1,"◆◆◆ ◆◆◆ ◆ ◆ ◆◆◆"); ANSI_GotoXY(41,13); Uart_Print(UART1,"◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆"); ANSI_GotoXY(41,14); Uart_Print(UART1,"◆◆◆ ◆ ◆ ◆ ◆◆◆ ◆◆ "); ANSI_GotoXY(41,15); Uart_Print(UART1,"◆◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆"); ANSI_GotoXY(41,16); Uart_Print(UART1,"◆ ◆ ◆◆◆ ◆◆◆ ◆ ◆ ◆◆◆"); ANSI_GotoXY(41,18); Uart_Print(UART1," 로랩19기 표윤석"); ANSI_GotoXY(5,12); Uart_Print(UART1," [ MAIN MENU ] "); ANSI_GotoXY(5,14); Uart_Print(UART1," 1. 프로그램 "); ANSI_Line(21); ANSI_GotoXY(0,22); Uart_Print(UART1,"| 이전(B) 다음(N) 처음(S) 도움말(H) 종료(Q) |"); ANSI_Line(23); ANSI_GotoXY(0,24); Uart_Print(UART1,"명령어 >"); ANSI_Normal(); }
int main(){ int muxpin[4] = {19,18,17,16}; Uart_Init(57600); Uart_Print("Uart Inited\n\r"); SPI_InitMaster(16); Mux_Init(&MBMux,20,muxpin); Encoder_Init(&MBMux); Uart_Print("SPI Encoder Inited\n\r"); Joystick_Init(); GPIO_Init(31,OUTPUT); Timer_Init(0,100,Timer_Rountine); return 0; }
void Syslog64(const INT8 * str, UINT64 value) { INT8 valueStr[20]; if(str) { Uart_Print(DEBUG_UART_CHANNEL, str); } itoa64(value, valueStr); Uart_Print(DEBUG_UART_CHANNEL, valueStr); if(str) { Uart_Print(DEBUG_UART_CHANNEL, "\n"); } }
void Syslog32(const INT8 * str, UINT32 value) { INT8 valueStr[12]; if(str) { Uart_Print(DEBUG_UART_CHANNEL, str); } itoa(value, valueStr); Uart_Print(DEBUG_UART_CHANNEL, valueStr); if(str) { Uart_Print(DEBUG_UART_CHANNEL, "\n"); } }
void panic(const INT8 * format, ...) { // TODO: Need to print whole formatted string Uart_Print(DEBUG_UART_CHANNEL, format); // TODO: Implement this function while(1); }
void SyslogStr(const INT8 * str, const INT8 * value) { // TODO: OS Log should be handled using a different buffer to be fast if(str) { Uart_Print(DEBUG_UART_CHANNEL, str); } if(value) { Uart_Print(DEBUG_UART_CHANNEL, value); } if(str) { Uart_Print(DEBUG_UART_CHANNEL, "\n"); } }
/** * @brief Send out a Interger * * Number of digits of the num is limited by arm_math * * @param num number to be sent * @see Uart_SendChar * @see numDigi * */ void Uart_SendInt(int num){ int digi; int i; digi=numDigi(num); if (num<0){ Uart_Print("-"); num = -1*num; } for (i=digi-1;i>=0;i--){ Uart_SendChar('0'+(int)(num/pow10(i))%10); } return; }
//------------------------------------------------------------------------------ // === Main Function === //------------------------------------------------------------------------------ void main(void) { Init_Main(); // 초기화_MCU Position_Homing(); while(1) { //-------------------------------------------------------------------------- // === Function Module === //-------------------------------------------------------------------------- //PacketManager((PARTNER_PACKET*)&pPacket, (UART_CONTEXT*)&pContext ); //_delay_ms(5); // delay. NECESSARY!!! if(RXstate == RXEND) { Mode = MODE_RUN; for(U08 cnt=0; cnt<RXLENGTH; cnt++) { Uart_Print(1,"\n\r Xcod : "); Uart_U08Bit_PutNum(1, CoordinateX[cnt]); Uart_Print(1," Ycod : "); Uart_U08Bit_PutNum(1, CoordinateY[cnt]); Uart_Print(1," Zcod : "); Uart_U08Bit_PutNum(1, CoordinateZ[cnt]); Moving_XYCoordinate(CoordinateX[cnt],CoordinateY[cnt]); //Change ServoPWM } RXstate = RXREADY; SendRequestPacket(IND_TX_NEXTPAGE, 0x00); } //-------------------------------------------------------------------------- } }
/** * @brief Send out a floating point number * * @param num Number to be sent * * @see Uart_SendInt * @see Uart_SendChar * */ void Uart_SendFloat(float num){ int copy; if (num<0){ Uart_Print("-"); num = -1*num; } copy=(int)num; //print the first part as integer Uart_SendInt(copy); //print the decimal part Uart_SendChar('.'); Uart_SendChar('0'+(int)(num*10)%10); Uart_SendChar('0'+(int)(num*100)%10); Uart_SendChar('0'+(int)(num*1000)%10); Uart_SendChar('0'+(int)(num*10000)%10); return; }
//------------------------------------------------------------------------------ // ===== Help ===== //------------------------------------------------------------------------------ void View_Help(void) { ANSI_GotoXY(0,11); ANSI_ClearScreen(FROM); ANSI_Normal(); ANSI_GotoXY(5,12); Uart_Print(UART1," [ HELP ] "); ANSI_GotoXY(5,14); Uart_Print(UART1," ① 개발자 : 표윤석(ROLAB 19th)"); ANSI_GotoXY(5,15); Uart_Print(UART1," ② 소 속 : 광운대 로보트연구회"); ANSI_GotoXY(5,16); Uart_Print(UART1," ③ 버 전 : ANSI-MENU 1.0"); ANSI_GotoXY(5,17); Uart_Print(UART1," ④ 설 명 : ATmega128을 이용한 비쥬얼 메뉴구성"); ANSI_Line(21); ANSI_GotoXY(0,22); Uart_Print(UART1,"| 이전(B) 다음(N) 처음(S) 도움말(H) 종료(Q) |"); ANSI_Line(23); ANSI_GotoXY(0,24); Uart_Print(UART1,"명령어 >"); ANSI_Normal(); }
//------------------------------------------------------------------------------ // ===== 메인메뉴 ===== //------------------------------------------------------------------------------ void View_MainMenu(void) { ANSI_ClearScreen(ALL); // 터미널 전체 클리어 ANSI_Normal(); ANSI_Line(1); ANSI_Line(2); ANSI_Line(3); ANSI_Line(4); ANSI_Line(5); ANSI_Line(6); ANSI_Line(7); ANSI_Line(8); ANSI_GotoXY(5,3); Uart_Print(UART1,"■■■■■■■■■■\n"); ANSI_GotoXY(5,4); Uart_Print(UART1,"■ ■■■■■■■■■■\n"); ANSI_GotoXY(5,5); Uart_Print(UART1,"■ 광운대학교 ■■■\n"); ANSI_GotoXY(5,6); Uart_Print(UART1,"■■■ 로보트연구회(ROLAB) ■\n"); ANSI_GotoXY(5,7); Uart_Print(UART1,"──■■■ ■\n"); ANSI_GotoXY(5,8); Uart_Print(UART1,"────■■■■■■■■■■■■■■■■■\n"); ANSI_Line(9); ANSI_Line(10); ANSI_Reverse(1); ANSI_GotoXY(57,4); Uart_Print(UART1," KwangWoon University \r\n"); ANSI_GotoXY(58,6); Uart_Print(UART1," Robotics Laboratory \r\n"); ANSI_GotoXY(67,8); Uart_Print(UART1," SINCE 1985 \r\n"); ANSI_Reverse(0); ANSI_Normal(); ANSI_GotoXY(41,12); Uart_Print(UART1,"◆◆◆ ◆◆◆ ◆ ◆ ◆◆◆"); ANSI_GotoXY(41,13); Uart_Print(UART1,"◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆"); ANSI_GotoXY(41,14); Uart_Print(UART1,"◆◆◆ ◆ ◆ ◆ ◆◆◆ ◆◆ "); ANSI_GotoXY(41,15); Uart_Print(UART1,"◆◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆"); ANSI_GotoXY(41,16); Uart_Print(UART1,"◆ ◆ ◆◆◆ ◆◆◆ ◆ ◆ ◆◆◆"); ANSI_GotoXY(41,18); Uart_Print(UART1," 로랩19기 표윤석"); ANSI_GotoXY(6,12); Uart_Print(UART1, "========== M E N U =========="); ANSI_GotoXY(5,14); Uart_Print(UART1," 1. 프로그램 6. 프로그램 "); ANSI_GotoXY(5,15); Uart_Print(UART1," 2. 프로그램 7. 프로그램 "); ANSI_GotoXY(5,16); Uart_Print(UART1," 3. 프로그램 8. 프로그램 "); ANSI_GotoXY(5,17); Uart_Print(UART1," 4. 프로그램 9. 프로그램 "); ANSI_GotoXY(5,18); Uart_Print(UART1," 5. 프로그램 0. 프로그램 "); ANSI_Line(21); ANSI_GotoXY(0,22); Uart_Print(UART1,"| 이전(B) 다음(N) 처음(S) 도움말(H) 종료(Q) |"); ANSI_Line(23); ANSI_GotoXY(0,24); Uart_Print(UART1,"명령어 >"); ANSI_Normal(); }