diff options
| author | Jeff Epler <jepler@gmail.com> | 2020-04-13 08:51:35 -0500 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2020-04-14 18:24:59 -0500 |
| commit | 880fff80e904ef4b173d551742b7acde56114f0c (patch) | |
| tree | 9942c0427cc31bb08f299123e4abb80416b5e7f2 /shared-module | |
| parent | 5d328c3b449dbd0eaf40c2edc205fb7c5d381589 (diff) | |
protomatter: Respond to review comments
- rename oe_pin -> output_enable_pin
- improve and reorganize docstrings
- rename swapbuffers->refresh
- rename "paused" -> "brightness", change semantics slightly
- common_hal several functions
- clarify why the common_hal routines can't be used directly in the
protocol's function pointers
- whitespace cleanups
- remove prototypes for nonexistent functions
Diffstat (limited to 'shared-module')
| -rw-r--r-- | shared-module/_protomatter/Protomatter.c | 10 | ||||
| -rw-r--r-- | shared-module/_protomatter/allocator.h | 4 |
2 files changed, 10 insertions, 4 deletions
diff --git a/shared-module/_protomatter/Protomatter.c b/shared-module/_protomatter/Protomatter.c index 9f67bfad3..77ca63476 100644 --- a/shared-module/_protomatter/Protomatter.c +++ b/shared-module/_protomatter/Protomatter.c @@ -53,7 +53,7 @@ void common_hal_protomatter_protomatter_construct(protomatter_protomatter_obj_t self->oe_pin = oe_pin; self->latch_pin = latch_pin; self->doublebuffer = doublebuffer; - + self->timer = timer ? timer : common_hal_protomatter_timer_allocate(); if (self->timer == NULL) { mp_raise_ValueError(translate("No timer available")); @@ -90,7 +90,7 @@ void common_hal_protomatter_protomatter_reconstruct(protomatter_protomatter_obj_ } ProtomatterStatus stat = _PM_init(&self->core, - self->width, self->bit_depth, + self->width, self->bit_depth, self->rgb_count/6, self->rgb_pins, self->addr_count, self->addr_pins, self->clock_pin, self->latch_pin, self->oe_pin, @@ -192,3 +192,9 @@ void common_hal_protomatter_protomatter_set_paused(protomatter_protomatter_obj_t bool common_hal_protomatter_protomatter_get_paused(protomatter_protomatter_obj_t* self) { return self->paused; } + +void common_hal_protomatter_protomatter_refresh(protomatter_protomatter_obj_t* self) { + _PM_convert_565(&self->core, self->bufinfo.buf, self->width); + _PM_swapbuffer_maybe(&self->core); +} + diff --git a/shared-module/_protomatter/allocator.h b/shared-module/_protomatter/allocator.h index 1ae127de2..b7f517ce5 100644 --- a/shared-module/_protomatter/allocator.h +++ b/shared-module/_protomatter/allocator.h @@ -13,14 +13,14 @@ static inline void *_PM_allocator_impl(size_t sz) { if (gc_alloc_possible()) { return m_malloc(sz + sizeof(void*), true); } else { - supervisor_allocation *allocation = allocate_memory(align32_size(sz), false); + supervisor_allocation *allocation = allocate_memory(align32_size(sz), false); return allocation ? allocation->ptr : NULL; } } static inline void _PM_free_impl(void *ptr_in) { supervisor_allocation *allocation = allocation_from_ptr(ptr_in); - + if (allocation) { free_memory(allocation); } |
