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