event_send.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2018 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. #include "esp_event.h"
  15. #include "esp_event_legacy.h"
  16. esp_err_t esp_event_send_noop(system_event_t *event);
  17. extern esp_err_t esp_event_send_legacy(system_event_t *event) __attribute__((weak, alias("esp_event_send_noop")));
  18. extern esp_err_t esp_event_send_to_default_loop(system_event_t *event) __attribute((weak, alias("esp_event_send_noop")));
  19. esp_err_t esp_event_send_noop(system_event_t *event)
  20. {
  21. return ESP_OK;
  22. }
  23. esp_err_t esp_event_send(system_event_t *event)
  24. {
  25. // send the event to the new style event loop
  26. esp_err_t err = esp_event_send_to_default_loop(event);
  27. if (err != ESP_OK) {
  28. return err;
  29. }
  30. // send the event to the legacy event loop
  31. err = esp_event_send_legacy(event);
  32. if (err != ESP_OK) {
  33. return err;
  34. }
  35. return ESP_OK;
  36. }