2424 * THE SOFTWARE.
2525 */
2626
27- // We can't include stdio.h because it defines _types_fd_set, but we
28- // need to use the CC3000 version of this type.
29-
30- #include <std.h>
3127#include <string.h>
3228#include <stdarg.h>
3329#include <errno.h>
@@ -531,9 +527,9 @@ STATIC mp_obj_t cc3k_ifconfig(mp_obj_t self_in) {
531527 mod_network_convert_ipv4_endianness (ipconfig .aucDHCPServer );
532528
533529 // render MAC address
534- char mac_str [ 18 ] ;
530+ VSTR_FIXED ( mac_vstr , 18 ) ;
535531 const uint8_t * mac = ipconfig .uaMacAddr ;
536- mp_uint_t mac_len = snprintf ( mac_str , 18 , "%02X :%02x:%02x:%02x:%02x:%02x" , mac [5 ], mac [4 ], mac [3 ], mac [2 ], mac [1 ], mac [0 ]);
532+ vstr_printf ( & mac_vstr , "%02x :%02x:%02x:%02x:%02x:%02x" , mac [5 ], mac [4 ], mac [3 ], mac [2 ], mac [1 ], mac [0 ]);
537533
538534 // create and return tuple with ifconfig info
539535 mp_obj_t tuple [7 ] = {
@@ -542,7 +538,7 @@ STATIC mp_obj_t cc3k_ifconfig(mp_obj_t self_in) {
542538 mod_network_format_ipv4_addr (ipconfig .aucDefaultGateway ),
543539 mod_network_format_ipv4_addr (ipconfig .aucDNSServer ),
544540 mod_network_format_ipv4_addr (ipconfig .aucDHCPServer ),
545- mp_obj_new_str (mac_str , mac_len , false),
541+ mp_obj_new_str (mac_vstr . buf , mac_vstr . len , false),
546542 mp_obj_new_str ((const char * )ipconfig .uaSSID , strlen ((const char * )ipconfig .uaSSID ), false),
547543 };
548544 return mp_obj_new_tuple (MP_ARRAY_SIZE (tuple ), tuple );
@@ -566,7 +562,7 @@ STATIC mp_obj_t cc3k_patch_program(mp_obj_t self_in, mp_obj_t key_in) {
566562 if (key [0 ] == 'p' && key [1 ] == 'g' && key [2 ] == 'm' && key [3 ] == '\0' ) {
567563 patch_prog_start ();
568564 } else {
569- printf ( "pass 'pgm' as argument in order to program\n" );
565+ mp_print_str ( & mp_plat_print , "pass 'pgm' as argument in order to program\n" );
570566 }
571567 return mp_const_none ;
572568}
0 commit comments