mirror of
https://github.com/avem-labs/Avem.git
synced 2023-09-01 15:18:49 +08:00
Merge from <feature-drawille>
This commit is contained in:
commit
d8ae32170e
18
libs/include/drawille.h
Normal file
18
libs/include/drawille.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef DRAWILLE_H
|
||||
#define DRAWILLE_H
|
||||
|
||||
#include "uart.h"
|
||||
|
||||
// ---
|
||||
// |0 3|
|
||||
// |1 4|
|
||||
// |2 5|
|
||||
// |6 7|
|
||||
// ---
|
||||
// #define BRAILLE_OFFSET 0x2800
|
||||
#define PIX(x) (1<<(x))
|
||||
// #define MAP(bit) BRAILLE_OFFSET + (bit)
|
||||
|
||||
void draw(unsigned char uni);
|
||||
|
||||
#endif
|
@ -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() {\
|
||||
|
10
libs/source/drawille.c
Normal file
10
libs/source/drawille.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include "drawille.h"
|
||||
|
||||
// 1110 xxxx : 10xx xxxx : 10xx xxxx - UTF-8
|
||||
// 0x2800 - braille unicode offset
|
||||
// 0010 1000 : 0000 0000
|
||||
void draw(unsigned char uni) { //unicode to UTF-8
|
||||
uart_sendData(0xE2); //First byte must be 0xE2
|
||||
uart_sendData(0xA0 | ((uni>>6) & 0b00000011));
|
||||
uart_sendData(0x80 | (uni & 0b00111111));
|
||||
}
|
10
src/main.c
10
src/main.c
@ -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(0)|PIX(1)|PIX(2)|PIX(3)|PIX(4)|PIX(5)|PIX(6)|PIX(7)));
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user