Skip to content

Ability to change bit order + SPI support#30

Open
blinkinglight wants to merge 15 commits into
Simsso:masterfrom
9glt:master
Open

Ability to change bit order + SPI support#30
blinkinglight wants to merge 15 commits into
Simsso:masterfrom
9glt:master

Conversation

@blinkinglight

Copy link
Copy Markdown

No description provided.

@blinkinglight

blinkinglight commented Mar 19, 2022

Copy link
Copy Markdown
Author

added SPI support.
arduino uno can shift data out at up to 8mhz with almost 0 cpu cycles.
also, no breaking changes ;)

@blinkinglight blinkinglight changed the title ability to change bit order ability to change bit order + SPI support Mar 19, 2022
@Simsso

Simsso commented Mar 19, 2022

Copy link
Copy Markdown
Owner

That's pretty cool, thanks for the contribution. (I'll test this before merging.)

@Simsso Simsso changed the title ability to change bit order + SPI support Ability to change bit order + SPI support Mar 19, 2022
@blinkinglight

Copy link
Copy Markdown
Author

That's pretty cool, thanks for the contribution. (I'll test this before merging.)

ok ;) how long it could take?

@blinkinglight

blinkinglight commented Mar 19, 2022

Copy link
Copy Markdown
Author
#define SHIFT_REGISTER_USES_SPI_WITH_FREQUENCY 20000000UL

#include <ShiftRegister74HC595.h>
#include <SPI.h>

#define LATCH 7

ShiftRegister74HC595<3> sr(LATCH);

void setup() {
  Serial.begin(115200);
  
  TCCR1A = 0;
  TCCR1B = 0;
  TCNT1 = 0;
  OCR1A = 10; 
  TCCR1B |= (1 << WGM12);
  TCCR1B |= (1 << CS21);
  TIMSK1 |= (1 << OCIE1A);
  sei();
}

volatile uint8_t b[3] = { 0b10010011, 0b11010011, 0b1111000 };

ISR(TIMER1_COMPA_vect)
{
  sr.setAll(b);
}

void loop() { 
  delay(1000);
}

275181554_1115425705917365_7173561953970376152_n

(signal is not clear because of long jumpwires)

@blinkinglight

Copy link
Copy Markdown
Author

hey, any progress / problems with this PR?

@blinkinglight

Copy link
Copy Markdown
Author

hey @Simsso what do you think about this? is there anything i can improve?

@Nezaemmy

Copy link
Copy Markdown

hey@blinkinglight did you forked it so that we can use your edited version?

@blinkinglight

Copy link
Copy Markdown
Author

hey@blinkinglight did you forked it so that we can use your edited version?

yes click on 9glt:master at the top

@Nezaemmy

Copy link
Copy Markdown

hey@blinkinglight did you forked it so that we can use your edited version?

yes click on 9glt:master at the top

Thank you. on the SPI version, for the esp32 board which frequency can I set?

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.

4 participants