led_hal.c 867 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2019 Actions Semiconductor Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file led hal interface
  8. */
  9. #include <os_common_api.h>
  10. #include <led_manager.h>
  11. #include <mem_manager.h>
  12. #include <string.h>
  13. #include <drivers/gpio.h>
  14. #include <ui_manager.h>
  15. #include "led_hal.h"
  16. #include <display/led_display.h>
  17. void led_on(u8_t led_index)
  18. {
  19. u32_t color = LED_COLOR_ON;
  20. led_draw_pixel(led_index, color, NULL);
  21. }
  22. void led_off(u8_t led_index)
  23. {
  24. u32_t color = LED_COLOR_OFF;
  25. led_draw_pixel(led_index, color, NULL);
  26. }
  27. void led_breath(u8_t led_index, pwm_breath_ctrl_t *ctrl)
  28. {
  29. u32_t color = LED_COLOR_BREATH;
  30. led_draw_pixel(led_index, color, ctrl);
  31. }
  32. void led_blink(u8_t led_index, u16_t period, u16_t pulse, u8_t start_state)
  33. {
  34. u32_t color = LED_COLOR_FLASH(period, pulse, start_state);
  35. led_draw_pixel(led_index, color, NULL);
  36. }