-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
661 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#include "mhost.h" | ||
|
||
#include <stm32f7xx.h> | ||
|
||
// #include "usb_device.h" | ||
|
||
void MHost_Init(void){ | ||
// __HAL_RCC_GPIOB_CLK_ENABLE(); | ||
|
||
// GPIO_InitTypeDef g; | ||
// g.Pin = GPIO_PIN_12; | ||
// g.Mode = GPIO_MODE_OUTPUT_PP; | ||
// g.Pull = GPIO_NOPULL; | ||
// g.Speed = GPIO_SPEED_FAST; | ||
// HAL_GPIO_Init(GPIOB, &g); | ||
// HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12, 0); // immediately turn off power | ||
|
||
|
||
|
||
|
||
// from https://github.com/Hypnotriod/midi-box-stm32 | ||
// MX_USB_DEVICE_Init(); | ||
|
||
|
||
|
||
} | ||
|
||
void MHost_Task(void){ | ||
// MIDI_ProcessUSBData(); // see /midi_router.c | ||
} | ||
|
||
void MHost_Power(int status){ // enable/disable +5v to connected device | ||
// handled by the LL usbh driver | ||
// HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12, !!status); | ||
} | ||
|
||
// TODO support power error flag from usb switch | ||
|
||
/* | ||
void USB_LP_CAN1_RX0_IRQHandler(void) | ||
{ | ||
HAL_PCD_IRQHandler(&hpcd_USB_FS); | ||
} | ||
USBD_HandleTypeDef hUsbDeviceFS; | ||
void MX_USB_DEVICE_Init(void) | ||
{ | ||
// Init Device Library, add supported class and start the library. | ||
if (USBD_Init(&hUsbDeviceFS, &FS_Desc, DEVICE_FS) != USBD_OK) | ||
{ | ||
Error_Handler(); | ||
} | ||
if (USBD_RegisterClass(&hUsbDeviceFS, &USBD_MIDI) != USBD_OK) | ||
{ | ||
Error_Handler(); | ||
} | ||
if (USBD_Start(&hUsbDeviceFS) != USBD_OK) | ||
{ | ||
Error_Handler(); | ||
} | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#pragma once | ||
|
||
void MHost_Init(void); | ||
void MHost_Power(int status); // enable +5v to connected device | ||
|
||
/* | ||
// for the low-level driver | ||
// B12: PWR_ENABLE: set high to engage power to the connected device | ||
// B13: PWR_nERROR: set pullup. PSU pulls low if error occurs (need IRQ) | ||
// set PWR_ENABLE low if this occurs (TODO retry?) | ||
// B14: USB_D- | ||
// B15: USB_D+ | ||
#define MIDI_IN_PORTS_NUM 0x01 | ||
#define MIDI_OUT_PORTS_NUM 0x03 | ||
void USB_LP_CAN1_RX0_IRQHandler(void); | ||
extern PCD_HandleTypeDef hpcd_USB_FS; | ||
void MX_USB_DEVICE_Init(void); | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.