Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2021
906
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.69 KB | None | 0 0
  1.  
  2. #define ARM_MATH_CM7
  3. #include <stdint.h>
  4.  
  5. #include "main.h"
  6. #include "stm32h753xx.h"
  7. #include "arm_math.h"
  8.  
  9. #include "DSP_FACTORY.h"
  10. #include "EXIT_FACTORY.h"
  11. #include "CLOCK_FACTORY.h"
  12. #include "I2S_FACTORY.h"
  13. #include "UART_FACTORY.h"
  14. #include "WS2812B_FACTORY.h"
  15. #include "OPCODE.h"
  16. #include "AUDIO_SELECTOR_FACTORY.h"
  17. #include "CONSTANTS.h"
  18. #include "UART_PACKET_PROCESSOR.h"
  19.  
  20. uint8_t I2S1_TC = 0;
  21. uint8_t I2S1_HC = 0;
  22. uint8_t UART4_TC = 0;
  23.  
  24. int main (void) {
  25.  
  26.     //Gotta test I2S bus
  27.  
  28.     INIT_CLOCK(); // GOOD
  29.     INIT_I2S(); // So much noise now?
  30.     INIT_UART(); //GOOD
  31.     INIT_EXIT(); // GOOD
  32.     INIT_WS2812B(); // GOOD
  33.  
  34.     while(1) {
  35.  
  36.         if (I2S1_HC == OK) {
  37.             I2S_HALFCOMPLETE_CALLBACK();
  38.             I2S1_HC = RESET;
  39.         }
  40.  
  41.         if (I2S1_TC == OK) {
  42.             I2S_TRANSFERCOMPLETE_CALLBACK();
  43.             I2S1_TC = RESET;
  44.         }
  45.  
  46.         if (UART4_TC == OK) {
  47.             UART4_TRANSFERCOMPELTE_CALLBACK();
  48.             UART4_TC = RESET;
  49.         }
  50.     }
  51. }
  52.  
  53. void DMA1_Stream2_IRQHandler() {
  54.  
  55.     if (((DMA1->LISR) & (DMA_LISR_TCIF2)) != 0) {
  56.           DMA1->LIFCR |= DMA_LIFCR_CTCIF2;
  57.  
  58.           UART4_TC = OK;
  59.     }
  60. }
  61.  
  62. void DMA1_Stream0_IRQHandler() {
  63.  
  64.     if (((DMA1->LISR) & (DMA_LISR_HTIF0)) != 0) {
  65.           DMA1->LIFCR |= DMA_LIFCR_CHTIF0;
  66.  
  67.           I2S1_HC = OK;
  68.     }
  69.  
  70.     if (((DMA1->LISR) & (DMA_LISR_TCIF0)) != 0) {
  71.           DMA1->LIFCR |= DMA_LIFCR_CTCIF0;
  72.  
  73.           I2S1_TC = OK;
  74.     }
  75. }
  76.  
  77. void EXTI0_IRQHandler(void){
  78.  
  79.      if (((EXTI->PR1) & (EXTI_PR1_PR0)) != 0) {
  80.            EXTI->PR1 |= EXTI_PR1_PR0;
  81.      }
  82.  
  83. }
  84.  
  85. void EXTI4_IRQHandler(void){
  86.  
  87.     if (((EXTI->PR1) & (EXTI_PR1_PR4)) != 0) {
  88.           EXTI->PR1 |= EXTI_PR1_PR4;
  89.     }
  90. }
  91.  
  92. void EXTI9_5_IRQHandler(void){
  93.  
  94.     if (((EXTI->PR1) & (EXTI_PR1_PR6)) != 0) {
  95.           EXTI->PR1 |= EXTI_PR1_PR6;
  96.     }
  97. }
  98.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement