Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1246611
  • 博文数量: 105
  • 博客积分: 127
  • 博客等级: 入伍新兵
  • 技术积分: 962
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-29 15:22
文章分类

全部博文(105)

文章存档

2021年(1)

2019年(3)

2018年(1)

2017年(11)

2016年(47)

2015年(32)

2014年(4)

2012年(6)

我的朋友

分类: LINUX

2014-11-24 11:15:02


点击(此处)折叠或打开

  1. Led heartbeat 灯 源码与需要配置的选项
  2. static struct gpio_led gpio_leds[] = {
  3.          {
  4.                  .name = "led0",
  5.                  .default_trigger = "heartbeat",
  6.                  .gpio = MYLED_SSP2_SCK,
  7.                  .active_low = 0,
  8.                  .default_state = LEDS_GPIO_DEFSTATE_OFF,
  9.          },
  10.          {
  11.                  .name = "led1",
  12.                  .gpio = MYLED_SSP2_MOSI,
  13.                  .active_low = 0,
  14.                  .default_trigger = "default-on",
  15.                  .default_state = LEDS_GPIO_DEFSTATE_OFF,
  16.          },
  17.          {
  18.                  .name = "led2",
  19.                  .gpio = MYLED_SSP2_MISO,
  20.                  .default_trigger = "timer",
  21.                  .active_low = 0,
  22.                  .default_state = LEDS_GPIO_DEFSTATE_OFF,
  23.          },
  24.          {
  25.                  .name = "led3",
  26.                  .gpio = MYLED_SSP2_SS0,
  27.                  .default_trigger = "gpio",
  28.                  .active_low = 0,
  29.                  .default_state = LEDS_GPIO_DEFSTATE_OFF,
  30.          },
  31.  };
  32.  
  33.  static struct gpio_led_platform_data gpio_led_info = {
  34.          .leds = gpio_leds,
  35.          .num_leds = ARRAY_SIZE(gpio_leds),
  36. };

  37. static struct platform_device leds_gpio = {
  38.         .name = "leds-gpio",
  39.         .id = -1,
  40.         .dev = {
  41.                 .platform_data = &gpio_led_info,
  42.         },
  43. };


  44. void mx28_leds_gpio_init(void)
  45. {
  46.     platform_device_register(&leds_gpio);
  47. }



  48. 需要配置的选项
  49. CONFIG_LEDS_GPIO=y
  50. CONFIG_LEDS_GPIO_PLATFORM=y

  51. #
  52. # LED Triggers
  53. #
  54. CONFIG_LEDS_TRIGGERS=y
  55. CONFIG_LEDS_TRIGGER_TIMER=y
  56. CONFIG_LEDS_TRIGGER_HEARTBEAT=y
  57. CONFIG_LEDS_TRIGGER_BACKLIGHT=y
  58. CONFIG_LEDS_TRIGGER_GPIO=y
  59. CONFIG_LEDS_TRIGGER_DEFAULT_ON=y

阅读(7878) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~