stmhal: Update some inlined docs for network and CAN.

pull/954/head
Damien George 2014-10-31 01:11:55 +00:00
rodzic 47f349e7de
commit 1a8573ed0e
5 zmienionych plików z 28 dodań i 22 usunięć

Wyświetl plik

@ -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) },

Wyświetl plik

@ -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;

Wyświetl plik

@ -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) {

Wyświetl plik

@ -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);

Wyświetl plik

@ -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()");