//////////////////////////////////////////////////////////////////
//
// App:			USB
// Author:		Milan Korinek
// Version:		1.0
// Notice:		USB functions and callbacks
//////////////////////////////////////////////////////////////////


#ifndef USB_H_
#define USB_H_

#include "support/support.h"

#define EP_INTERRUPT_IMMEDIATE_RW_BUFFER_SIZE 7

#define usb_enable() gpio_set_pin_high (USB_PIN_GPIO)
#define usb_disable() gpio_set_pin_low(USB_PIN_GPIO)


void usb_control_setup_out_basic_config_callback(void);
bool usb_control_setup_out_over_under_run(void);
void usb_control_setup_in_callback(void);
bool usb_control_setup_in_over_under_run(void);

void usb_interrupt_out_callback(udd_ep_status_t status, iram_size_t nb_transfered, udd_ep_id_t ep);
void usb_interrupt_in_send(void);
void usb_interrupt_in_send_callback(udd_ep_status_t status, iram_size_t nb_transfered, udd_ep_id_t ep);

void usb_bulk_out_callback(udd_ep_status_t status, iram_size_t nb_transfered, udd_ep_id_t ep);
void usb_bulk_in_send(void);
void usb_bulk_in_callback(udd_ep_status_t status, iram_size_t nb_transfered, udd_ep_id_t ep);


#endif /* USB_H_ */