Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Code snippet showing how I initialize the registers */
- Serial3.end();
- // Setup our USART3
- USART3->regs->BRR = 0x120; // Baud Rate Register
- USART3->regs->CR1 = 0b0010000000001100; // CR 1
- USART3->regs->CR2 = 0b0010000000100000; // CR 2
- USART3->regs->CR3 = 0x0000; // CR 3
- /* End snip */
- /* Code snippet showing my IRQ handler */
- void __irq_usart3(void) {
- if((USART3->regs->SR & 0x0002) == 0x0002) // Detects FE
- {
- //digitalWrite(33,HIGH);
- i = USART3->regs->DR;
- current_slot = 0;
- //waiting_for_break = 0;
- slots_loc = 0;
- //SerialUSB.print("B");
- }
- else if(current_slot <= DIMMERS)
- {
- //SerialUSB.println(current_slot);
- if((USART3->regs->SR & 0x0020) == 0x0020)
- {
- //SerialUSB.print("s");
- if(current_slot == 0)
- {
- if(USART3->regs->DR == 0x00)
- {
- slots[current_slot] = USART3->regs->DR;
- needs_write = 1;
- }
- digitalWrite(33,LOW);
- }
- else
- {
- slots[current_slot] = USART3->regs->DR;
- }
- current_slot++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement