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.
33 lines
658 B
33 lines
658 B
/*
|
|
* usb_cmd_mbx.cpp
|
|
*
|
|
* Created on: Jul 23, 2021
|
|
* Author: Andreas Berthoud
|
|
*/
|
|
|
|
#include <queue>
|
|
#include "string.h"
|
|
#include "usb_cmd_mbx.h"
|
|
|
|
|
|
std::queue<raw_command_t> raw_usb_command_queue;
|
|
|
|
void push_usb_command(uint8_t * payload_ptr, uint16_t length) {
|
|
raw_command_t command = {
|
|
.size = length,
|
|
};
|
|
|
|
memcpy(command.payload, payload_ptr, length);
|
|
raw_usb_command_queue.push(command);
|
|
return;
|
|
}
|
|
|
|
uint8_t get_number_of_usb_commands_in_mailbox() {
|
|
return raw_usb_command_queue.size();
|
|
}
|
|
|
|
raw_command_t pop_usb_command() {
|
|
raw_command_t command = raw_usb_command_queue.front();
|
|
raw_usb_command_queue.pop();
|
|
return command;
|
|
}
|
|
|