Skip to content

Commit 2764a8e

Browse files
committed
stmhal: Remove std.h. It's not needed anymore.
1 parent f53a8e7 commit 2764a8e

File tree

3 files changed

+9
-51
lines changed

3 files changed

+9
-51
lines changed

drivers/cc3000/src/inet_ntop.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@
1515
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1616
*/
1717

18-
#include <std.h>
1918
#include <string.h>
2019
#include "cc3000_common.h"
2120
#include "socket.h"
2221
#include "inet_ntop.h"
2322

23+
// We can't include stdio.h because it defines _types_fd_set, but we
24+
// need to use the CC3000 version of this type. So we must provide
25+
// our own declaration of snprintf. Grrr.
26+
int snprintf(char *str, size_t size, const char *fmt, ...);
27+
2428
#define IN6ADDRSZ 16
2529
#define INADDRSZ 4
2630
#define INT16SZ 2

stmhal/modnwcc3k.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
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
}

stmhal/std.h

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)