Yepp there are a few issues in here:
The type "void*"of the first argument is missing:
void recognize_connected(
event_handler_arg, // errror is here
esp_event_base_t event_base,
int32_t event_id,
void* event_data) {
should be:
void recognize_connected(
void* event_handler_arg,
esp_event_base_t event_base,
int32_t event_id,
void* event_data) {
The same applies to recognize_disconnected.
Serial.onEvent(ARDUINO_USB_CDC_CONNECTED_EVENT, &recognize_connected);
Serial.onEvent(ARDUINO_USB_CDC_DISCONNECTED_EVENT, &recognize_disconnected);
Should be
Serial.onEvent(ARDUINO_USB_CDC_CONNECTED_EVENT, recognize_connected);
Serial.onEvent(ARDUINO_USB_CDC_DISCONNECTED_EVENT, recognize_disconnected);
(without “&”!)
Your board.json comes with -DARDUINO_USB_MODE=1
You have to unflag this by
bulid_unflags =
-DARDUINO_USB_MODE