#ifndef BLINKY_CDC_PROTO_TX_EVENT_H_ #define BLINKY_CDC_PROTO_TX_EVENT_H_ #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif struct cdc_proto_tx_event { struct app_event_header header; uint8_t type; struct event_dyndata dyndata; }; APP_EVENT_TYPE_DYNDATA_DECLARE(cdc_proto_tx_event); static inline int submit_cdc_proto_tx_event(uint8_t type, const uint8_t *payload, size_t payload_len) { struct cdc_proto_tx_event *event; if ((payload == NULL) && (payload_len > 0U)) { return -EINVAL; } event = new_cdc_proto_tx_event(payload_len); event->type = type; if (payload_len > 0U) { memcpy(event->dyndata.data, payload, payload_len); } APP_EVENT_SUBMIT(event); return 0; } #ifdef __cplusplus } #endif #endif /* BLINKY_CDC_PROTO_TX_EVENT_H_ */