#include <avr/io.h>#include <config.h>Go to the source code of this file.
Functions | |
| void | read_from_rtc (uint8_t command, uint8_t bytes, uint8_t *address_ptr) |
| Read a set of data from the DS1302 Real time clock to memory. | |
| void | write_to_rtc (uint8_t command, uint8_t bytes, uint8_t *data_ptr) |
| Write a set of data to the DS1302 Real time clock from memory. | |
| void | send_time_to_rtc (uint8_t *time_ptr) |
| Set the clock on the RTC, sending it 8 bytes ss mm hh date month day year 0. | |
| void | read_time (uint8_t *address_ptr) |
| Read a set of data from the DS1302 Real time clock into memory. | |
| uint8_t | bcd_to_hex (uint8_t bcd) |
| Convert a BCD value in a byte to the correct hex value. | |
| uint32_t | get_fattime () |
| Read the time and convert to a 32 bit value suitable for FAT filesystem timestamps. | |
| void | date_dirname (uint8_t *time_store, uint8_t *dirname) |
| Create a 7 byte directory name with date/time value. | |
| void | filename_from_date (uint8_t *time_store, uint8_t *filename) |
| Create or overwrite a filename with date/time value. | |
| void | iso_time (uint8_t *time_store, uint8_t *iso_time_store) |
| Converts a time stored in memory (typically from a Real Time Clock chip) into ISO order. | |
| uint8_t | hex2ascii_h (uint8_t hexval) |
| uint8_t | hex2ascii_l (uint8_t hexval) |
| uint8_t bcd_to_hex | ( | uint8_t | bcd | ) |
Convert a BCD value in a byte to the correct hex value.
| bcd | uint8_t value in BCD |
| void date_dirname | ( | uint8_t * | time_store, | |
| uint8_t * | dirname | |||
| ) |
Create a 7 byte directory name with date/time value.
| *time_store | memory location of 7 bytes of the time to be converted. | |
| *dirname | directory name to be created. |
dirname is overwritten with yymddhh m is 1-12 value expressed in Hex (eg C for December). Other values (BCD from the clock) are copied as is, without any conversion. eg 20101215 13:16:56 -> 11C1513
Note that both time_store and dirname must exist in memory as arrays of 7 or more bytes. To use the dirname as a string, use 8 bytes and null the 8th
| void filename_from_date | ( | uint8_t * | time_store, | |
| uint8_t * | filename | |||
| ) |
Create or overwrite a filename with date/time value.
| *time_store | memory location of 7 bytes of the time to be converted. | |
| *filename | filename name to be created or overwritten. |
IMPORTANT Several characters of filename are NOT changed or set. Make sure you set it to a valid character or the filesystem will generate an error.
filename is overwritten with ^mddhhmm^ss^ where positions with ^ are unchanged m is month 1-12 value expressed as a single Hex character (eg C for December). Other values (BCD from the clock) are copied as is, without any conversion.
eg filename ABCDEFGH.XYZ plus date (15th December 2010) 20101215 13:16:56 -> AC151316.56Z
Note that both time_store and filename must exist in memory as arrays of 7 and 12 (or more) bytes respectively. To use the filename as a string, use a 13 byte array and null the 13th, or create filename as a string of the correct length.
| uint32_t get_fattime | ( | ) |
Read the time and convert to a 32 bit value suitable for FAT filesystem timestamps.
| uint8_t hex2ascii_h | ( | uint8_t | hexval | ) |
| uint8_t hex2ascii_l | ( | uint8_t | hexval | ) |
| void iso_time | ( | uint8_t * | time_store, | |
| uint8_t * | iso_time_store | |||
| ) |
Converts a time stored in memory (typically from a Real Time Clock chip) into ISO order.
| *time_store | memory location of 7 bytes of the time to be converted. | |
| *iso_time_store | memory location for the 16 byte result. |
time_store format is ss,mm,hh,dd,mm,dow,yy yy counts from 2000 iso_time_store shows "20yymmdd hhmmss" 16 bytes including trailing null making it a string.
| void read_from_rtc | ( | uint8_t | command, | |
| uint8_t | bytes, | |||
| uint8_t * | address_ptr | |||
| ) |
Read a set of data from the DS1302 Real time clock to memory.
| command | Command to send to RTC | |
| bytes | Number of bytes to be returned | |
| *address_ptr | Pointer to location to store returned values |
| void read_time | ( | uint8_t * | address_ptr | ) |
Read a set of data from the DS1302 Real time clock into memory.
| *address_ptr | Pointer to location in memory of first byte of set of data |
| void send_time_to_rtc | ( | uint8_t * | time_ptr | ) |
Set the clock on the RTC, sending it 8 bytes ss mm hh date month day year 0.
| *time_ptr | Pointer to location where clock set values are stored |
| void write_to_rtc | ( | uint8_t | command, | |
| uint8_t | bytes, | |||
| uint8_t * | data_ptr | |||
| ) |
Write a set of data to the DS1302 Real time clock from memory.
| command | Command to send to RTC. See datasheet of the device for details | |
| bytes | Number of bytes to be sent | |
| *data_ptr | Pointer to location in memory of first byte of set of data |
1.5.8