fixed USB

This commit is contained in:
Edward Emelianov
2026-03-23 23:08:08 +03:00
parent 45559545ef
commit 024d256563
16 changed files with 357 additions and 295 deletions

View File

@@ -17,6 +17,8 @@
#pragma once
#include <stdint.h>
#if defined STM32F0
#include <stm32f0.h>
#elif defined STM32F1
@@ -25,14 +27,12 @@
#include <stm32f3.h>
#endif
#include <stdatomic.h>
typedef struct{
uint8_t *data; // data buffer
const int length; // its length
int head; // head index
int tail; // tail index
volatile atomic_int busy; // == TRUE if buffer is busy now
volatile int busy; // == TRUE if buffer is busy now
} ringbuffer;
int RB_read(ringbuffer *b, uint8_t *s, int len);
@@ -40,4 +40,5 @@ int RB_readto(ringbuffer *b, uint8_t byte, uint8_t *s, int len);
int RB_hasbyte(ringbuffer *b, uint8_t byte);
int RB_write(ringbuffer *b, const uint8_t *str, int l);
int RB_datalen(ringbuffer *b);
int RB_datalento(ringbuffer *b, uint8_t byte);
int RB_clearbuf(ringbuffer *b);