summaryrefslogtreecommitdiff
path: root/cc3200/mods/pybuart.c
diff options
context:
space:
mode:
authorDaniel Campora <daniel@wipy.io>2015-09-25 15:20:07 +0200
committerDaniel Campora <daniel@wipy.io>2015-09-27 11:27:24 +0200
commitef369249cb406758ec1caa9a212478ef69fd7ff0 (patch)
tree3b8e4b4358417693179b488dd79cb3b232538a6b /cc3200/mods/pybuart.c
parenta7261ae059f171e9677a86c59c7f7ed9e24b7ace (diff)
cc3200: Implement support for os.dupterm().
Diffstat (limited to 'cc3200/mods/pybuart.c')
-rw-r--r--cc3200/mods/pybuart.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/cc3200/mods/pybuart.c b/cc3200/mods/pybuart.c
index 213000975..41819d4f5 100644
--- a/cc3200/mods/pybuart.c
+++ b/cc3200/mods/pybuart.c
@@ -55,6 +55,7 @@
#include "pin.h"
#include "pybpin.h"
#include "pins.h"
+#include "moduos.h"
/// \moduleref pyb
/// \class UART - duplex serial communication bus
@@ -168,15 +169,6 @@ bool uart_tx_strn(pyb_uart_obj_t *self, const char *str, uint len) {
return true;
}
-void uart_tx_strn_cooked(pyb_uart_obj_t *self, const char *str, uint len) {
- for (const char *top = str + len; str < top; str++) {
- if (*str == '\n') {
- uart_tx_char(self, '\r');
- }
- uart_tx_char(self, *str);
- }
-}
-
/******************************************************************************
DEFINE PRIVATE FUNCTIONS
******************************************************************************/
@@ -261,12 +253,10 @@ STATIC void UARTGenericIntHandler(uint32_t uart_id) {
MAP_UARTIntClear(self->reg, UART_INT_RX | UART_INT_RT);
while (UARTCharsAvail(self->reg)) {
int data = MAP_UARTCharGetNonBlocking(self->reg);
- if (pyb_stdio_uart == self && data == user_interrupt_char) {
+ if (MP_STATE_PORT(os_term_dup_obj) && MP_STATE_PORT(os_term_dup_obj)->stream_o == self && data == user_interrupt_char) {
// raise an exception when interrupts are finished
mpexception_keyboard_nlr_jump();
- }
- // there's always a read buffer available
- else {
+ } else { // there's always a read buffer available
uint16_t next_head = (self->read_buf_head + 1) % PYBUART_RX_BUFFER_LEN;
if (next_head != self->read_buf_tail) {
// only store data if room in buf