Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Bulme-Timer Mbed-21-Clock-to-7Segment WS_7_Seg_mit_LM1635 WS_7_Seg_mit_LM1635 ... more
Fork of PCF8563 by
PCF8563.h@4:1246b8a8f15f, 2016-06-23 (annotated)
- Committer:
- 04M04
- Date:
- Thu Jun 23 18:59:15 2016 +0000
- Revision:
- 4:1246b8a8f15f
- Parent:
- 2:39c99dbc6368
PCF8563
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| fpucher | 1:43c0cae8d6b0 | 1 | /*********************************** |
| fpucher | 2:39c99dbc6368 | 2 | name: PCF8563.h Version: 0.3 |
| fpucher | 1:43c0cae8d6b0 | 3 | author: PE HTL BULME |
| fpucher | 1:43c0cae8d6b0 | 4 | email: pe@bulme.at |
| fpucher | 1:43c0cae8d6b0 | 5 | description: |
| fpucher | 1:43c0cae8d6b0 | 6 | Definition portion of the class rtc |
| fpucher | 1:43c0cae8d6b0 | 7 | |
| fpucher | 1:43c0cae8d6b0 | 8 | |
| fpucher | 1:43c0cae8d6b0 | 9 | ***********************************/ |
| fpucher | 1:43c0cae8d6b0 | 10 | |
| fpucher | 1:43c0cae8d6b0 | 11 | #include "mbed.h" |
| fpucher | 1:43c0cae8d6b0 | 12 | #include "const.h" |
| fpucher | 1:43c0cae8d6b0 | 13 | |
| fpucher | 1:43c0cae8d6b0 | 14 | #if !defined (PCF8563_H) |
| fpucher | 1:43c0cae8d6b0 | 15 | #define PCF8563_H |
| fpucher | 1:43c0cae8d6b0 | 16 | |
| fpucher | 1:43c0cae8d6b0 | 17 | /** PCF8563 Class |
| fpucher | 1:43c0cae8d6b0 | 18 | */ |
| fpucher | 1:43c0cae8d6b0 | 19 | |
| fpucher | 1:43c0cae8d6b0 | 20 | /** |
| fpucher | 1:43c0cae8d6b0 | 21 | name: rtc.h Version: 0.1 |
| fpucher | 1:43c0cae8d6b0 | 22 | author: PE HTL BULME |
| fpucher | 1:43c0cae8d6b0 | 23 | email: pe@bulme.at |
| fpucher | 1:43c0cae8d6b0 | 24 | description: |
| fpucher | 1:43c0cae8d6b0 | 25 | Definition portion of the class rtc |
| fpucher | 1:43c0cae8d6b0 | 26 | |
| fpucher | 1:43c0cae8d6b0 | 27 | |
| fpucher | 1:43c0cae8d6b0 | 28 | ***********************************/ |
| fpucher | 1:43c0cae8d6b0 | 29 | class PCF8563 |
| fpucher | 1:43c0cae8d6b0 | 30 | { |
| fpucher | 1:43c0cae8d6b0 | 31 | protected: |
| fpucher | 1:43c0cae8d6b0 | 32 | //PinName _sda, _scl; |
| fpucher | 1:43c0cae8d6b0 | 33 | I2C i2c; /**< I2C definition */ |
| fpucher | 1:43c0cae8d6b0 | 34 | char week_val; |
| fpucher | 1:43c0cae8d6b0 | 35 | |
| fpucher | 1:43c0cae8d6b0 | 36 | /** |
| fpucher | 1:43c0cae8d6b0 | 37 | protected methodes for internal purposes only |
| fpucher | 1:43c0cae8d6b0 | 38 | */ |
| fpucher | 1:43c0cae8d6b0 | 39 | void error(); /**< Error: stops and all LEDs are blinking*/ |
| fpucher | 1:43c0cae8d6b0 | 40 | |
| fpucher | 1:43c0cae8d6b0 | 41 | public: |
| fpucher | 1:43c0cae8d6b0 | 42 | /** Create a RTC object connected to the specified pin |
| fpucher | 1:43c0cae8d6b0 | 43 | * @param pin sda/scl pin to connect to |
| fpucher | 1:43c0cae8d6b0 | 44 | */ |
| fpucher | 1:43c0cae8d6b0 | 45 | PCF8563(); /**< default constructor; sda(p28), sdc(p27) */ |
| fpucher | 1:43c0cae8d6b0 | 46 | PCF8563(PinName sda, PinName scl); /**< parameterized constructor with sda-pin, sdc-pin)*/ |
| fpucher | 1:43c0cae8d6b0 | 47 | ~PCF8563(); |
| fpucher | 1:43c0cae8d6b0 | 48 | char read(char address); /**< read value from I2C bus; ToDo --> Error()*/ |
| fpucher | 1:43c0cae8d6b0 | 49 | void write(char address, char value); /**< write value to I2C bus; ToDo --> Error()*/ |
| fpucher | 1:43c0cae8d6b0 | 50 | void init(); /**< initialize the RTC to a given date and time; ToDo --> Error()*/ |
| fpucher | 1:43c0cae8d6b0 | 51 | void alarm(); |
| fpucher | 1:43c0cae8d6b0 | 52 | }; |
| fpucher | 1:43c0cae8d6b0 | 53 | |
| fpucher | 1:43c0cae8d6b0 | 54 | #endif |
