feat:(drawille) I realize that if I just send the unicode byte by byte, the terminal still take it with ASCII [0x2800->')']

This commit is contained in:
but0n 2016-12-20 18:29:43 +08:00
parent d8541a6f63
commit 80814e213a
4 changed files with 25 additions and 6 deletions

View File

@ -9,8 +9,10 @@
// |2 5|
// |6 7|
// ---
#define BRAILLE_OFFSET 0x2800
#define PIXEL(x) 1<<(x)
#define DRAW(bit) BRAILLE_OFFSET + (bit)
// #define BRAILLE_OFFSET 0x2800
#define PIX(x) (1<<(x))
// #define MAP(bit) BRAILLE_OFFSET + (bit)
void draw(char uni);
#endif

View File

@ -13,7 +13,7 @@
#define THROTTLE_MAX (unsigned short)3600 //2ms - top position of throttle
#define THROTTLE_MIN (unsigned short)1620 //0.9ms - bottom position of throttle
#define THROTTLE_MID (unsigned short)2200
#define THROTTLE_MID (unsigned short)1650
#ifdef MOTOR_NORMAL_STARTUP
#define MOTOR_SETTING() {\

View File

@ -1 +1,10 @@
// Needn't this file yet
#include "drawille.h"
// 1110 xxxx : 10xx xxxx : 10xx xxxx - UTF-8
// 0x2800 - braille unicode offset
// 0010 1000 : 0000 0000
void draw(char uni) { //unicode to UTF-8
uart_sendData(0xE2); //First byte must be 0xE2
uart_sendData(0xA0 | ((uni>>6) & 0b00000011));
uart_showData(0x80 | (uni & 0b00111111));
}

View File

@ -10,6 +10,7 @@
#include "wifi.h"
#include "pid.h"
#include "tty.h"
#include "drawille.h"
#define Kp 100.0f //比例增益支配率(常量)
#define Ki 0.002f //积分增益支配率
@ -182,6 +183,12 @@ void uart_debugPID() {
}
}
void drawille_task() {
while(1) {
draw(PIX(1));
}
}
int main() {
#ifdef DEBUG_BLDC
@ -196,7 +203,8 @@ int main() {
uart_sendStr("MPU6050 Connect Success!");
UART_CR();
xTaskCreate(uart_debugPID, "UART_TASK", 100, NULL, 1, NULL);
// xTaskCreate(uart_debugPID, "UART_TASK", 100, NULL, 1, NULL);
xTaskCreate(drawille_task, "UART_TASK", 100, NULL, 1, NULL);
xTaskCreate(mpu_task, "MPU_TASK", 100, NULL, 3, NULL);
xTaskCreate(pid_task, "PID_TASK", 100, NULL, 2, NULL);
vTaskStartScheduler();