~aleteoryx/muditaos

ref: 77d3b1a0c669b5982f7c72271499ee27bb4dc87a muditaos/module-bsp/bsp/usb/usb.hpp -rw-r--r-- 709 bytes
77d3b1a0 — Paweł Olejniczak [EGD-4506] Add proposal of basic bluetooth settings data flow (#1090) 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once

extern "C"
{
#include "FreeRTOS.h"
#include "task.h"
#include <queue.h>
}

#include <errno.h>
#include <iostream>
#include <log/log.hpp>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

inline constexpr auto SERIAL_BUFFER_LEN = 512;
inline constexpr auto  SERIAL_BAUDRATE = 115200;

namespace bsp
{
    class USBDeviceListener {
      public:
        virtual bool getRawMode() const noexcept{
            return false;
        }
        virtual void rawDataReceived(void *dataPtr, uint32_t dataLen) = 0;
    };

    int usbInit(xQueueHandle, USBDeviceListener *deviceListener = nullptr);
    int usbCDCReceive(void *ptr);
    int usbCDCSend(std::string *sendMsg);
} // namespace bsp