You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
326 B

1 year ago
  1. #include "main.h"
  2. static uint8_t g_port_exit_critical_count;
  3. void chip_critical_enter(void) {
  4. if (g_port_exit_critical_count == 0) {
  5. __disable_irq();
  6. }
  7. g_port_exit_critical_count++;
  8. }
  9. void chip_critical_exit(void) {
  10. g_port_exit_critical_count--;
  11. if (g_port_exit_critical_count == 0) {
  12. __enable_irq();
  13. }
  14. }