91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 72KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-01
  • 語言: 其他
  • 標簽: DS1302??

資源簡介

DS1302的Arduino函數庫,提供的zip,可手動添加在Arduino安裝目錄的library中

資源截圖

代碼片段和文件信息

/*
??DS1302.cpp?-?Arduino?library?support?for?the?DS1302?Trickle?Charge?Timekeeping?Chip
??Copyright?(C)2010?Henning?Karlsen.?All?right?reserved
??
??You?can?find?the?latest?version?of?the?library?at?
??http://www.henningkarlsen.com/electronics

??This?library?has?been?made?to?easily?interface?and?use?the?DS1302?RTC?with
??the?Arduino.

??If?you?make?any?modifications?or?improvements?to?the?code?I?would?appreciate
??that?you?share?the?code?with?me?so?that?I?might?include?it?in?the?next?release.
??I?can?be?contacted?through?http://www.henningkarlsen.com/electronics/contact.php

??This?library?is?free?software;?you?can?redistribute?it?and/or
??modify?it?under?the?terms?of?the?GNU?Lesser?General?Public
??License?as?published?by?the?Free?Software?Foundation;?either
??version?2.1?of?the?License?or?(at?your?option)?any?later?version.

??This?library?is?distributed?in?the?hope?that?it?will?be?useful
??but?WITHOUT?ANY?WARRANTY;?without?even?the?implied?warranty?of
??MERCHANTABILITY?or?FITNESS?FOR?A?PARTICULAR?PURPOSE.??See?the?GNU
??Lesser?General?Public?License?for?more?details.

??You?should?have?received?a?copy?of?the?GNU?Lesser?General?Public
??License?along?with?this?library;?if?not?write?to?the?Free?Software
??Foundation?Inc.?51?Franklin?St?Fifth?Floor?Boston?MA??02110-1301??USA
*/
#include?“DS1302.h“

#define?REG_SEC 0
#define?REG_MIN 1
#define?REG_HOUR 2
#define?REG_DATE 3
#define?REG_MON 4
#define?REG_DOW 5
#define?REG_YEAR 6
#define?REG_WP 7
#define?REG_TCR 8

/*?Public?*/

Time::Time()
{
this->year?=?2010;
this->mon??=?1;
this->date?=?1;
this->hour?=?0;
this->min??=?0;
this->sec??=?0;
this->dow??=?5;
}

DS1302_RAM::DS1302_RAM()
{
for?(int?i=0;?i<31;?i++)
cell[i]=0;
}

DS1302::DS1302(uint8_t?ce_pin?uint8_t?data_pin?uint8_t?sclk_pin)
{
_ce_pin?=?ce_pin;
_data_pin?=?data_pin;
_sclk_pin?=?sclk_pin;

pinMode(_ce_pin?OUTPUT);
pinMode(_sclk_pin?OUTPUT);
}

Time?DS1302::getTime()
{
Time?t;
_burstRead();
t.sec =?_decode(_burstArray[0]);
t.min =?_decode(_burstArray[1]);
t.hour =?_decodeH(_burstArray[2]);
t.date =?_decode(_burstArray[3]);
t.mon =?_decode(_burstArray[4]);
t.dow =?_burstArray[5];
t.year =?_decodeY(_burstArray[6])+2000;
return?t;
}

void?DS1302::setTime(uint8_t?hour?uint8_t?min?uint8_t?sec)
{
if?(((hour>=0)?&&?(hour<24))?&&?((min>=0)?&&?(min<60))?&&?((sec>=0)?&&?(sec<60)))
{
_writeRegister(REG_HOUR?_encode(hour));
_writeRegister(REG_MIN?_encode(min));
_writeRegister(REG_SEC?_encode(sec));
}
}

void?DS1302::setDate(uint8_t?date?uint8_t?mon?uint16_t?year)
{
if?(((date>0)?&&?(date<=31))?&&?((mon>0)?&&?(mon<=12))?&&?((year>=2000)?&&?(year<3000)))
{
year?-=?2000;
_writeRegister(REG_YEAR?_encode(year));
_writeRegister(REG_MON?_encode(mon));
_writeRegister(REG_DATE?_encode(date));
}
}

void?DS1302::setDOW(uint8_t?dow)
{
if?((dow>0)?&&?(dow<8))
_writeRegister(REG_DOW?dow);
}

char?*DS1302::getTimeStr(uint8_t?format)
{
char?*output=?“xxxxxxxx“;
Time?t;
t=getTime();
if?

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-11-10?12:27??DS1302\
?????目錄???????????0??2014-11-10?12:27??DS1302\examples\
?????目錄???????????0??2014-11-10?12:27??DS1302\examples\DS1302_LCD\
?????目錄???????????0??2014-11-10?12:27??DS1302\examples\DS1302_RAM_Demo\
?????目錄???????????0??2014-11-10?12:27??DS1302\examples\DS1302_Serial_Easy\
?????目錄???????????0??2014-11-10?12:27??DS1302\examples\DS1302_Serial_Hard\
?????文件?????????203??2012-01-26?03:53??DS1302\version.txt
?????文件???????24356??2010-01-29?07:16??DS1302\LICENSE.txt
?????文件?????????847??2010-11-17?04:55??DS1302\keywords.txt
?????文件???????57266??2012-01-26?03:56??DS1302\DS1302.pdf
?????文件????????3298??2012-01-26?04:05??DS1302\DS1302.h
?????文件???????10181??2012-01-26?03:53??DS1302\DS1302.cpp
?????文件????????1668??2010-08-06?05:47??DS1302\examples\DS1302_LCD\DS1302_LCD.pde
?????文件????????1997??2010-08-22?17:23??DS1302\examples\DS1302_RAM_Demo\DS1302_RAM_Demo.pde
?????文件????????1209??2013-11-05?13:56??DS1302\examples\DS1302_Serial_Easy\DS1302_Serial_Easy.ino
?????文件????????1837??2010-08-06?06:39??DS1302\examples\DS1302_Serial_Hard\DS1302_Serial_Hard.pde

評論

共有 條評論