Last active
June 1, 2019 16:56
-
-
Save JNeiger/d21aef45f3ea5c2cda3cb267b4059142 to your computer and use it in GitHub Desktop.
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
#include "mtrain.hpp" | |
#include "bsp.h" | |
#include <unistd.h> | |
#include "PinDefs.hpp" | |
USBD_HandleTypeDef USBD_Device; | |
class TempObj { | |
public: | |
TempObj() {} | |
~TempObj() {} | |
}; | |
int main() { | |
USBD_Init(&USBD_Device, &VCP_Desc, 0); | |
USBD_RegisterClass(&USBD_Device, USBD_CDC_CLASS); | |
USBD_CDC_RegisterInterface(&USBD_Device, &USBD_CDC_fops); | |
USBD_Start(&USBD_Device); | |
TempObj t = TempObj(); | |
fflush(stdout); | |
for (;;) { | |
HAL_Delay(50); | |
HAL_Delay(50); | |
printf("t\r\n"); | |
fflush(stdout); | |
} | |
} | |
extern "C" { | |
int _write(int file, char *data, int len) | |
{ | |
if (file == STDOUT_FILENO) { | |
USBD_CDC_SetTxBuffer(&USBD_Device, (uint8_t*)data, len); | |
USBD_CDC_TransmitPacket(&USBD_Device); | |
} | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment