led.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * File : led.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006-2015, RT-Thread Develop Team
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. * Change Logs:
  21. * Date Author Notes
  22. * 2015-04-14 ArdaFu first version
  23. */
  24. #include <rtthread.h>
  25. #include <board.h>
  26. #include "led.h"
  27. #include "gpio.h"
  28. //ASM9260T EVK pin 16-7 LED0, 0: ON, 1 : OFF
  29. void led_init(void)
  30. {
  31. // enable IOCONFIG GPIO
  32. outl(((1UL<<25) | (1UL<<4)) , REG_SET(HW_AHBCLKCTRL0));
  33. HW_SetPinMux(16,7,0);
  34. HW_GpioSetDir(16,7,1);
  35. }
  36. void led_on(int num)
  37. {
  38. HW_GpioClrVal(16, 7 );
  39. }
  40. void led_off(int num)
  41. {
  42. HW_GpioSetVal(16, 7 );
  43. }