Example #1
0
/**
 * Sends the current status of an endpoints to the USB host.
 * \param bEndpoint  Endpoint number.
 */
static void GetEndpointStatus(uint8_t bEndpoint)
{
    static unsigned short data;

    data = 0;

    switch (USBD_HAL_Halt(bEndpoint, 0xFF)) {

        case USBD_STATUS_INVALID_PARAMETER: /* the endpoint not exists */
            USBD_Stall(0);
            break;

        case 1:
            data = 1;
        case 0:
            /* Send the endpoint status */
            USBD_Write(0, &data, 2, 0, 0);
            break;
    }
}
Example #2
0
/**
 * Returns the current Halt status of an endpoint.
 * \param bEndpoint Index of endpoint
 * \return 1 if the endpoint is currently halted; otherwise 0
 */
uint8_t USBD_IsHalted(uint8_t bEndpoint)
{
    return USBD_HAL_Halt(bEndpoint, 0xFF);
}
Example #3
0
/**
 * Clears the Halt feature on the given endpoint.
 * \param bEndpoint Index of endpoint
 */
void USBD_Unhalt(uint8_t bEndpoint)
{
    USBD_HAL_Halt(bEndpoint, 0);
}
Example #4
0
/**
 * Sets the HALT feature on the given endpoint (if not already in this state).
 * \param bEndpoint Endpoint number.
 */
void USBD_Halt(uint8_t bEndpoint)
{
    USBD_HAL_Halt(bEndpoint, 1);
}