Изменена логика работы с UART и обработки данных. Добавлен кольцевой буфер
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "stm32g431xx.h"
|
||||
|
||||
#define USART3_START_BYTE 0x59
|
||||
#define USART3_BUF_SIZE 64
|
||||
#define USART3_FRAME_SIZE 9
|
||||
#define LIDAR_MIN_DIST 0.01f
|
||||
#define LIDAR_MAX_DIST 40.0f
|
||||
@@ -26,7 +27,7 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t distance; // meters
|
||||
uint16_t distance; // cm
|
||||
uint16_t strength;
|
||||
uint16_t temperature;
|
||||
} lidar_data;
|
||||
@@ -37,6 +38,9 @@ void TIM7_DAC_IRQHandler();
|
||||
void USART3_IRQHandler();
|
||||
void lidar_update(lidar_data* lidar);
|
||||
|
||||
uint8_t usart_available();
|
||||
uint8_t usart_read();
|
||||
|
||||
void lidar_i2c2_init();
|
||||
static void i2c2_wait_txis();
|
||||
static void i2c2_wait_stop();
|
||||
|
||||
Reference in New Issue
Block a user