Skip to content

Commit

Permalink
ADD: cdc shell init/exit prototypes
Browse files Browse the repository at this point in the history
  • Loading branch information
r2axz committed Nov 13, 2020
1 parent b9ab739 commit 47f81b6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# General Target Settings
TARGET = bluepill-serial-monster
SRCS = main.c system_clock.c status_led.c usb_core.c usb_descriptors.c usb_io.c usb_uid.c usb_panic.c usb_cdc.c
SRCS = main.c system_clock.c status_led.c usb_core.c usb_descriptors.c usb_io.c usb_uid.c usb_panic.c usb_cdc.c cdc_shell.c

# Toolchain & Utils
CC = arm-none-eabi-gcc
Expand Down
9 changes: 9 additions & 0 deletions cdc_shell.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "cdc_shell.h"

void cdc_shell_init() {

}

void cdc_shell_exit() {

}
7 changes: 7 additions & 0 deletions cdc_shell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef CDC_SHELL_H
#define CDC_SHELL_H

void cdc_shell_init();
void cdc_shell_exit();

#endif /* CDC_SHELL_H */
3 changes: 3 additions & 0 deletions usb_cdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "usb_core.h"
#include "usb_descriptors.h"
#include "usb_panic.h"
#include "cdc_shell.h"
#include "usb_cdc.h"

/* USB CDC Device Enabled Flag */
Expand Down Expand Up @@ -483,6 +484,7 @@ void usb_cdc_enter_config_mode() {
cdc_state->rx_buf.tail = cdc_state->rx_buf.head;
cdc_state->tx_buf.tail = cdc_state->tx_buf.head;
usart->CR1 &= ~(USART_CR1_RE);
cdc_shell_init();
usb_cdc_config_mode = 1;
}

Expand All @@ -492,6 +494,7 @@ void usb_cdc_leave_config_mode() {
cdc_state->rx_buf.tail = cdc_state->rx_buf.head;
cdc_state->tx_buf.tail = cdc_state->tx_buf.head;
usart->CR1 |= USART_CR1_RE;
cdc_shell_exit();
usb_cdc_config_mode = 0;
}

Expand Down

0 comments on commit 47f81b6

Please sign in to comment.