Skip to content

CDC implementation #344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,9 @@ RemRam.menu.pnum.REMRAM_V1.build.variant=REMRAM_V1
RemRam.menu.pnum.REMRAM_V1.build.cmsis_lib_gcc=arm_cortexM7l_math

# Virtual COM port
#RemRam.menu.usb.none=None
#RemRam.menu.usb.CDC=CDC
#RemRam.menu.usb.CDC.build.enable_usb={build.usb_flags} -DUSBD_USE_CDC -DUSE_USB_FS
RemRam.menu.usb.none=None
RemRam.menu.usb.CDC=CDC
RemRam.menu.usb.CDC.build.enable_usb={build.usb_flags}

# Upload menu
RemRam.menu.upload_method.STLinkMethod=STLink
Expand Down
4 changes: 0 additions & 4 deletions cores/arduino/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ int main( void )
{
initVariant();

#if defined(USBCON)
usbd_interface_init();
#endif

setup();

for (;;)
Expand Down
14 changes: 13 additions & 1 deletion cores/arduino/stm32/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,8 @@ uint32_t getTimerIrq(TIM_TypeDef* tim)
void TimerHandleDeinit(stimer_t *obj)
{
if(obj != NULL) {
HAL_TIM_Base_DeInit(&(obj->handle));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be fixed independently on this PR..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could include it, since @fpistm won't merge this right away. Can you write a patch?

HAL_TIM_Base_Stop_IT(&(obj->handle));
HAL_TIM_Base_DeInit(&(obj->handle));
}
}

Expand Down Expand Up @@ -1015,6 +1015,18 @@ void attachIntHandle(stimer_t *obj, void (*irqHandle)(stimer_t *))
obj->irqHandle = irqHandle;
}

/**
* @brief Attached an interrupt handler
* @param htim : TIM handle
* @param irqHandle : interrupt handler
* @retval none
*/
void timer_attach_interrupt_handle(TIM_HandleTypeDef *htim, void (*irqHandle)(stimer_t *))
{
stimer_t *obj = get_timer_obj(htim);
obj->irqHandle = irqHandle;
}


/******************************************************************************/
/* TIMx IRQ HANDLER */
Expand Down
1 change: 1 addition & 0 deletions cores/arduino/stm32/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ struct timer_s{

void timer_enable_clock(TIM_HandleTypeDef *htim);
void timer_disable_clock(TIM_HandleTypeDef *htim);
void timer_attach_interrupt_handle(TIM_HandleTypeDef *htim, void (*irqHandle)(stimer_t *));

void TimerHandleInit(stimer_t *obj, uint16_t period, uint16_t prescaler);
void TimerHandleDeinit(stimer_t *obj);
Expand Down
173 changes: 0 additions & 173 deletions cores/arduino/stm32/usb_interface.c

This file was deleted.

16 changes: 16 additions & 0 deletions libraries/USBSerial/examples/USBSerial/USBSerial.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <USBSerial.h>

void setup() {
// Default baudrate is set to 9600
SerialUSB.begin();
}

void loop() {
SerialUSB.println("Hello world!");
delay(1000);

while(SerialUSB.available()) {
char c = SerialUSB.read();
SerialUSB.print(c);
}
}
9 changes: 9 additions & 0 deletions libraries/USBSerial/library.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name=USB Serial
version=1.0.0
author=Wi6Labs
maintainer=STMicroelectronics
sentence=Provides USB CDC class.
paragraph=
category=Device Control
url=https://github.com/stm32duino/Arduino_Core_STM32
architectures=stm32
Loading