forked from len0rd/rockbox
rtc_read() and rtc_write() added, and if we now set HAVE_RTC when building
the recorder simulator, we get a clock in the status bar! ;-) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2586 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
207e605169
commit
d4d3a5df94
1 changed files with 24 additions and 0 deletions
|
@ -17,7 +17,9 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
#include "screens.h"
|
#include "screens.h"
|
||||||
|
@ -170,3 +172,25 @@ void backlight_set_on_when_charging(bool beep)
|
||||||
{
|
{
|
||||||
(void)beep;
|
(void)beep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int rtc_read(int address)
|
||||||
|
{
|
||||||
|
time_t now = time(NULL);
|
||||||
|
struct tm *teem = localtime(&now);
|
||||||
|
|
||||||
|
switch(address) {
|
||||||
|
case 3: /* hour */
|
||||||
|
return (teem->tm_hour%10) | ((teem->tm_hour/10) << 4);
|
||||||
|
|
||||||
|
case 2: /* minute */
|
||||||
|
return (teem->tm_min%10) | ((teem->tm_min/10) << 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
return address ^ 0x55;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rtc_write(int address, int value)
|
||||||
|
{
|
||||||
|
DEBUGF("write %x to address %x\n", value, address);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue