gpio_hal.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // The HAL layer for GPIO (common part)
  15. #include "soc/soc.h"
  16. #include "soc/gpio_periph.h"
  17. #include "hal/gpio_hal.h"
  18. void gpio_hal_intr_enable_on_core(gpio_hal_context_t *hal, gpio_num_t gpio_num, uint32_t core_id)
  19. {
  20. if (gpio_num < 32) {
  21. gpio_ll_clear_intr_status(hal->dev, BIT(gpio_num));
  22. } else {
  23. gpio_ll_clear_intr_status_high(hal->dev, BIT(gpio_num - 32));
  24. }
  25. gpio_ll_intr_enable_on_core(hal->dev, core_id, gpio_num);
  26. }
  27. void gpio_hal_intr_disable(gpio_hal_context_t *hal, gpio_num_t gpio_num)
  28. {
  29. gpio_ll_intr_disable(hal->dev, gpio_num);
  30. if (gpio_num < 32) {
  31. gpio_ll_clear_intr_status(hal->dev, BIT(gpio_num));
  32. } else {
  33. gpio_ll_clear_intr_status_high(hal->dev, BIT(gpio_num - 32));
  34. }
  35. }