Skip to content

Commit bd42389

Browse files
committed
Fixed case of some CosmicUnicorn variables
1 parent ae252fb commit bd42389

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

micropython/modules/cosmic_unicorn/cosmic_unicorn.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,20 +131,20 @@ const mp_obj_type_t CosmicUnicorn_type = {
131131
#endif
132132

133133
/***** Globals Table *****/
134-
STATIC const mp_map_elem_t Cosmic_globals_table[] = {
134+
STATIC const mp_map_elem_t cosmic_globals_table[] = {
135135
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_cosmic) },
136136
{ MP_OBJ_NEW_QSTR(MP_QSTR_Channel), (mp_obj_t)&Channel_type },
137137
{ MP_OBJ_NEW_QSTR(MP_QSTR_CosmicUnicorn), (mp_obj_t)&CosmicUnicorn_type },
138138
};
139-
STATIC MP_DEFINE_CONST_DICT(mp_module_Cosmic_globals, Cosmic_globals_table);
139+
STATIC MP_DEFINE_CONST_DICT(mp_module_cosmic_globals, cosmic_globals_table);
140140

141141
/***** Module Definition *****/
142-
const mp_obj_module_t Cosmic_user_cmodule = {
142+
const mp_obj_module_t cosmic_user_cmodule = {
143143
.base = { &mp_type_module },
144-
.globals = (mp_obj_dict_t*)&mp_module_Cosmic_globals,
144+
.globals = (mp_obj_dict_t*)&mp_module_cosmic_globals,
145145
};
146146
#if MICROPY_VERSION <= 70144
147-
MP_REGISTER_MODULE(MP_QSTR_cosmic, Cosmic_user_cmodule, MODULE_Cosmic_ENABLED);
147+
MP_REGISTER_MODULE(MP_QSTR_cosmic, cosmic_user_cmodule, MODULE_COSMIC_ENABLED);
148148
#else
149-
MP_REGISTER_MODULE(MP_QSTR_cosmic, Cosmic_user_cmodule);
149+
MP_REGISTER_MODULE(MP_QSTR_cosmic, cosmic_user_cmodule);
150150
#endif

micropython/modules/cosmic_unicorn/cosmic_unicorn.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ mp_obj_t Channel_play_tone(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw
341341
/***** Variables Struct *****/
342342
typedef struct _CosmicUnicorn_obj_t {
343343
mp_obj_base_t base;
344-
CosmicUnicorn* Cosmic;
344+
CosmicUnicorn* cosmic;
345345
} _CosmicUnicorn_obj_t;
346346

347347
typedef struct _ModPicoGraphics_obj_t {
@@ -388,12 +388,12 @@ mp_obj_t CosmicUnicorn_make_new(const mp_obj_type_t *type, size_t n_args, size_t
388388
}
389389

390390

391-
CosmicUnicorn *Cosmic = m_new_class(CosmicUnicorn);
392-
Cosmic->init();
391+
CosmicUnicorn *cosmic = m_new_class(CosmicUnicorn);
392+
cosmic->init();
393393

394394
self = m_new_obj_with_finaliser(_CosmicUnicorn_obj_t);
395395
self->base.type = &CosmicUnicorn_type;
396-
self->Cosmic = Cosmic;
396+
self->cosmic = cosmic;
397397

398398
return MP_OBJ_FROM_PTR(self);
399399
}
@@ -402,70 +402,70 @@ mp_obj_t CosmicUnicorn_make_new(const mp_obj_type_t *type, size_t n_args, size_t
402402
/***** Destructor ******/
403403
mp_obj_t CosmicUnicorn___del__(mp_obj_t self_in) {
404404
_CosmicUnicorn_obj_t *self = MP_OBJ_TO_PTR2(self_in, _CosmicUnicorn_obj_t);
405-
m_del_class(CosmicUnicorn, self->Cosmic);
405+
m_del_class(CosmicUnicorn, self->cosmic);
406406
return mp_const_none;
407407
}
408408

409409

410410
/***** Methods *****/
411411
extern mp_obj_t CosmicUnicorn_clear(mp_obj_t self_in) {
412412
_CosmicUnicorn_obj_t *self = MP_OBJ_TO_PTR2(self_in, _CosmicUnicorn_obj_t);
413-
self->Cosmic->clear();
413+
self->cosmic->clear();
414414
return mp_const_none;
415415
}
416416

417417
extern mp_obj_t CosmicUnicorn_update(mp_obj_t self_in, mp_obj_t graphics_in) {
418418
_CosmicUnicorn_obj_t *self = MP_OBJ_TO_PTR2(self_in, _CosmicUnicorn_obj_t);
419419
ModPicoGraphics_obj_t *picographics = MP_OBJ_TO_PTR2(graphics_in, ModPicoGraphics_obj_t);
420420

421-
self->Cosmic->update(picographics->graphics);
421+
self->cosmic->update(picographics->graphics);
422422

423423
return mp_const_none;
424424
}
425425

426426
extern mp_obj_t CosmicUnicorn_set_brightness(mp_obj_t self_in, mp_obj_t value) {
427427
_CosmicUnicorn_obj_t *self = MP_OBJ_TO_PTR2(self_in, _CosmicUnicorn_obj_t);
428-
self->Cosmic->set_brightness(mp_obj_get_float(value));
428+
self->cosmic->set_brightness(mp_obj_get_float(value));
429429
return mp_const_none;
430430
}
431431

432432
extern mp_obj_t CosmicUnicorn_get_brightness(mp_obj_t self_in) {
433433
_CosmicUnicorn_obj_t *self = MP_OBJ_TO_PTR2(self_in, _CosmicUnicorn_obj_t);
434-
return mp_obj_new_float(self->Cosmic->get_brightness());
434+
return mp_obj_new_float(self->cosmic->get_brightness());
435435
}
436436

437437
extern mp_obj_t CosmicUnicorn_adjust_brightness(mp_obj_t self_in, mp_obj_t delta) {
438438
_CosmicUnicorn_obj_t *self = MP_OBJ_TO_PTR2(self_in, _CosmicUnicorn_obj_t);
439-
self->Cosmic->adjust_brightness(mp_obj_get_float(delta));
439+
self->cosmic->adjust_brightness(mp_obj_get_float(delta));
440440
return mp_const_none;
441441
}
442442

443443
extern mp_obj_t CosmicUnicorn_set_volume(mp_obj_t self_in, mp_obj_t value) {
444444
_CosmicUnicorn_obj_t *self = MP_OBJ_TO_PTR2(self_in, _CosmicUnicorn_obj_t);
445-
self->Cosmic->set_volume(mp_obj_get_float(value));
445+
self->cosmic->set_volume(mp_obj_get_float(value));
446446
return mp_const_none;
447447
}
448448

449449
extern mp_obj_t CosmicUnicorn_get_volume(mp_obj_t self_in) {
450450
_CosmicUnicorn_obj_t *self = MP_OBJ_TO_PTR2(self_in, _CosmicUnicorn_obj_t);
451-
return mp_obj_new_float(self->Cosmic->get_volume());
451+
return mp_obj_new_float(self->cosmic->get_volume());
452452
}
453453

454454
extern mp_obj_t CosmicUnicorn_adjust_volume(mp_obj_t self_in, mp_obj_t delta) {
455455
_CosmicUnicorn_obj_t *self = MP_OBJ_TO_PTR2(self_in, _CosmicUnicorn_obj_t);
456-
self->Cosmic->adjust_volume(mp_obj_get_float(delta));
456+
self->cosmic->adjust_volume(mp_obj_get_float(delta));
457457
return mp_const_none;
458458
}
459459

460460

461461
extern mp_obj_t CosmicUnicorn_light(mp_obj_t self_in) {
462462
_CosmicUnicorn_obj_t *self = MP_OBJ_TO_PTR2(self_in, _CosmicUnicorn_obj_t);
463-
return mp_obj_new_float(self->Cosmic->light());
463+
return mp_obj_new_float(self->cosmic->light());
464464
}
465465

466466
extern mp_obj_t CosmicUnicorn_is_pressed(mp_obj_t self_in, mp_obj_t button) {
467467
_CosmicUnicorn_obj_t *self = MP_OBJ_TO_PTR2(self_in, _CosmicUnicorn_obj_t);
468-
return mp_obj_new_bool(self->Cosmic->is_pressed((uint8_t)mp_obj_get_int(button)));
468+
return mp_obj_new_bool(self->cosmic->is_pressed((uint8_t)mp_obj_get_int(button)));
469469
}
470470

471471
extern mp_obj_t CosmicUnicorn_play_sample(mp_obj_t self_in, mp_obj_t data) {
@@ -477,21 +477,21 @@ extern mp_obj_t CosmicUnicorn_play_sample(mp_obj_t self_in, mp_obj_t data) {
477477
mp_raise_ValueError("Supplied buffer is too small!");
478478
}
479479

480-
self->Cosmic->play_sample((uint8_t *)bufinfo.buf, bufinfo.len);
480+
self->cosmic->play_sample((uint8_t *)bufinfo.buf, bufinfo.len);
481481

482482
return mp_const_none;
483483
}
484484

485485
extern mp_obj_t CosmicUnicorn_play_synth(mp_obj_t self_in) {
486486
_CosmicUnicorn_obj_t *self = MP_OBJ_TO_PTR2(self_in, _CosmicUnicorn_obj_t);
487-
self->Cosmic->play_synth();
487+
self->cosmic->play_synth();
488488

489489
return mp_const_none;
490490
}
491491

492492
extern mp_obj_t CosmicUnicorn_stop_playing(mp_obj_t self_in) {
493493
_CosmicUnicorn_obj_t *self = MP_OBJ_TO_PTR2(self_in, _CosmicUnicorn_obj_t);
494-
self->Cosmic->stop_playing();
494+
self->cosmic->stop_playing();
495495

496496
return mp_const_none;
497497
}
@@ -509,7 +509,7 @@ extern mp_obj_t CosmicUnicorn_synth_channel(mp_obj_t self_in, mp_obj_t channel_i
509509
// Could very easily mess up in weird ways once object deletion is considered?
510510
_Channel_obj_t *channel_obj = m_new_obj_with_finaliser(_Channel_obj_t);
511511
channel_obj->base.type = &Channel_type;
512-
channel_obj->channel = &self->Cosmic->synth_channel(channel);
512+
channel_obj->channel = &self->cosmic->synth_channel(channel);
513513

514514
return MP_OBJ_FROM_PTR(channel_obj);
515515
}

0 commit comments

Comments
 (0)