📄 console.c
字号:
/******************************************************************************
uC/OS-II Porting for LPC210x
By: Pary WU <parywu@mail2000.com.tw>
History:
0406271325:parywu
The first stable release.
******************************************************************************/
#include "console.h"
void console_init(void){
// console uses UART0
rPINSEL0 = (rPINSEL0 & 0xfffffff0) | 0x05;
rU0LCR = 0x80;
rU0DLM = vU0DLM;
rU0DLL = vU0DLL;
rU0LCR = vU0LCR;
rU0IER = 0x00; // clear interrupt; console do NOT use interrupt
}
char console_getch(void){
while(!(rU0LSR&(0x01<<0)))
continue;
return rU0RBR;
}
void console_putch(char c){
while(!(rU0LSR & (0x01<<5)))
continue;
rU0THR = c;
}
void console_putstr(char* str){
while(*str)
console_putch(*str++);
}
void console_puthex(unsigned int v){
unsigned int i;
unsigned char ab[]="0123456789abcdef";
for(i=0;i<8;i++)
console_putch( ab[((v >> ((7-i) << 2)) & 0x0000000f)] );
}
void console_putbin(unsigned int v){
unsigned int i;
for(i=0;i<32;i++)
console_putch((char)('0' + (unsigned char)((v >> (31-i))&0x00000001)));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -