File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -156,22 +156,25 @@ STATIC mp_obj_t mod_pycom_heartbeat (mp_uint_t n_args, const mp_obj_t *args) {
156
156
}
157
157
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (mod_pycom_heartbeat_obj , 0 , 1 , mod_pycom_heartbeat );
158
158
159
- STATIC mp_obj_t mod_pycom_rgb_led (mp_obj_t o_color ) {
159
+ STATIC mp_obj_t mod_pycom_rgb_led (mp_uint_t n_args , const mp_obj_t * args ) {
160
160
#ifndef RGB_LED_DISABLE
161
161
if (mperror_is_heartbeat_enabled ()) {
162
162
nlr_raise (mp_obj_new_exception_msg (& mp_type_OSError , mpexception_os_request_not_possible ));
163
163
}
164
-
165
- uint32_t color = mp_obj_get_int (o_color );
166
- led_info .color .value = color ;
167
- led_set_color (& led_info , true, false);
164
+ if (n_args > 0 ){
165
+ uint32_t color = mp_obj_get_int (args [0 ]);
166
+ led_info .color .value = color ;
167
+ led_set_color (& led_info , true, false);
168
+ } else {
169
+ return mp_obj_new_int (led_info .color .value );
170
+ }
168
171
#else
169
172
nlr_raise (mp_obj_new_exception_msg (& mp_type_OSError , "RGB Led Interface Disabled" ));
170
173
#endif
171
174
172
175
return mp_const_none ;
173
176
}
174
- STATIC MP_DEFINE_CONST_FUN_OBJ_1 (mod_pycom_rgb_led_obj , mod_pycom_rgb_led );
177
+ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (mod_pycom_rgb_led_obj , 0 , 1 , mod_pycom_rgb_led );
175
178
176
179
STATIC mp_obj_t mod_pycom_ota_start (void ) {
177
180
if (!updater_start ()) {
You can’t perform that action at this time.
0 commit comments