31
31
#include "shared-bindings/microcontroller/__init__.h"
32
32
#include "shared-bindings/microcontroller/Pin.h"
33
33
#include "bindings/cyw43/__init__.h"
34
-
35
34
//| class CywPin:
36
35
//| """A class that represents a GPIO pin attached to the wifi chip.
37
36
//|
@@ -48,14 +47,42 @@ const mp_obj_type_t cyw43_pin_type = {
48
47
)
49
48
};
50
49
50
+ //| PM_STANDARD: int
51
+ //| """The standard power management mode"""
52
+ //| PM_AGGRESSIVE: int
53
+ //| """Aggressive power management mode for optimial power usage at the cost of performance"""
54
+ //| PM_PERFORMANCE: int
55
+ //| """Performance power management mode where more power is used to increase performance"""
56
+ //| PM_DISABLED: int
57
+ //| """Disable power management and always use highest power mode"""
58
+ //|
51
59
//| def set_power_management(value: int) -> None:
52
60
//| """Set the power management register
53
61
//|
54
- //| According to Raspberry Pi documentation, the value 0xa11140
55
- //| increases responsiveness at the cost of higher power usage.
62
+ //| For transmitter power, see ``wifi.Radio.txpower``.
63
+ //| This controls software power saving features inside the cyw43 chip.
64
+ //| it does not control transmitter power.
65
+ //|
66
+ //| The value is interpreted as a 24-bit hexadecimal number of the form
67
+ //| ``0x00adbrrm``.
68
+ //|
69
+ //| The low 4 bits, ``m``, are the power management mode:
70
+ //| * 0: disabled
71
+ //| * 1: aggressive power saving which reduces wifi throughput
72
+ //| * 2: Power saving with High througput
73
+ //|
74
+ //| The next 8 bits, ``r``, specify "the maximum time to wait before going back to sleep" for power management mode 2. The units of ``r`` are 10ms.
75
+ //|
76
+ //| The next 4 bits, ``b``, are the "wake period is measured in beacon periods".
77
+ //|
78
+ //| The next 4 bits, ``d``, specify the "wake interval measured in DTIMs. If this is set to 0, the wake interval is measured in beacon periods".
79
+ //|
80
+ //| The top 4 bits, ``a``, specifies the "wake interval sent to the access point"
56
81
//|
57
- //| Besides this value, there appears to be no other public documentation
58
- //| of the values that can be used.
82
+ //| Several ``PM_`` constants gathered from various sources are included
83
+ //| in this module. According to Raspberry Pi documentation, the value 0xa11140
84
+ //| (called `cyw43.PM_DISABLED` here) increases responsiveness at the cost of higher power
85
+ //| usage.
59
86
//| """
60
87
STATIC mp_obj_t cyw43_set_power_management (const mp_obj_t value_in ) {
61
88
mp_int_t value = mp_obj_get_int (value_in );
@@ -81,6 +108,10 @@ STATIC const mp_rom_map_elem_t cyw43_module_globals_table[] = {
81
108
{ MP_ROM_QSTR (MP_QSTR___name__ ), MP_ROM_QSTR (MP_QSTR_cyw43 ) },
82
109
{ MP_ROM_QSTR (MP_QSTR_CywPin ), MP_ROM_QSTR (MP_QSTR_CywPin ) },
83
110
{ MP_ROM_QSTR (MP_QSTR_set_power_management ), & cyw43_set_power_management_obj },
111
+ { MP_ROM_QSTR (MP_QSTR_PM_STANDARD ), MP_ROM_INT (PM_STANDARD ) },
112
+ { MP_ROM_QSTR (MP_QSTR_PM_AGGRESSIVE ), MP_ROM_INT (PM_AGGRESSIVE ) },
113
+ { MP_ROM_QSTR (MP_QSTR_PM_PERFORMANCE ), MP_ROM_INT (PM_PERFORMANCE ) },
114
+ { MP_ROM_QSTR (MP_QSTR_PM_DISABLED ), MP_ROM_INT (PM_DISABLED ) },
84
115
};
85
116
86
117
STATIC MP_DEFINE_CONST_DICT (cyw43_module_globals , cyw43_module_globals_table );
0 commit comments