mirror of
https://github.com/eddyem/stm32samples.git
synced 2026-02-28 11:54:30 +03:00
change F303's Makefile to version control; fixed bugs in F303 usb ringbuffer, add two buffers like in F0x2
This commit is contained in:
@@ -20,14 +20,20 @@
|
||||
#ifndef RINGBUFFER_H__
|
||||
#define RINGBUFFER_H__
|
||||
|
||||
#include "usbhw.h"
|
||||
#include <stm32f3.h>
|
||||
|
||||
// ring buffer size in bytes
|
||||
#define RBSIZE (512)
|
||||
// max reading portion size
|
||||
#define BLOCKSIZE (USB_TXBUFSZ)
|
||||
typedef struct{
|
||||
uint8_t *data; // data buffer
|
||||
const int length; // its length
|
||||
int head; // head index
|
||||
int tail; // tail index
|
||||
} ringbuffer;
|
||||
|
||||
int RB_read(char s[BLOCKSIZE]);
|
||||
void RB_write(const char *str, int l);
|
||||
int RB_read(ringbuffer *b, uint8_t *s, int len);
|
||||
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);
|
||||
void RB_clearbuf(ringbuffer *b);
|
||||
|
||||
#endif // RINGBUFFER_H__
|
||||
|
||||
Reference in New Issue
Block a user