Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /////////////////////////////////////////////////////
- //SPI transfer DMA handler
- //
- //
- void DMA2_Stream5_IRQHandler(void)
- {
- HAL_DMA_IRQHandler(&hdma_spi1_tx);
- if(CheckRXCRC()==1)
- {
- uint32_t ptch;
- uint8_t acc_t;
- if((Rbuffer[14]&0x1) && PLAY_BUTTON_pressed==0) ///////////PLAY button
- {
- if(lock_control==0)
- {
- if(CUE_BUTTON_pressed==0)
- {
- if(play_enable)
- {
- play_enable = 0;
- change_speed = NEED_DOWN;
- }
- else
- {
- if(Tbuffer[19]&0x8) //SLIP MODE ENABLE
- {
- play_adr = slip_play_adr;
- change_speed = NO_CHANGE;
- slip_play_enable = 1;
- }
- else if(CUE_ADR!=(play_adr/294) && (Rbuffer[12]&0x20)==0) //when playback starts from any adress and touch disable
- {
- change_speed = NEED_UP;
- }
- else //when playback starts from CUE adress
- {
- change_speed = NO_CHANGE;
- }
- play_enable = 1;
- }
- }
- else
- {
- keep_to_play = 1;
- }
- }
- PLAY_BUTTON_pressed = 1;
- }
- else if((Rbuffer[14]&0x1)==0 && PLAY_BUTTON_pressed==1)
- {
- PLAY_BUTTON_pressed = 0;
- }
- else if((Rbuffer[14]&0x2) && CUE_BUTTON_pressed==0) ///////////CUE button
- {
- if(lock_control==0)
- {
- if(play_enable && ((Rbuffer[12]&0x20)==0)) //return to CUE, when track playing play && touch disable
- {
- pitch = 0;
- play_enable = 0;
- if(Tbuffer[19]&0x8) //SLIP MODE ENABLE
- {
- slip_play_enable = 0;
- slip_play_adr = 294*CUE_ADR;
- }
- CUE_OPERATION = CUE_NEED_CALL;
- }
- else if((play_enable==0) && (CUE_ADR!=(play_adr/294))) //Set new CUE, when track stopped
- {
- LOOP_OUT = 0;
- CUE_OPERATION = CUE_NEED_SET;
- }
- else if((play_enable==0) && (CUE_ADR==(play_adr/294))) //return to CUE adress, when track stopped
- {
- change_speed = NO_CHANGE;
- //play_adr = 294*CUE_ADR;
- if(Tbuffer[19]&0x8) //SLIP MODE ENABLE
- {
- slip_play_adr = play_adr;
- slip_play_enable = 1;
- }
- play_enable = 1;
- }
- else if(play_enable && ((Rbuffer[12]&0x20)!=0) && (Tbuffer[19]&0x20)) //Set new CUE, when track played and press jog and JOG in Vinyl MODE
- {
- LOOP_OUT = 0;
- CUE_OPERATION = CUE_NEED_SET;
- play_enable = 0;
- }
- }
- CUE_BUTTON_pressed = 1;
- }
- else if((Rbuffer[14]&0x2)==0 && CUE_BUTTON_pressed==1)
- {
- if(lock_control==0)
- {
- if(keep_to_play==0) //button play not pressed
- {
- play_enable = 0;
- pitch = 0;
- slip_play_enable = 0;
- play_adr = 294*CUE_ADR;
- if(Tbuffer[19]&0x8) //SLIP MODE ENABLE
- {
- slip_play_adr = play_adr;
- }
- // if((Tbuffer[19]&0x20)==0) //CDJ mode
- // {
- // pitch = 0;
- // }
- }
- else
- {
- keep_to_play = 0;
- }
- offset_adress = 0; /// temporary operation
- }
- CUE_BUTTON_pressed = 0;
- }
- else if((Rbuffer[14]&0x4) && REALTIME_CUE_BUTTON_pressed==0) ///////////REALTIME CUE button
- {
- if(lock_control==0)
- {
- if((play_enable==1) && (CUE_ADR!=(play_adr/294)) && loop_active==0) //Set new CUE, when track play
- {
- LOOP_OUT = 0;
- CUE_OPERATION = CUE_NEED_SET;
- }
- }
- REALTIME_CUE_BUTTON_pressed = 1;
- }
- else if((Rbuffer[14]&0x4)==0 && REALTIME_CUE_BUTTON_pressed==1)
- {
- REALTIME_CUE_BUTTON_pressed = 0;
- }
- else if((Rbuffer[14]&0x08) && LOOP_OUT_BUTTON_pressed==0) ///////////LOOP OUT button
- {
- if(lock_control==0)
- {
- if(loop_active==0 && CUE_ADR<play_adr/294)
- {
- if(QUANTIZE && dSHOW==WAVEFORM)
- {
- if(((play_adr/294)>(BEATGRID[bars-1]+((BEATGRID[bars] - BEATGRID[bars-1])/2))) || bars==0)
- {
- LOOP_OUT = BEATGRID[bars]; //next bar >> |
- }
- else
- {
- if(CUE_ADR==BEATGRID[bars-1])
- {
- LOOP_OUT = BEATGRID[bars]; //next bar >> |
- }
- else
- {
- LOOP_OUT = BEATGRID[bars-1]; //previous bar << |
- }
- CUE_OPERATION = CUE_NEED_CALL;
- }
- }
- else
- {
- LOOP_OUT = play_adr/294;
- CUE_OPERATION = CUE_NEED_CALL;
- }
- loop_active = 1;
- }
- }
- LOOP_OUT_BUTTON_pressed = 1;
- }
- else if((Rbuffer[14]&0x08)==0 && LOOP_OUT_BUTTON_pressed==1)
- {
- LOOP_OUT_BUTTON_pressed = 0;
- }
- else if((Rbuffer[14]&0x10) && RELOOP_BUTTON_pressed==0) ///////////RELOOP button
- {
- if(lock_control==0)
- {
- if(loop_active)
- {
- loop_active = 0;
- }
- else if(loop_active==0 && CUE_ADR<LOOP_OUT)
- {
- loop_active = 1;
- }
- if(dSHOW==WAVEFORM) //Redraw cue on dynamic waveform
- {
- forcibly_redraw = 1;
- }
- }
- RELOOP_BUTTON_pressed = 1;
- }
- else if((Rbuffer[14]&0x10)==0 && RELOOP_BUTTON_pressed==1)
- {
- RELOOP_BUTTON_pressed = 0;
- }
- if((Rbuffer[12]&0x2)==0 && REVERSE_SWITCH_pressed==0) ///////////reverse switch position
- {
- Tbuffer[17] |= 0x20; //enable red led reverse
- if(UTILITY_SETTINGS[6]==1) //SLIP+REVERSE MODE
- {
- if(Tbuffer[19]&0x8) //SLIP MODE ENABLE
- {
- keep_slip = 1;
- }
- else
- {
- Tbuffer[19] |= 0x8;
- if(play_enable)
- {
- slip_play_enable = 1;
- }
- slip_play_adr = play_adr;
- }
- }
- REVERSE_SWITCH_pressed = 1;
- }
- else if((Rbuffer[12]&0x2)!=0 && REVERSE_SWITCH_pressed==1)
- {
- if(Tbuffer[19]&0x8) //SLIP MODE ENABLE
- {
- play_adr = slip_play_adr;
- }
- if(keep_slip)
- {
- keep_slip = 0;
- }
- else if(UTILITY_SETTINGS[6]==1) //SLIP MODE OFF
- {
- slip_play_enable = 0;
- Tbuffer[19] &= 0xF7;
- }
- Tbuffer[17] &= 0xDF; //disable red led reverse
- REVERSE_SWITCH_pressed = 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement