Skip to content

Conversation

@AberDerBart
Copy link

@AberDerBart AberDerBart commented Feb 23, 2024

Fixes #17

Adds a rotation attribute to ssd1306_t that can be set via ssd1306_set_rotation to change the orientation of any further draw requests. Note that width and height still correspond to the original orientation.

@AberDerBart AberDerBart changed the title implement display rotation, fixes #17 implement display rotation Feb 23, 2024
@AberDerBart
Copy link
Author

wait, something went wrong with my git here, this is not the proper commit

@AberDerBart AberDerBart force-pushed the main branch 2 times, most recently from 807cf2e to cbfa5c2 Compare February 23, 2024 17:01
@AberDerBart
Copy link
Author

so, this should be the correct version

@AberDerBart
Copy link
Author

wow, it still wasn't the correct version, how emberassing. Now I double checked and tested it.

@daschr
Copy link
Owner

daschr commented Mar 16, 2024

Sorry, I totally forgot you! I will check this out tomorrow.

@headblockhead
Copy link

headblockhead commented Jul 20, 2024

Sorry, I totally forgot you! I will check this out tomorrow.

Any plans to merge this? It would be very helpful for my project. :)

memset(p->buffer, 0, p->bufsize);
}

inline void ssd1306_set_rotation(ssd1306_t *p, rotation_t rotation) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the header this is defined as a standard void but here it's inline. if you want it to be inline, just define it as a static inline in the header.

p->rotation = rotation;
}

void rotate_coordinates(ssd1306_t *p, uint32_t* x, uint32_t* y) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be inline?


void rotate_coordinates(ssd1306_t *p, uint32_t* x, uint32_t* y) {
uint32_t tmp_x = *x;
if(p->rotation == ROT_90) {
Copy link

@CardboardDog CardboardDog Aug 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch case instead of if/else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add alternative orientation options

4 participants