mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-31 09:07:46 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a56d5e216 |
@@ -68,6 +68,20 @@ func (dev *USBDevice) Configure(config UARTConfig) {
|
|||||||
dev.initcomplete = true
|
dev.initcomplete = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attach connects the device to the USB bus, allowing the host to detect and
|
||||||
|
// enumerate it. It can be used together with Detach to delay enumeration
|
||||||
|
// until the USB configuration (device identifiers, classes, ...) is complete.
|
||||||
|
func (dev *USBDevice) Attach() {
|
||||||
|
sam.USB_DEVICE.CTRLB.ClearBits(sam.USB_DEVICE_CTRLB_DETACH)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detach disconnects the device from the USB bus. To the host this appears
|
||||||
|
// as if the device was unplugged. A subsequent Attach makes the host
|
||||||
|
// enumerate the device again.
|
||||||
|
func (dev *USBDevice) Detach() {
|
||||||
|
sam.USB_DEVICE.CTRLB.SetBits(sam.USB_DEVICE_CTRLB_DETACH)
|
||||||
|
}
|
||||||
|
|
||||||
func handlePadCalibration() {
|
func handlePadCalibration() {
|
||||||
// Load Pad Calibration data from non-volatile memory
|
// Load Pad Calibration data from non-volatile memory
|
||||||
// This requires registers that are not included in the SVD file.
|
// This requires registers that are not included in the SVD file.
|
||||||
|
|||||||
@@ -71,6 +71,20 @@ func (dev *USBDevice) Configure(config UARTConfig) {
|
|||||||
dev.initcomplete = true
|
dev.initcomplete = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attach connects the device to the USB bus, allowing the host to detect and
|
||||||
|
// enumerate it. It can be used together with Detach to delay enumeration
|
||||||
|
// until the USB configuration (device identifiers, classes, ...) is complete.
|
||||||
|
func (dev *USBDevice) Attach() {
|
||||||
|
sam.USB_DEVICE.CTRLB.ClearBits(sam.USB_DEVICE_CTRLB_DETACH)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detach disconnects the device from the USB bus. To the host this appears
|
||||||
|
// as if the device was unplugged. A subsequent Attach makes the host
|
||||||
|
// enumerate the device again.
|
||||||
|
func (dev *USBDevice) Detach() {
|
||||||
|
sam.USB_DEVICE.CTRLB.SetBits(sam.USB_DEVICE_CTRLB_DETACH)
|
||||||
|
}
|
||||||
|
|
||||||
func handlePadCalibration() {
|
func handlePadCalibration() {
|
||||||
// Load Pad Calibration data from non-volatile memory
|
// Load Pad Calibration data from non-volatile memory
|
||||||
// This requires registers that are not included in the SVD file.
|
// This requires registers that are not included in the SVD file.
|
||||||
|
|||||||
@@ -89,6 +89,21 @@ func (dev *USBDevice) Configure(config UARTConfig) {
|
|||||||
dev.initcomplete = true
|
dev.initcomplete = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attach connects the device to the USB bus by enabling the DP pull-up,
|
||||||
|
// allowing the host to detect and enumerate it. It can be used together with
|
||||||
|
// Detach to delay enumeration until the USB configuration (device
|
||||||
|
// identifiers, classes, ...) is complete.
|
||||||
|
func (dev *USBDevice) Attach() {
|
||||||
|
nrf.USBD.USBPULLUP.Set(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detach disconnects the device from the USB bus by disabling the DP pull-up.
|
||||||
|
// To the host this appears as if the device was unplugged. A subsequent
|
||||||
|
// Attach makes the host enumerate the device again.
|
||||||
|
func (dev *USBDevice) Detach() {
|
||||||
|
nrf.USBD.USBPULLUP.Set(0)
|
||||||
|
}
|
||||||
|
|
||||||
func handleUSBIRQ(interrupt.Interrupt) {
|
func handleUSBIRQ(interrupt.Interrupt) {
|
||||||
if nrf.USBD.EVENTS_SOF.Get() == 1 {
|
if nrf.USBD.EVENTS_SOF.Get() == 1 {
|
||||||
nrf.USBD.EVENTS_SOF.Set(0)
|
nrf.USBD.EVENTS_SOF.Set(0)
|
||||||
|
|||||||
@@ -46,6 +46,21 @@ func (dev *USBDevice) Configure(config UARTConfig) {
|
|||||||
rp.USBCTRL_REGS.SIE_CTRL.SetBits(rp.USBCTRL_REGS_SIE_CTRL_PULLUP_EN)
|
rp.USBCTRL_REGS.SIE_CTRL.SetBits(rp.USBCTRL_REGS_SIE_CTRL_PULLUP_EN)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attach connects the device to the USB bus by enabling the DP pull-up,
|
||||||
|
// allowing the host to detect and enumerate it. It can be used together with
|
||||||
|
// Detach to delay enumeration until the USB configuration (device
|
||||||
|
// identifiers, classes, ...) is complete.
|
||||||
|
func (dev *USBDevice) Attach() {
|
||||||
|
rp.USBCTRL_REGS.SIE_CTRL.SetBits(rp.USBCTRL_REGS_SIE_CTRL_PULLUP_EN)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detach disconnects the device from the USB bus by disabling the DP pull-up.
|
||||||
|
// To the host this appears as if the device was unplugged. A subsequent
|
||||||
|
// Attach makes the host enumerate the device again.
|
||||||
|
func (dev *USBDevice) Detach() {
|
||||||
|
rp.USBCTRL_REGS.SIE_CTRL.ClearBits(rp.USBCTRL_REGS_SIE_CTRL_PULLUP_EN)
|
||||||
|
}
|
||||||
|
|
||||||
func handleUSBIRQ(intr interrupt.Interrupt) {
|
func handleUSBIRQ(intr interrupt.Interrupt) {
|
||||||
status := rp.USBCTRL_REGS.INTS.Get()
|
status := rp.USBCTRL_REGS.INTS.Get()
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,21 @@ func (dev *USBDevice) Configure(config UARTConfig) {
|
|||||||
rp.USB.SetMAIN_CTRL_PHY_ISO(0x0)
|
rp.USB.SetMAIN_CTRL_PHY_ISO(0x0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attach connects the device to the USB bus by enabling the DP pull-up,
|
||||||
|
// allowing the host to detect and enumerate it. It can be used together with
|
||||||
|
// Detach to delay enumeration until the USB configuration (device
|
||||||
|
// identifiers, classes, ...) is complete.
|
||||||
|
func (dev *USBDevice) Attach() {
|
||||||
|
rp.USB.SIE_CTRL.SetBits(rp.USB_SIE_CTRL_PULLUP_EN)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detach disconnects the device from the USB bus by disabling the DP pull-up.
|
||||||
|
// To the host this appears as if the device was unplugged. A subsequent
|
||||||
|
// Attach makes the host enumerate the device again.
|
||||||
|
func (dev *USBDevice) Detach() {
|
||||||
|
rp.USB.SIE_CTRL.ClearBits(rp.USB_SIE_CTRL_PULLUP_EN)
|
||||||
|
}
|
||||||
|
|
||||||
func handleUSBIRQ(intr interrupt.Interrupt) {
|
func handleUSBIRQ(intr interrupt.Interrupt) {
|
||||||
status := rp.USB.INTS.Get()
|
status := rp.USB.INTS.Get()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user