Browse Source

cc3200: Improvements to terminal duplication.

pull/1516/head
danicampora 9 years ago
parent
commit
fca3308cc3
  1. 18
      cc3200/hal/cc3200_hal.c
  2. 2
      cc3200/mods/modussl.c

18
cc3200/hal/cc3200_hal.c

@ -31,13 +31,16 @@
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "py/mpstate.h"
#include MICROPY_HAL_H
#include "py/runtime.h"
#include "py/objstr.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "inc/hw_nvic.h"
#include "hw_memmap.h"
#include "py/mpstate.h"
#include "py/runtime.h"
#include MICROPY_HAL_H
#include "rom_map.h"
#include "interrupt.h"
#include "systick.h"
@ -142,7 +145,7 @@ void mp_hal_stdout_tx_strn(const char *str, uint32_t len) {
if (MP_OBJ_IS_TYPE(MP_STATE_PORT(os_term_dup_obj)->stream_o, &pyb_uart_type)) {
uart_tx_strn(MP_STATE_PORT(os_term_dup_obj)->stream_o, str, len);
} else {
MP_STATE_PORT(os_term_dup_obj)->write[2] = mp_obj_new_bytes((const byte*)str, len);
MP_STATE_PORT(os_term_dup_obj)->write[2] = mp_obj_new_str_of_type(&mp_type_str, (const byte *)str, len);
mp_call_method_n_kw(1, 0, MP_STATE_PORT(os_term_dup_obj)->write);
}
}
@ -181,10 +184,11 @@ int mp_hal_stdin_rx_chr(void) {
}
} else {
MP_STATE_PORT(os_term_dup_obj)->read[2] = mp_obj_new_int(1);
mp_obj_t rbytes = mp_call_method_n_kw(1, 0, MP_STATE_PORT(os_term_dup_obj)->read);
if (rbytes != mp_const_none) {
mp_obj_t data = mp_call_method_n_kw(1, 0, MP_STATE_PORT(os_term_dup_obj)->read);
// data len is > 0
if (mp_obj_is_true(data)) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(rbytes, &bufinfo, MP_BUFFER_READ);
mp_get_buffer_raise(data, &bufinfo, MP_BUFFER_READ);
return ((int *)(bufinfo.buf))[0];
}
}

2
cc3200/mods/modussl.c

@ -91,7 +91,7 @@ STATIC mp_obj_t mod_ssl_wrap_socket(mp_uint_t n_args, const mp_obj_t *pos_args,
goto arg_error;
}
// retrieve the file paths (with an 6 byte offset because to strip the '/flash' prefix)
// retrieve the file paths (with an 6 byte offset in order to strip it from the '/flash' prefix)
const char *keyfile = (args[1].u_obj == mp_const_none) ? NULL : &(mp_obj_str_get_str(args[1].u_obj)[6]);
const char *certfile = (args[2].u_obj == mp_const_none) ? NULL : &(mp_obj_str_get_str(args[2].u_obj)[6]);
const char *cafile = (args[5].u_obj == mp_const_none || args[4].u_int != SSL_CERT_REQUIRED) ?

Loading…
Cancel
Save