-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial implementation of Smart Response XE display #673
Conversation
src/modm/ui/display/monochrome_graphic_display_horizontal_impl.hpp
Outdated
Show resolved
Hide resolved
c3e1336
to
d12edd8
Compare
afb1bc4
to
ab43133
Compare
b020d1c
to
d057e27
Compare
Okay, I think this is ready to go. I'm pretty happy with this code and with how your library supports good code. Honorable mentions:
Challenges:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a quick look for now.
For consistence to ssd1306_register.hpp
, st7586s_protocol.hpp
should be st7586s_register.hpp
.
I also had this thought, but these are not registers (but commands and their payloads) and definitely not defines. Thoughts? |
Hardware-interfaces are likely a chaotic mix of registers, commands, protocols... more precise distinctions are taken up with the naming of enum's -> check other driver-headers! I think it's an old convention to collect such things in one box called register for the benefit of consistence. |
modm doesn't seem to stick to a single name for this stuff. Interface definitions are scattered around files named: @salkinium, what's your take? I don't think this library should stick to old conventions, but that's not my call at the end of the day :) |
Have proposed my best solution of grayscale-support for st7586 in #670 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have proposed my best solution of grayscale-support for st7586 in #670
I’ll debate a little on the details later, but agree overall. I’ll wait with grayscale mode until you merge your PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologizes for the chopped review. I'm fighting with my IDEs github extension, for now falling back to the browser. So here's part 3/3 :P
I leave the review of your endianness-edits @salkinium cause haven't enough background.
modm_assert(x < Width, "st4586s.sc.x", "x >= Width", x); | ||
modm_assert(x + w <= Width, "st4586s.sc.xw", "x + w >= Width", x + w); | ||
modm_assert(y < Height, "st4586s.sc.y", "y >= Height", y); | ||
modm_assert(y + h <= Height, "st4586s.sc.yh", "y + h >= Height", y + h); | ||
modm_assert((x % pixelsPerByte) == 0, "st4586s.sc.x%", "x is not a multiply of PBB", x); | ||
modm_assert((w % pixelsPerByte) == 0, "st4586s.sc.w%", "w is not a multiply of PBB", w); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These asserts evaluate all-over-again runtime :/
-> Why do you need setClipping to be public? Witch case requires the app-writer to call this directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is going to be slow. However, you can use modm_assert_continue_fail_debug
, which will still evaluate at runtime, however only in debug profile. I think that's a good compromise to find nasty bugs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Holy cow. Didn't you have a longer name for a regular assertion that doesn't get executed in debug mode? ;)
I was rather hoping for something along the lines:
- CHECK(condition) - evaluates in debug build only
- CHECK_ALWAYS(condition) - evaluates both in debug and release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, not happy about it either. Here's some explanation of what I'm trying to describe: https://modm.io/reference/module/modm-architecture-assert/#assertion-types
void | ||
St7586s<SPI, CS, RST, DC, Width, Height>::initialize() | ||
{ | ||
namespace payload = impl::st7586s::payload; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can place using payload = impl::st586s::payload
within class declaration to spare repetitions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid you can't define a namespace inside a class.
error: 'payload' in namespace 'modm::impl::st7586s' does not name a type
RST::reset(); | ||
RST::setOutput(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RST::setOutput(false); // same result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah. I was actually hoping it would work this way, but the API scared me off. As it turns out, it wasn't API, but a mere implementation with swapped argument naming:
gpio_D4.hpp:
void setOutput(bool status);
While the TLD interface (gpio.hpp) has it:
void setOutput(bool value);
@salkinium: is this a typo? I was digging what status
means and I had an impression it's something about pull-ups or port config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a typo, it should reflect the architecture interface API.
There should be a standard!? I prefer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_
modm_assert(x < Width, "st4586s.sc.x", "x >= Width", x); | ||
modm_assert(x + w <= Width, "st4586s.sc.xw", "x + w >= Width", x + w); | ||
modm_assert(y < Height, "st4586s.sc.y", "y >= Height", y); | ||
modm_assert(y + h <= Height, "st4586s.sc.yh", "y + h >= Height", y + h); | ||
modm_assert((x % pixelsPerByte) == 0, "st4586s.sc.x%", "x is not a multiply of PBB", x); | ||
modm_assert((w % pixelsPerByte) == 0, "st4586s.sc.w%", "w is not a multiply of PBB", w); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is going to be slow. However, you can use modm_assert_continue_fail_debug
, which will still evaluate at runtime, however only in debug profile. I think that's a good compromise to find nasty bugs.
GCC supports it since v9, so I suspect maybe a problem with combining
There isn't really a convention from my side. We typically allow the wild west to sprout until it creates enough annoyance to warrant a alignment to a convention. So far the convention has been: There should be only one header file per driver (ideally identically named as the lbuild module) that you can include that pulls in everything you need, the rest is implementation detail. |
😋 Smaller Boilerplate... Wunderbar! Copy that |
Looks like it's just not there:
I know the root cause is likely in modm's avr-gcc fork and it's fixable there. But I'm already pretty deep in this rabbit hole :).
Does it? I'm pretty sure there's actually no casting needed in user code if the function accepts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with this, thanks!
Sorry for push+force push (the first one was a WIP commit on a new driver, the second was to remove it). Current state should be the same as approved. |
Whoops I wanted to rebased, but pushed my develop branch to your fork. I merged it manually. |
No, it's probably an issue with our custom libstdcpp not having set the |
@twasilczyk Did you include the |
Huh, it was missing |
Implementation is monochrome only for now (the display is 4-level grayscale) until the new display APIs get merged from TomSaw's branch.