Commit 12992926 authored by Rahix's avatar Rahix

Merge 'Re-enable CDC-ACM after lockup when attached again'

See merge request !383
parents 4e81cb87 207657e3
Pipeline #4570 passed with stages
in 2 minutes and 50 seconds
......@@ -22,6 +22,8 @@
#include "FreeRTOS.h"
#include "task.h"
static volatile int lockup_disable = 0;
static inline struct config_descriptor_cdcacm *
descriptors(struct esb_config *self)
{
......@@ -36,15 +38,24 @@ static int cb_acm_read_ready(void)
return 0;
}
static int cb_acm_connected(void)
{
lockup_disable = 0;
return 0;
}
int esb_cdc_init(struct esb_config *self)
{
LOG_DEBUG("cdcacm", "init");
struct config_descriptor_cdcacm *dsc = descriptors(self);
usb_read_complete = 0;
int ret = acm_init(&dsc->comm_interface);
acm_register_callback(
ACM_CB_READ_READY,
cb_acm_read_ready); //SWYM: actually not needed
return acm_init(&dsc->comm_interface);
acm_register_callback(ACM_CB_CONNECTED, cb_acm_connected);
return ret;
}
int esb_cdc_configure(struct esb_config *self)
......@@ -96,7 +107,6 @@ uint8_t cdcacm_read(void)
void cdcacm_write(uint8_t *data, int len)
{
static int lockup_disable = 0;
if (acm_present() && !lockup_disable) {
int ret = acm_write(data, len);
if (ret < 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment