save work

This commit is contained in:
nanosonde 2019-11-19 08:46:58 +01:00
parent 941f121d71
commit d2172073dd
3 changed files with 7 additions and 15 deletions

View File

@ -302,7 +302,6 @@ void CemiServer::frameReceived(CemiFrame& frame)
} }
} }
void CemiServer::loop() void CemiServer::loop()
{ {
_usbTunnelInterface.loop(); _usbTunnelInterface.loop();

View File

@ -21,7 +21,6 @@ class CemiServer
public: public:
/** /**
* The constructor. * The constructor.
* @param tunnelInterface The TunnelInterface of the KNX tunnel (e.g. USB or KNXNET/IP)
* @param bau methods are called here depending of the content of the APDU * @param bau methods are called here depending of the content of the APDU
*/ */
CemiServer(BauSystemB& bau); CemiServer(BauSystemB& bau);

View File

@ -5,13 +5,12 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <Adafruit_TinyUSB.h>
#define MIN(a, b) ((a < b) ? (a) : (b))
#define MAX_EP_SIZE 64 #define MAX_EP_SIZE 64
#define HID_HEADER_SIZE 3 #define HID_HEADER_SIZE 3
extern Adafruit_USBD_HID usb_hid; extern bool sendKnxHidReport(uint8_t* data, uint16_t length);
extern bool isKnxHidSendReportPossible();
uint16_t manufacturerId; uint16_t manufacturerId;
uint16_t maskVersion; uint16_t maskVersion;
@ -185,7 +184,7 @@ static void handleBusAccessServerProtocol(const uint8_t* requestData, uint16_t p
} }
Serial1.println(""); Serial1.println("");
*/ */
usb_hid.sendReport(0, data, MAX_EP_SIZE); sendKnxHidReport(data, MAX_EP_SIZE);
} }
} }
@ -223,17 +222,12 @@ void sendKnxTunnelHidReport(uint8_t* data, uint16_t length)
*/ */
// We do not use reportId of the sendReport()-API here but instead provide it in the first byte of the buffer // We do not use reportId of the sendReport()-API here but instead provide it in the first byte of the buffer
usb_hid.sendReport(0, buffer, MAX_EP_SIZE); sendKnxHidReport(buffer, MAX_EP_SIZE);
} }
// Invoked when received SET_REPORT control request or // Invoked when received SET_REPORT control request or
// received data on OUT endpoint ( Report ID = 0, Type = 0 ) void handleKnxHidReport(uint8_t const* data, uint16_t bufSize)
void set_report_callback(uint8_t report_id, hid_report_type_t report_type, uint8_t const* data, uint16_t bufSize)
{ {
// we don't use multiple report and report ID
(void) report_id;
(void) report_type;
if (bufSize!=MAX_EP_SIZE) if (bufSize!=MAX_EP_SIZE)
return; return;
@ -289,7 +283,7 @@ UsbTunnelInterface::UsbTunnelInterface(CemiServer& cemiServer,
void UsbTunnelInterface::loop() void UsbTunnelInterface::loop()
{ {
// Make sure that the USB HW is also ready to send another report // Make sure that the USB HW is also ready to send another report
if (!isTxQueueEmpty() && usb_hid.ready()) if (!isTxQueueEmpty() && isKnxHidSendReportPossible())
{ {
uint8_t* buffer; uint8_t* buffer;
uint16_t length; uint16_t length;