Format code according to conventions (#16322)
This commit is contained in:
parent
afcdd7079c
commit
63646e8906
345 changed files with 4916 additions and 3229 deletions
|
@ -39,7 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// Addressing Setting Commands
|
||||
#define PAM_SETCOLUMN_LSB 0x00
|
||||
#define PAM_SETCOLUMN_MSB 0x10
|
||||
#define PAM_PAGE_ADDR 0xB0 // 0xb0 -- 0xb7
|
||||
#define PAM_PAGE_ADDR 0xB0 // 0xb0 -- 0xb7
|
||||
|
||||
// Hardware Configuration Commands
|
||||
#define DISPLAY_START_LINE 0x40
|
||||
|
@ -138,7 +138,9 @@ bool st7565_init(display_rotation_t rotation) {
|
|||
return true;
|
||||
}
|
||||
|
||||
__attribute__((weak)) display_rotation_t st7565_init_user(display_rotation_t rotation) { return rotation; }
|
||||
__attribute__((weak)) display_rotation_t st7565_init_user(display_rotation_t rotation) {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
void st7565_clear(void) {
|
||||
memset(st7565_buffer, 0, sizeof(st7565_buffer));
|
||||
|
@ -212,7 +214,8 @@ void st7565_advance_page(bool clearPageRemainder) {
|
|||
remaining = remaining / ST7565_FONT_WIDTH;
|
||||
|
||||
// Write empty character until next line
|
||||
while (remaining--) st7565_write_char(' ', false);
|
||||
while (remaining--)
|
||||
st7565_write_char(' ', false);
|
||||
} else {
|
||||
// Next page index out of bounds?
|
||||
if (index + remaining >= ST7565_MATRIX_SIZE) {
|
||||
|
@ -263,7 +266,7 @@ void st7565_write_char(const char data, bool invert) {
|
|||
_Static_assert(sizeof(font) >= ((ST7565_FONT_END + 1 - ST7565_FONT_START) * ST7565_FONT_WIDTH), "ST7565_FONT_END references outside array");
|
||||
|
||||
// set the reder buffer data
|
||||
uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index
|
||||
uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index
|
||||
if (cast_data < ST7565_FONT_START || cast_data > ST7565_FONT_END) {
|
||||
memset(st7565_cursor, 0x00, ST7565_FONT_WIDTH);
|
||||
} else {
|
||||
|
@ -389,7 +392,7 @@ void st7565_write_raw_P(const char *data, uint16_t size) {
|
|||
st7565_dirty |= ((ST7565_BLOCK_TYPE)1 << (i / ST7565_BLOCK_SIZE));
|
||||
}
|
||||
}
|
||||
#endif // defined(__AVR__)
|
||||
#endif // defined(__AVR__)
|
||||
|
||||
bool st7565_on(void) {
|
||||
if (!st7565_initialized) {
|
||||
|
@ -429,7 +432,9 @@ bool st7565_off(void) {
|
|||
|
||||
__attribute__((weak)) void st7565_off_user(void) {}
|
||||
|
||||
bool st7565_is_on(void) { return st7565_active; }
|
||||
bool st7565_is_on(void) {
|
||||
return st7565_active;
|
||||
}
|
||||
|
||||
bool st7565_invert(bool invert) {
|
||||
if (!st7565_initialized) {
|
||||
|
@ -445,9 +450,13 @@ bool st7565_invert(bool invert) {
|
|||
return st7565_inverted;
|
||||
}
|
||||
|
||||
uint8_t st7565_max_chars(void) { return ST7565_DISPLAY_WIDTH / ST7565_FONT_WIDTH; }
|
||||
uint8_t st7565_max_chars(void) {
|
||||
return ST7565_DISPLAY_WIDTH / ST7565_FONT_WIDTH;
|
||||
}
|
||||
|
||||
uint8_t st7565_max_lines(void) { return ST7565_DISPLAY_HEIGHT / ST7565_FONT_HEIGHT; }
|
||||
uint8_t st7565_max_lines(void) {
|
||||
return ST7565_DISPLAY_HEIGHT / ST7565_FONT_HEIGHT;
|
||||
}
|
||||
|
||||
void st7565_task(void) {
|
||||
if (!st7565_initialized) {
|
||||
|
|
|
@ -29,16 +29,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
# define ST7565_DISPLAY_HEIGHT 32
|
||||
#endif
|
||||
#ifndef ST7565_MATRIX_SIZE
|
||||
# define ST7565_MATRIX_SIZE (ST7565_DISPLAY_HEIGHT / 8 * ST7565_DISPLAY_WIDTH) // 1024 (compile time mathed)
|
||||
# define ST7565_MATRIX_SIZE (ST7565_DISPLAY_HEIGHT / 8 * ST7565_DISPLAY_WIDTH) // 1024 (compile time mathed)
|
||||
#endif
|
||||
#ifndef ST7565_BLOCK_TYPE
|
||||
# define ST7565_BLOCK_TYPE uint16_t
|
||||
#endif
|
||||
#ifndef ST7565_BLOCK_COUNT
|
||||
# define ST7565_BLOCK_COUNT (sizeof(ST7565_BLOCK_TYPE) * 8) // 32 (compile time mathed)
|
||||
# define ST7565_BLOCK_COUNT (sizeof(ST7565_BLOCK_TYPE) * 8) // 32 (compile time mathed)
|
||||
#endif
|
||||
#ifndef ST7565_BLOCK_SIZE
|
||||
# define ST7565_BLOCK_SIZE (ST7565_MATRIX_SIZE / ST7565_BLOCK_COUNT) // 32 (compile time mathed)
|
||||
# define ST7565_BLOCK_SIZE (ST7565_MATRIX_SIZE / ST7565_BLOCK_COUNT) // 32 (compile time mathed)
|
||||
#endif
|
||||
|
||||
// the column address corresponding to the first column in the display hardware
|
||||
|
@ -174,7 +174,7 @@ void st7565_write_raw_P(const char *data, uint16_t size);
|
|||
# define st7565_write_P(data, invert) st7565_write(data, invert)
|
||||
# define st7565_write_ln_P(data, invert) st7565_write_ln(data, invert)
|
||||
# define st7565_write_raw_P(data, size) st7565_write_raw(data, size)
|
||||
#endif // defined(__AVR__)
|
||||
#endif // defined(__AVR__)
|
||||
|
||||
// Can be used to manually turn on the screen if it is off
|
||||
// Returns true if the screen was on or turns on
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue