From 1a8573ed0ed72825a5cedc6a07277535aa2630fa Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 31 Oct 2014 01:11:55 +0000 Subject: [PATCH] stmhal: Update some inlined docs for network and CAN. --- stmhal/can.c | 4 ---- stmhal/modcc3k.c | 4 ++++ stmhal/modnetwork.c | 4 ++++ stmhal/modusocket.c | 8 +++++--- stmhal/modwiznet5k.c | 30 +++++++++++++++--------------- 5 files changed, 28 insertions(+), 22 deletions(-) diff --git a/stmhal/can.c b/stmhal/can.c index f0cd26f566..de1ef3ecd9 100644 --- a/stmhal/can.c +++ b/stmhal/can.c @@ -414,10 +414,6 @@ STATIC const mp_map_elem_t pyb_can_locals_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_recv), (mp_obj_t)&pyb_can_recv_obj }, // class constants - /// \constant MASTER - for initialising the bus to master mode - /// \constant SLAVE - for initialising the bus to slave mode - /// \constant MSB - set the first bit to MSB - /// \constant LSB - set the first bit to LSB // Note: we use the ST constants >> 4 so they fit in a small-int. The // right-shift is undone when the constants are used in the init function. { MP_OBJ_NEW_QSTR(MP_QSTR_NORMAL), MP_OBJ_NEW_SMALL_INT(CAN_MODE_NORMAL >> 4) }, diff --git a/stmhal/modcc3k.c b/stmhal/modcc3k.c index 7c35e76f68..7b908e8950 100644 --- a/stmhal/modcc3k.c +++ b/stmhal/modcc3k.c @@ -61,6 +61,8 @@ #include "netapp.h" #include "patch_prog.h" +/// \moduleref network + int CC3000_EXPORT(errno); // for cc3000 driver STATIC mp_obj_t cc3k_socket_new(mp_uint_t family, mp_uint_t type, mp_uint_t protocol, int *_errno); @@ -140,6 +142,8 @@ STATIC int cc3k_gethostbyname(mp_obj_t nic, const char *name, mp_uint_t len, uin /******************************************************************************/ // Micro Python bindings; CC3k class +/// \class CC3k - driver for CC3000 Wifi modules + typedef struct _cc3k_obj_t { mp_obj_base_t base; } cc3k_obj_t; diff --git a/stmhal/modnetwork.c b/stmhal/modnetwork.c index a0cd24de6b..c6723b182e 100644 --- a/stmhal/modnetwork.c +++ b/stmhal/modnetwork.c @@ -40,6 +40,10 @@ #include "runtime.h" #include "modnetwork.h" +/// \module network - network configuration +/// +/// This module provides network drivers and routing configuration. + mp_obj_list_t mod_network_nic_list; void mod_network_init(void) { diff --git a/stmhal/modusocket.c b/stmhal/modusocket.c index 6a544cb3e0..bab1087037 100644 --- a/stmhal/modusocket.c +++ b/stmhal/modusocket.c @@ -41,9 +41,11 @@ #include "runtime.h" #include "modnetwork.h" -/// \module usocket +/// \module usocket - socket module +/// +/// Socket functionality. -/// \method socket(family=AF_INET, type=SOCK_STREAM, fileno=-1) +/// \function socket(family=AF_INET, type=SOCK_STREAM, fileno=-1) /// Create a socket. STATIC mp_obj_t mod_usocket_socket(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { static const mp_arg_t allowed_args[] = { @@ -75,7 +77,7 @@ STATIC mp_obj_t mod_usocket_socket(mp_uint_t n_args, const mp_obj_t *pos_args, m } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mod_usocket_socket_obj, 0, mod_usocket_socket); -/// \method getaddrinfo(host, port) +/// \function getaddrinfo(host, port) STATIC mp_obj_t mod_usocket_getaddrinfo(mp_obj_t host_in, mp_obj_t port_in) { mp_uint_t hlen; const char *host = mp_obj_str_get_data(host_in, &hlen); diff --git a/stmhal/modwiznet5k.c b/stmhal/modwiznet5k.c index 0709371da0..e91bd502a7 100644 --- a/stmhal/modwiznet5k.c +++ b/stmhal/modwiznet5k.c @@ -48,21 +48,7 @@ #include "ethernet/socket.h" #include "internet/dns/dns.h" -/// \module wiznet5k - control WIZnet5x00 Ethernet adaptors -/// -/// This module allows you to control WIZnet5x00 Ethernet adaptors based on -/// the W5200 and W5500 chipsets (only W5200 tested). -/// -/// Example usage: -/// -/// import wiznet5k -/// w = wiznet5k.WIZnet5k() -/// print(w.ipaddr()) -/// w.gethostbyname('micropython.org') -/// s = w.socket() -/// s.connect(('192.168.0.2', 8080)) -/// s.send('hello') -/// print(s.recv(10)) +/// \moduleref network #define IPADDR_BUF_SIZE (4) @@ -164,6 +150,20 @@ STATIC int wiznet5k_gethostbyname(mp_obj_t nic, const char *name, mp_uint_t len, // Micro Python bindings /// \class WIZnet5k - driver for WIZnet5x00 Ethernet modules +/// +/// This class allows you to control WIZnet5x00 Ethernet adaptors based on +/// the W5200 and W5500 chipsets (only W5200 tested). +/// +/// Example usage: +/// +/// import wiznet5k +/// w = wiznet5k.WIZnet5k() +/// print(w.ipaddr()) +/// w.gethostbyname('micropython.org') +/// s = w.socket() +/// s.connect(('192.168.0.2', 8080)) +/// s.send('hello') +/// print(s.recv(10)) STATIC void wiznet5k_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) { print(env, "WIZnet5k()");