You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
628 B
37 lines
628 B
//
|
|
// Created by MightyPork on 2018/03/31.
|
|
//
|
|
|
|
#ifndef GEX_NRF_MSG_QUEUE_H
|
|
#define GEX_NRF_MSG_QUEUE_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#define MQ_LEN 16
|
|
#define MQ_SLOT_LEN 64
|
|
|
|
typedef struct {
|
|
uint8_t packet[MQ_SLOT_LEN];
|
|
} MQSlot;
|
|
|
|
typedef struct {
|
|
MQSlot slots[MQ_LEN];
|
|
volatile uint32_t lr;
|
|
volatile uint32_t nw;
|
|
} MQueue;
|
|
|
|
extern MQueue usb_rxq;
|
|
extern MQueue usb_txq;
|
|
|
|
void mq_init(MQueue *mq);
|
|
|
|
bool mq_can_post(MQueue *mq);
|
|
|
|
bool mq_post(MQueue *mq, const uint8_t *buffer, uint32_t len);
|
|
|
|
bool mq_can_read(MQueue *mq);
|
|
|
|
bool mq_read(MQueue *mq, uint8_t *buffer);
|
|
|
|
#endif //GEX_NRF_MSG_QUEUE_H
|
|
|