mirror of
https://github.com/armel/uv-k1-k5v3-firmware-custom.git
synced 2026-10-02 03:15:37 +00:00
39 lines
1.1 KiB
C
39 lines
1.1 KiB
C
/* Copyright 2025 muzkr https://github.com/muzkr
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*
|
|
*/
|
|
|
|
#include "driver/vcp.h"
|
|
#include "usb_config.h"
|
|
#include "py32f071_ll_bus.h"
|
|
|
|
uint8_t VCP_RxBuf[256];
|
|
uint32_t VCP_RxBufPointer = 0;
|
|
|
|
void VCP_Init()
|
|
{
|
|
// LL_APB1_GRP2_EnableClock(LL_APB1_GRP2_PERIPH_SYSCFG);
|
|
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA); // PA12:11
|
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USBD);
|
|
|
|
cdc_acm_rx_buf_t rx_buf = {
|
|
.buf = VCP_RxBuf,
|
|
.size = sizeof(VCP_RxBuf),
|
|
.write_pointer = &VCP_RxBufPointer,
|
|
};
|
|
cdc_acm_init(rx_buf);
|
|
|
|
NVIC_EnableIRQ(USBD_IRQn);
|
|
}
|