Skip to content

Commit

Permalink
set frame in SRAM sequential mode, saving more power (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
gitdode authored Sep 20, 2023
1 parent b8b5742 commit 8c24f96
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
14 changes: 10 additions & 4 deletions thermidity-avr/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,23 @@ void sramToDisplay(void) {
byte = transmit(~byte);
}
displayDes();
sramDes();

sramDes();
sramWriteStatus(SRAM_BYTE);
}

void setFrame(uint8_t byte) {
uint16_t bytes = DISPLAY_WIDTH * DISPLAY_H_BYTES;

for (int i = 0; i < bytes; i++) {
sramWrite(i, byte);

sramWriteStatus(SRAM_SEQU);

sramSel();
sramInitWrite(0x0);
for (uint16_t i = 0; i < bytes; i++) {
transmit(byte);
}
sramDes();
sramWriteStatus(SRAM_BYTE);
}

width_t writeBitmap(row_t row, col_t col, uint16_t index) {
Expand Down
6 changes: 6 additions & 0 deletions thermidity-avr/sram.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ uint8_t sramReadStatus(void) {
return status;
}

void sramInitWrite(uint16_t address) {
transmit(SRAM_WRITE);
transmit(address >> 8);
transmit(address);
}

void sramInitRead(uint16_t address) {
transmit(SRAM_READ);
transmit(address >> 8);
Expand Down
7 changes: 7 additions & 0 deletions thermidity-avr/sram.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ void sramWriteStatus(uint8_t status);
*/
uint8_t sramReadStatus(void);

/**
* Sends write command and sets the given address.
* Useful for writing in sequential or page mode.
* @param address
*/
void sramInitWrite(uint16_t address);

/**
* Sends read command and sets the given address.
* Useful for reading in sequential or page mode.
Expand Down

0 comments on commit 8c24f96

Please sign in to comment.