v1.2
This commit is contained in:
59
squeow_sw/Src/squeow_ui.c
Normal file
59
squeow_sw/Src/squeow_ui.c
Normal file
@@ -0,0 +1,59 @@
|
||||
#include <main.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stm32g4xx_hal_conf.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "squeow.h"
|
||||
#include "squeow_ui.h"
|
||||
|
||||
/* SQUEOW UI
|
||||
|
||||
|
||||
*/
|
||||
|
||||
// VU
|
||||
uint8_t vu_on, vu_value, vu_tmp_value;
|
||||
uint8_t adc_stampa;
|
||||
|
||||
uint8_t uart_sent;
|
||||
|
||||
// ################
|
||||
|
||||
void squeow_ui_init(void) {
|
||||
vu_on = 1;
|
||||
adc_stampa = 1;
|
||||
}
|
||||
|
||||
// seriow
|
||||
// https://git.lattuga.net/boyska/seriow
|
||||
|
||||
// 10hz
|
||||
void seriow_var_dump(void) {
|
||||
char buf[64];
|
||||
snprintf(buf, 64, "\e[3dDMP V=%lu T=%u C=%u D=%u R=%u\n", vu_value, adc2_valori[0], adc2_valori[1], adc2_valori[2], adc2_valori[3]);
|
||||
serial_write(buf, strlen(buf));
|
||||
vu_tmp_value = 0;
|
||||
}
|
||||
|
||||
// ogni 5sec
|
||||
void seriow_stab_dump(void) {
|
||||
char buf[64];
|
||||
snprintf(buf, 64, "DMP F=%lu\n", freq);
|
||||
serial_write(buf, strlen(buf));
|
||||
}
|
||||
|
||||
void seriow_log(uint8_t sev, char *msg) {
|
||||
char buf[64];
|
||||
snprintf(buf, 64, "\e[2dLOG %u %s\n", sev, msg);
|
||||
serial_write(buf, strlen(buf));
|
||||
}
|
||||
|
||||
int serial_write(char *ptr, int len) {
|
||||
// todo sia dma che it corrompono
|
||||
// HAL_UART_Transmit_DMA(&huart1, ptr, len);
|
||||
// HAL_UART_Transmit_IT(&huart1, ptr, len);
|
||||
HAL_UART_Transmit(&huart1, ptr, len, 1000);
|
||||
uart_sent = 0;
|
||||
return len;
|
||||
}
|
||||
Reference in New Issue
Block a user