Skip to content

Commit de20127

Browse files
committed
doc: remove fake code snippets
We have API docs now Fixes #109
1 parent 8accf9a commit de20127

File tree

3 files changed

+0
-111
lines changed

3 files changed

+0
-111
lines changed

extmod/modbattery.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,13 @@
55
#include <pberror.h>
66
#include <pbdrv/battery.h>
77

8-
/*
9-
battery
10-
def voltage():
11-
"""Return battery voltage (mV: millivolt)."""
12-
*/
138
STATIC mp_obj_t battery_voltage(void) {
149
uint16_t volt;
1510
pb_assert(pbdrv_battery_get_voltage_now(PBIO_PORT_SELF, &volt));
1611
return mp_obj_new_int(volt);
1712
}
1813
STATIC MP_DEFINE_CONST_FUN_OBJ_0(battery_voltage_obj, battery_voltage);
1914

20-
/*
21-
battery
22-
def current():
23-
"""Return battery current (mA: milliampere)."""
24-
*/
2515
STATIC mp_obj_t battery_current(void) {
2616
uint16_t cur;
2717
pb_assert(pbdrv_battery_get_current_now(PBIO_PORT_SELF, &cur));

extmod/modpupdevices.c

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@
1212
#include "modcommon.h"
1313
#include "pberror.h"
1414

15-
/*
16-
class ColorAndDistSensor():
17-
"""Class for the Powered Up ColorAndDistSensor."""
18-
19-
def __init__(self, port):
20-
"""Initialize the ColorAndDistSensor.
21-
22-
Arguments:
23-
port -- Port on the hub: Port.A, Port.B, etc.
24-
"""
25-
*/
26-
2715
// Class structure for ColorAndDistSensor
2816
typedef struct _pupdevices_ColorAndDistSensor_obj_t {
2917
mp_obj_base_t base;
@@ -49,23 +37,12 @@ STATIC uint8_t pupdevices_ColorAndDistSensor_combined_mode(pbio_port_t port, uin
4937
return data[idx];
5038
}
5139

52-
/*
53-
ColorAndDistSensor
54-
def __str__(self):
55-
"""String representation of ColorAndDistSensor object."""
56-
*/
5740
STATIC void pupdevices_ColorAndDistSensor_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
5841
pupdevices_ColorAndDistSensor_obj_t *self = MP_OBJ_TO_PTR(self_in);
5942
mp_printf(print, qstr_str(MP_QSTR_ColorDistanceSensor));
6043
mp_printf(print, " on Port.%c", self->port);
6144
}
6245

63-
/*
64-
ColorAndDistSensor
65-
def color(self):
66-
"""Return the detected color.""""
67-
*/
68-
6946
STATIC mp_obj_t pupdevices_ColorAndDistSensor_color(mp_obj_t self_in) {
7047
pupdevices_ColorAndDistSensor_obj_t *self = MP_OBJ_TO_PTR(self_in);
7148
switch(pupdevices_ColorAndDistSensor_combined_mode(self->port, 0)) {
@@ -89,47 +66,25 @@ STATIC mp_obj_t pupdevices_ColorAndDistSensor_color(mp_obj_t self_in) {
8966
}
9067
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pupdevices_ColorAndDistSensor_color_obj, pupdevices_ColorAndDistSensor_color);
9168

92-
/*
93-
ColorAndDistSensor
94-
def distance(self):
95-
"""Returns distance to detected object, ranging from 0 (very close) to 10 (very far)."""
96-
*/
9769
STATIC mp_obj_t pupdevices_ColorAndDistSensor_distance(mp_obj_t self_in) {
9870
pupdevices_ColorAndDistSensor_obj_t *self = MP_OBJ_TO_PTR(self_in);
9971
return mp_obj_new_int(pupdevices_ColorAndDistSensor_combined_mode(self->port, 1));
10072
}
10173
MP_DEFINE_CONST_FUN_OBJ_1(pupdevices_ColorAndDistSensor_distance_obj, pupdevices_ColorAndDistSensor_distance);
10274

103-
104-
/*
105-
ColorAndDistSensor
106-
def reflection(self):
107-
"""Returns surface reflection, ranging from 0 (no reflection) to 100 (very high reflection)."""
108-
*/
10975
STATIC mp_obj_t pupdevices_ColorAndDistSensor_reflection(mp_obj_t self_in) {
11076
pupdevices_ColorAndDistSensor_obj_t *self = MP_OBJ_TO_PTR(self_in);
11177
return mp_obj_new_int(pupdevices_ColorAndDistSensor_combined_mode(self->port, 3));
11278
}
11379
MP_DEFINE_CONST_FUN_OBJ_1(pupdevices_ColorAndDistSensor_reflection_obj, pupdevices_ColorAndDistSensor_reflection);
11480

115-
/*
116-
ColorAndDistSensor
117-
def ambient(self):
118-
"""Returns ambient light intensity, ranging from 0 (darkness) to 100 (very bright light)."""
119-
*/
12081
STATIC mp_obj_t pupdevices_ColorAndDistSensor_ambient(mp_obj_t self_in) {
12182
pupdevices_ColorAndDistSensor_obj_t *self = MP_OBJ_TO_PTR(self_in);
12283
pb_assert(pb_iodevice_set_mode(self->port, 4));
12384
return pb_iodevice_get_values(self->port);
12485
}
12586
MP_DEFINE_CONST_FUN_OBJ_1(pupdevices_ColorAndDistSensor_ambient_obj, pupdevices_ColorAndDistSensor_ambient);
12687

127-
128-
/*
129-
ColorAndDistSensor
130-
def rgb(self):
131-
"""Returns surface reflection of red, green, and blue light, each ranging from 0 (no reflection) to 100 (very high reflection)."""
132-
*/
13388
STATIC mp_obj_t pupdevices_ColorAndDistSensor_rgb(mp_obj_t self_in) {
13489
pupdevices_ColorAndDistSensor_obj_t *self = MP_OBJ_TO_PTR(self_in);
13590
pb_assert(pb_iodevice_set_mode(self->port, 6));

extmod/modtools.c

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ STATIC mp_obj_t tools_wait(mp_obj_t arg) {
1616
}
1717
MP_DEFINE_CONST_FUN_OBJ_1(tools_wait_obj, tools_wait);
1818

19-
/*
20-
class StopWatch():
21-
"""Time the duration of a program or event."""
22-
*/
23-
2419
// Class structure for StopWatch
2520
typedef struct _tools_StopWatch_obj_t {
2621
mp_obj_base_t base;
@@ -30,15 +25,6 @@ typedef struct _tools_StopWatch_obj_t {
3025
bool running;
3126
} tools_StopWatch_obj_t;
3227

33-
/*
34-
StopWatch
35-
def reset(self):
36-
"""Set time to zero and pause."""
37-
self.time_start = get_time()
38-
self.time_stop = self.time_start
39-
self.time_spent_pausing = 0
40-
self.running = False
41-
*/
4228
STATIC mp_obj_t tools_StopWatch_reset(mp_obj_t self_in) {
4329
tools_StopWatch_obj_t *self = MP_OBJ_TO_PTR(self_in);
4430
self->time_start = mp_hal_ticks_ms();
@@ -48,20 +34,6 @@ STATIC mp_obj_t tools_StopWatch_reset(mp_obj_t self_in) {
4834
}
4935
STATIC MP_DEFINE_CONST_FUN_OBJ_1(tools_StopWatch_reset_obj, tools_StopWatch_reset);
5036

51-
/*
52-
StopWatch
53-
def time(self):
54-
"""Get the current time of the stopwatch.
55-
56-
Returns:
57-
int -- time in milliseconds
58-
59-
"""
60-
if self.running:
61-
return get_time()-self.time_start-self.time_spent_pausing
62-
else:
63-
return self.time_stop-self.time_start-self.time_spent_pausing
64-
*/
6537
STATIC mp_obj_t tools_StopWatch_time(mp_obj_t self_in) {
6638
tools_StopWatch_obj_t *self = MP_OBJ_TO_PTR(self_in);
6739
return mp_obj_new_int(
@@ -72,14 +44,6 @@ STATIC mp_obj_t tools_StopWatch_time(mp_obj_t self_in) {
7244
}
7345
STATIC MP_DEFINE_CONST_FUN_OBJ_1(tools_StopWatch_time_obj, tools_StopWatch_time);
7446

75-
/*
76-
StopWatch
77-
def pause(self):
78-
"""Pause the stopwatch."""
79-
if self.running:
80-
self.running = False
81-
self.time_stop = get_time()
82-
*/
8347
STATIC mp_obj_t tools_StopWatch_pause(mp_obj_t self_in) {
8448
tools_StopWatch_obj_t *self = MP_OBJ_TO_PTR(self_in);
8549
if (self->running) {
@@ -90,14 +54,6 @@ STATIC mp_obj_t tools_StopWatch_pause(mp_obj_t self_in) {
9054
}
9155
STATIC MP_DEFINE_CONST_FUN_OBJ_1(tools_StopWatch_pause_obj, tools_StopWatch_pause);
9256

93-
/*
94-
StopWatch
95-
def resume(self):
96-
"""Resume the stopwatch."""
97-
if not self.running:
98-
self.running = True
99-
self.time_spent_pausing += get_time()-self.time_stop
100-
*/
10157
STATIC mp_obj_t tools_StopWatch_resume(mp_obj_t self_in) {
10258
tools_StopWatch_obj_t *self = MP_OBJ_TO_PTR(self_in);
10359
if (!self->running) {
@@ -108,13 +64,6 @@ STATIC mp_obj_t tools_StopWatch_resume(mp_obj_t self_in) {
10864
}
10965
STATIC MP_DEFINE_CONST_FUN_OBJ_1(tools_StopWatch_resume_obj, tools_StopWatch_resume);
11066

111-
/*
112-
StopWatch
113-
def __init__(self):
114-
"""Create the StopWatch object, reset it, and start it."""
115-
self.reset()
116-
self.resume()
117-
*/
11867
STATIC mp_obj_t tools_StopWatch_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args ) {
11968
// Initialize self
12069
tools_StopWatch_obj_t *self = m_new_obj(tools_StopWatch_obj_t);
@@ -124,11 +73,6 @@ STATIC mp_obj_t tools_StopWatch_make_new(const mp_obj_type_t *type, size_t n_arg
12473
return MP_OBJ_FROM_PTR(self);
12574
}
12675

127-
/*
128-
StopWatch
129-
def __str__(self):
130-
"""String representation of StopWatch object."""
131-
*/
13276
STATIC void tools_StopWatch_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
13377
mp_printf(print, qstr_str(MP_QSTR_StopWatch));
13478
}

0 commit comments

Comments
 (0)