|
|
| 第1行: |
第1行: |
| [[File:Rpi rtc.jpg|border|400px]] | | #REDIRECT [[Application - DS1302, RTC module]] |
| == Hardware ==
| |
| [[File:Real-time-clock-connection.jpg|border|RPi with DS1302]]
| |
| * In version 2 Pi GPIO27 is in place of GPIO21 (same pin)
| |
| == Software ==
| |
| * [http://www.hobbytronics.co.uk/download/rtc-pi.zip, Real Time Clock Source Code]
| |
| <pre>
| |
| Modify the following GPIO definition for RPi 2
| |
| #define GPIO_ADD 0x20200000L -> #define GPIO_ADD 0x3F000000L
| |
| #define SCLK_OUTPUT *(gpio+GPIO_SEL2) &= 0xFFFFFFC7L -> #define SCLK_OUTPUT *(gpio+GPIO_SEL2) &= 0xFF1FFFFFL
| |
| #define SCLK_HIGH *(gpio+GPIO_SET) = 0x00200000L -> #define SCLK_HIGH *(gpio+GPIO_SET) = 0x08000000L
| |
| #define SCLK_LOW *(gpio+GPIO_CLR) = 0x00200000L -> #define SCLK_LOW *(gpio+GPIO_CLR) = 0x08000000L
| |
| </pre>
| |
| | |
| == Reference ==
| |
| * [http://www.hobbytronics.co.uk/raspberry-pi-real-time-clock, Raspberry Pi Real Time Clock]
| |