linux device driver的研究筆記
2016年4月16日 星期六
pwm linux device driver
環境 : RPI 3 .... linux kernel : 4.4 version....
核心建立 : https://www.raspberrypi.org/documentation/linux/kernel/building.md
基本上是參考這個 dht11km.c dht11 去修改....
改的地方如下:
1. disable request_mem_region 和 release_mem_region(GPIO_BASE, SZ_4K);
因為預設已經有driver 使用這個gpio memory base
2. add
#define INTERRUPT_GPIO0 79
3. 修改原本的code... 改成比較簡單..... 當中斷來的時候....判斷正負緣
正緣時....紀錄 start_time.... 負緣時....紀錄 stop_time....
兩個一相減就是pwm 的 period......單位是 us
code source : https://github.com/jacky0328/hello-world
訂閱:
意見 (Atom)