This repository was archived by the owner on Sep 16, 2024. It is now read-only.
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) {
156156}
157157STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (mod_pycom_heartbeat_obj , 0 , 1 , mod_pycom_heartbeat );
158158
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 ) {
160160#ifndef RGB_LED_DISABLE
161161 if (mperror_is_heartbeat_enabled ()) {
162162 nlr_raise (mp_obj_new_exception_msg (& mp_type_OSError , mpexception_os_request_not_possible ));
163163 }
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+ }
168171#else
169172 nlr_raise (mp_obj_new_exception_msg (& mp_type_OSError , "RGB Led Interface Disabled" ));
170173#endif
171174
172175 return mp_const_none ;
173176}
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 );
175178
176179STATIC mp_obj_t mod_pycom_ota_start (void ) {
177180 if (!updater_start ()) {
You can’t perform that action at this time.
0 commit comments