-
Notifications
You must be signed in to change notification settings - Fork 76
Implement newline handling for TerminalMode #79
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
Conversation
2d79f2a
to
b5e3ddf
Compare
This has been tested manually using a cheap ssd1306 chip from AliExpress over I2C. |
Interesting implementation. I don't have time to check it in depth right now but on a first glance this looks good, albeit a bit complicated. I take it there's no easy way to handle the newline character before trying to convert it to a bitmap? |
The reason we can't handle the newline character more easily than introducing this new |
@therealprof Do you have a moment to review this? |
@jamwaffles I've reviewed #80 and provided some feedback. The gist is this: It works great but adds substantial overhead. I've written a little test application and captured the Before the change:
After the change:
It may not matter much in this particular case but it certainly hurts on a Cortex-M0... Other than this it's a really great change. |
TIL about
|
@mjadczak I did a small experiment and got rid of the |
@mjadczak You can find my experiment here: https://github.com/therealprof/ssd1306/blob/terminal-mode-cursor/src/mode/terminal.rs |
Does that actually compile with no warnings? The key function now looks like this: pub fn print_char<T>(&mut self, c: char) -> Result<(), ()>
where
TerminalMode<DI>: CharacterBitmap<T>, i.e. there is no more need for the Incidentally, I was going to do it this way initially, before I realised that the trait was there—I did raise this above:
I still don't really get the abstraction provided by the trait, but assumed it was important when writing the code. So, I think that either
|
Also, I should probably close in favour of #80 and continue discussion there. |
I don't remember the history of this but yes, the idea was to support custom fonts at some point. |
What it says on the tin. See #78.
The reason the counter is an
Option
is to not rely on it before we initialise the mode and know that we are in the top left corner—I'm not wedded to this way of enforcing that, however.