mirror of
https://github.com/eddyem/stm32samples.git
synced 2026-02-28 11:54:30 +03:00
fix Canon managing to new USB (CDC ACM)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
/*
|
||||
* This file is part of the canonmanage project.
|
||||
* Copyright 2022 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
||||
* Copyright 2023 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -17,17 +16,26 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef RINGBUFFER_H__
|
||||
#define RINGBUFFER_H__
|
||||
|
||||
#include "usbhw.h" // for USB_TXBUFSZ
|
||||
#if defined STM32F0
|
||||
#include <stm32f0.h>
|
||||
#elif defined STM32F1
|
||||
#include <stm32f1.h>
|
||||
#elif defined STM32F3
|
||||
#include <stm32f3.h>
|
||||
#endif
|
||||
|
||||
// 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
|
||||
volatile int busy; // == TRUE if buffer is busy now
|
||||
} ringbuffer;
|
||||
|
||||
int RB_read(char s[BLOCKSIZE]);
|
||||
int RB_write(const char *str, int l);
|
||||
|
||||
#endif // RINGBUFFER_H__
|
||||
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);
|
||||
int RB_clearbuf(ringbuffer *b);
|
||||
|
||||
Reference in New Issue
Block a user