Clean up types
This commit is contained in:
parent
111c5f7200
commit
28977cd128
2
main.c
2
main.c
|
@ -72,7 +72,7 @@ int main(void) {
|
|||
/* Send any available data to the NFC CDC */
|
||||
if (!ringbuffer_empty(uart_to_usb_buf)) {
|
||||
unsigned len = ringbuffer_peek(uart_to_usb_buf, &buf[0], sizeof buf);
|
||||
if(usb_write_cdcacm(ACM_NFC, buf, len, 1)) {
|
||||
if(usb_write_cdcacm(ACM_NFC, &buf[0], len, 1)) {
|
||||
ringbuffer_skip(uart_to_usb_buf, len);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,8 @@ unsigned ringbuffer_level(ringbuffer *buf) {
|
|||
return size - tail + head;
|
||||
}
|
||||
|
||||
unsigned ringbuffer_add(ringbuffer *buf, uint8_t *dat, unsigned len) {
|
||||
unsigned ringbuffer_add(ringbuffer *buf, void *dat_, unsigned len) {
|
||||
uint8_t *dat = dat_;
|
||||
unsigned rem = ringbuffer_free(buf);
|
||||
unsigned head = buf->head;
|
||||
unsigned written = 0;
|
||||
|
@ -55,7 +56,8 @@ unsigned ringbuffer_empty(ringbuffer *buf) {
|
|||
return buf->head == buf->tail;
|
||||
}
|
||||
|
||||
unsigned ringbuffer_peek(ringbuffer *buf, uint8_t *dst, unsigned len) {
|
||||
unsigned ringbuffer_peek(ringbuffer *buf, void *dst_, unsigned len) {
|
||||
uint8_t *dst = dst_;
|
||||
unsigned level = ringbuffer_level(buf);
|
||||
unsigned size = buf->size;
|
||||
unsigned tail = buf->tail;
|
||||
|
@ -78,7 +80,7 @@ void ringbuffer_skip(ringbuffer *buf, unsigned len) {
|
|||
buf->tail = (buf->tail + len) % (buf->size);
|
||||
}
|
||||
|
||||
unsigned ringbuffer_get(ringbuffer *buf, uint8_t *dst, unsigned len) {
|
||||
unsigned ringbuffer_get(ringbuffer *buf, void *dst, unsigned len) {
|
||||
len = ringbuffer_peek(buf, dst, len);
|
||||
ringbuffer_skip(buf, len);
|
||||
return len;
|
||||
|
|
|
@ -26,10 +26,10 @@ unsigned ringbuffer_level(ringbuffer *buf);
|
|||
|
||||
unsigned ringbuffer_empty(ringbuffer *buf);
|
||||
|
||||
unsigned ringbuffer_add(ringbuffer *buf, uint8_t *dat, unsigned len);
|
||||
unsigned ringbuffer_add(ringbuffer *buf, void *dat, unsigned len);
|
||||
|
||||
unsigned ringbuffer_get(ringbuffer *buf, uint8_t *dst, unsigned len);
|
||||
unsigned ringbuffer_peek(ringbuffer *buf, uint8_t *dst, unsigned len);
|
||||
unsigned ringbuffer_get(ringbuffer *buf, void *dst, unsigned len);
|
||||
unsigned ringbuffer_peek(ringbuffer *buf, void *dst, unsigned len);
|
||||
void ringbuffer_skip(ringbuffer *buf, unsigned len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
2
usb.c
2
usb.c
|
@ -148,7 +148,7 @@ static void cdcacm_data_rx_cb(usbd_device *usbd_dev, uint8_t ep)
|
|||
}
|
||||
}
|
||||
|
||||
int usb_write_cdcacm(uint8_t acm, uint8_t *data, size_t len, int tries) {
|
||||
int usb_write_cdcacm(uint8_t acm, void *data, size_t len, int tries) {
|
||||
int i = 0;
|
||||
while (usbd_ep_write_packet(g_usbd_dev, (1 + 2 * acm) | 0x80, data, len) == 0 && ++i < tries)
|
||||
;
|
||||
|
|
Loading…
Reference in New Issue
Block a user