Changeset 175 for rtos_arduino/trunk/arduino_lib/libraries
- Timestamp:
- Mar 28, 2016, 2:09:46 PM (8 years ago)
- Location:
- rtos_arduino/trunk/arduino_lib/libraries
- Files:
-
- 83 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
rtos_arduino/trunk/arduino_lib/libraries/NAxesMotion/NAxisMotion.h
r136 r175 137 137 *Return Parameter: None 138 138 *******************************************************************************************/ 139 #if defined(ARDUINO_ARCH_SAMD)140 void initSensor(unsigned int address = 0x29);141 #else /* !defined(ARDUINO_ARCH_SAMD) */142 139 void initSensor(unsigned int address = 0x28); 143 #endif /* defined(ARDUINO_ARCH_SAMD) */144 140 145 141 /******************************************************************************************* -
rtos_arduino/trunk/arduino_lib/libraries/RTC/examples/ALARM_interrupt/ALARM_interrupt.ino
r136 r175 3 3 This mode is more conveniently because you use processor for other tasks and when alarm match occurs interrupt routine is executed. 4 4 In this way, alarm flag checking is indipendent from main program flow. 5 6 NOTE: for M0/M0 pro only you can select the oscillator source for count. 7 If you want to use a low power oscillator use rtc.begin(TIME_H24, LOW_POWER); function. 8 If you want to use a more accurate oscillator use rtc.begin(TIME_H24, HIGH_PRECISION); function. 5 9 ******************************************************************************************************************************************************************************/ 6 10 … … 18 22 rtc.setDate(13,8,15); //setting date 19 23 rtc.enableAlarm(SEC,ALARM_INTERRUPT,alarm_int); //enabling alarm in polled mode and match on second 20 rtc. local_time.hour=17;21 rtc. local_time.minute=5;22 rtc. local_time.second=10; //setting second to match24 rtc.time.hour=17; 25 rtc.time.minute=5; 26 rtc.time.second=10; //setting second to match 23 27 rtc.setAlarm(); //write second in alarm register 24 28 } -
rtos_arduino/trunk/arduino_lib/libraries/RTC/examples/ALARM_polled/ALARM_polled.ino
r136 r175 2 2 * This sketch demonstrates how configure alarm in polled mode. 3 3 In this mode you hav to check continuously ALARM0 flag in the main program code. 4 5 NOTE: for M0/M0 pro only you can select the oscillator source for count. 6 If you want to use a low power oscillator use rtc.begin(TIME_H24, LOW_POWER); function. 7 If you want to use a more accurate oscillator use rtc.begin(TIME_H24, HIGH_PRECISION); function. 4 8 *********************************************************************************************************************************************************************************/ 5 9 … … 17 21 rtc.setDate(13,8,15); //setting date 18 22 rtc.enableAlarm(SEC,ALARM_POLLED,NULL); //enabling alarm in polled mode and match on second 19 rtc. local_time.hour=17;20 rtc. local_time.minute=5;21 rtc. local_time.second=10; //setting second to match23 rtc.time.hour=17; 24 rtc.time.minute=5; 25 rtc.time.second=10; //setting second to match 22 26 rtc.setAlarm(); //write second in alarm register 23 27 } -
rtos_arduino/trunk/arduino_lib/libraries/RTC/examples/RTC_simple/RTC_simple.ino
r136 r175 2 2 This sketch gives a simple demonstration of how to use RTC library. 3 3 The code sets date and time using internal structure and then print on serial date and time. Time representation is 12 hour mode 4 5 NOTE: for M0/M0 pro only you can select the oscillator source for count. 6 If you want to use a low power oscillator use rtc.begin(TIME_H12, LOW_POWER); function. 7 If you want to use a more accurate oscillator use rtc.begin(TIME_H12, HIGH_PRECISION); function. 4 8 **********************************************************************************************************************************************************/ 5 9 … … 17 21 18 22 //filling internal structure for time 19 rtc. local_time.hour = 10; //hour20 rtc. local_time.minute = 44; //minute21 rtc. local_time.second = 0; //second22 rtc. local_time.Tmode = ANTI_MERIDIAN;23 rtc.time.hour = 10; //hour 24 rtc.time.minute = 44; //minute 25 rtc.time.second = 0; //second 26 rtc.time.Tmode = ANTI_MERIDIAN; 23 27 24 28 //filling internal structure for date 25 rtc. local_date.day = 13; //day26 rtc. local_date.month = 8; //month27 rtc. local_date.year = 15; //year29 rtc.date.day = 13; //day 30 rtc.date.month = 8; //month 31 rtc.date.year = 15; //year 28 32 29 33 rtc.setTime(); //setting time … … 42 46 43 47 //printing date in format YYYY/MM/DD 44 Serial.print(rtc. local_date.year+2000); // year48 Serial.print(rtc.date.year+2000); // year 45 49 Serial.print('/'); 46 Serial.print(rtc. local_date.month); // month50 Serial.print(rtc.date.month); // month 47 51 Serial.print('/'); 48 Serial.print(rtc. local_date.day); // day52 Serial.print(rtc.date.day); // day 49 53 Serial.print(' '); 50 54 51 55 //printing time 52 Serial.print(rtc. local_time.hour); //hour56 Serial.print(rtc.time.hour); //hour 53 57 Serial.print(':'); 54 Serial.print(rtc. local_time.minute); //minute58 Serial.print(rtc.time.minute); //minute 55 59 Serial.print(':'); 56 Serial.print(rtc. local_time.second); //second60 Serial.print(rtc.time.second); //second 57 61 Serial.print (' '); 58 if(rtc. local_time.Tmode == ANTI_MERIDIAN) Serial.println("AM"); // print AM or PM62 if(rtc.time.Tmode == ANTI_MERIDIAN) Serial.println("AM"); // print AM or PM 59 63 else Serial.println("PM"); 60 64 -
rtos_arduino/trunk/arduino_lib/libraries/RTC/examples/RTC_simple_24H_mode/RTC_simple_24H_mode.ino
r136 r175 2 2 This sketch gives a simple demonstration of how to use RTC library. 3 3 The code sets date and time using internal structure and then print on serial date and time. Time representation is 24 hour mode 4 5 NOTE: for M0/M0 pro only you can select the oscillator source for count. 6 If you want to use a low power oscillator use rtc.begin(TIME_H24, LOW_POWER); function. 7 If you want to use a more accurate oscillator use rtc.begin(TIME_H24, HIGH_PRECISION); function. 4 8 **********************************************************************************************************************************************************/ 5 9 … … 34 38 35 39 //printing date in format YYYY/MM/DD 36 Serial.print(rtc. local_date.year+2000); // year40 Serial.print(rtc.date.year+2000); // year 37 41 Serial.print('/'); 38 Serial.print(rtc. local_date.month); // month42 Serial.print(rtc.date.month); // month 39 43 Serial.print('/'); 40 Serial.print(rtc. local_date.day); // day44 Serial.print(rtc.date.day); // day 41 45 Serial.print(' '); 42 46 43 47 //printing time 44 Serial.print(rtc. local_time.hour); //hour48 Serial.print(rtc.time.hour); //hour 45 49 Serial.print(':'); 46 Serial.print(rtc. local_time.minute); //minute50 Serial.print(rtc.time.minute); //minute 47 51 Serial.print(':'); 48 Serial.println(rtc. local_time.second); //second52 Serial.println(rtc.time.second); //second 49 53 50 54 delay(1000); -
rtos_arduino/trunk/arduino_lib/libraries/RTC/src/RTCInt.cpp
r136 r175 2 2 RTC library for Arduino M0/M0PRO. 3 3 Copyright (c) 2015 Arduino SRL. All right reserved. 4 5 4 This library is free software; you can redistribute it and/or 6 5 modify it under the terms of the GNU Lesser General Public 7 6 License as published by the Free Software Foundation; either 8 7 version 2.1 of the License, or (at your option) any later version. 9 10 8 This library is distributed in the hope that it will be useful, 11 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 11 Lesser General Public License for more details. 14 15 12 You should have received a copy of the GNU Lesser General Public 16 13 License along with this library; if not, write to the Free Software … … 28 25 *Return Parameter: None 29 26 *******************************************************************************************/ 30 void RTCInt::begin(bool timeRep )27 void RTCInt::begin(bool timeRep, int oscillatorType) 31 28 { 32 29 … … 37 34 while (GCLK->STATUS.bit.SYNCBUSY); 38 35 39 GCLK->GENCTRL.reg = (GCLK_GENCTRL_GENEN | GCLK_GENCTRL_SRC_OSCULP32K | GCLK_GENCTRL_ID(4) | GCLK_GENCTRL_DIVSEL ); 36 //Set the oscillator to use - M0 only 37 if(oscillatorType==HIGH_PRECISION) 38 //External oscillator 39 GCLK->GENCTRL.reg = (GCLK_GENCTRL_GENEN | GCLK_GENCTRL_SRC_XOSC32K | GCLK_GENCTRL_ID(4) | GCLK_GENCTRL_DIVSEL ); 40 41 else 42 //Internal low power oscillator (default configuration) 43 GCLK->GENCTRL.reg = (GCLK_GENCTRL_GENEN | GCLK_GENCTRL_SRC_OSCULP32K | GCLK_GENCTRL_ID(4) | GCLK_GENCTRL_DIVSEL ); 44 40 45 while (GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY); 41 46 … … 73 78 RTCenable(); 74 79 80 } 81 82 void RTCInt::begin(bool timeRep){ 83 begin(timeRep, LOW_POWER); 75 84 } 76 85 … … 132 141 133 142 /********************************************************************************************************************** 134 *Description: Function for getting time (hours, minutes and seconds). This function fills a structure called local_time143 *Description: Function for getting time (hours, minutes and seconds). This function fills a structure called time 135 144 accessible in the class RTCInt. 136 145 *Input Parameters: None … … 141 150 unsigned int hour=0, h=0; 142 151 143 local_time.hour = getHour();152 time.hour = getHour(); 144 153 if(time_Mode == TIME_H12) 145 154 { 146 155 h=RTC->MODE2.CLOCK.bit.HOUR; 147 156 while (RTCSync()); 148 local_time.Tmode = h & 0x10;157 time.Tmode = h & 0x10; 149 158 } 150 local_time.minute = getMinute();151 local_time.second = getSecond();159 time.minute = getMinute(); 160 time.second = getSecond(); 152 161 } 153 162 … … 219 228 220 229 /********************************************************************************************************************** 221 *Description: Function for getting date (day, month and year). This function fills a structure called local_date230 *Description: Function for getting date (day, month and year). This function fills a structure called date 222 231 accessible in the class RTCInt. 223 232 *Input Parameters: None … … 226 235 void RTCInt::getDate(void) 227 236 { 228 local_date.day = getDay();229 local_date.month = getMonth();230 local_date.year = getYear();237 date.day = getDay(); 238 date.month = getMonth(); 239 date.year = getYear(); 231 240 } 232 241 … … 315 324 /********************************************************************************************************************** 316 325 *Description: Function for setting time (hour, minute and second). This function sets time retrieving values from a 317 local structure called local_time accessible in the class RTCInt.326 local structure called time accessible in the class RTCInt. 318 327 *Input Parameters: None 319 328 *Return Parameter: None … … 321 330 void RTCInt::setTime(void) 322 331 { 323 setHour( local_time.hour,local_time.Tmode);324 setMinute( local_time.minute);325 setSecond( local_time.second);332 setHour(time.hour,time.Tmode); 333 setMinute(time.minute); 334 setSecond(time.second); 326 335 } 327 336 … … 397 406 /********************************************************************************************************************** 398 407 *Description: Function for setting date (day, month and year). This function retrieves values from a local structure 399 called local_date accessible in the class RTCInt.408 called date accessible in the class RTCInt. 400 409 *Input Parameters: None 401 410 *Return Parameter: None … … 403 412 void RTCInt::setDate(void) 404 413 { 405 setDay( local_date.day);406 setMonth( local_date.month);407 setYear( local_date.year);414 setDay(date.day); 415 setMonth(date.month); 416 setYear(date.year); 408 417 } 409 418 … … 461 470 /********************************************************************************************************************** 462 471 *Description: Function for setting alarm. This function retrieves values from two local structures 463 called local_date and local_time accessible in the class RTCInt. According to match alarm type, values464 can be obtained from local_time, local_date or both structures.472 called date and time accessible in the class RTCInt. According to match alarm type, values 473 can be obtained from time, date or both structures. 465 474 *Input Parameters: None 466 475 *Return Parameter: None … … 474 483 break; 475 484 case SEC : 476 RTC->MODE2.Mode2Alarm->ALARM.bit.SECOND= local_time.second;485 RTC->MODE2.Mode2Alarm->ALARM.bit.SECOND= time.second; 477 486 while (RTCSync()); 478 487 break; 479 488 case MMSS : 480 RTC->MODE2.Mode2Alarm->ALARM.bit.MINUTE= local_time.minute;481 while (RTCSync()); 482 RTC->MODE2.Mode2Alarm->ALARM.bit.SECOND= local_time.second;489 RTC->MODE2.Mode2Alarm->ALARM.bit.MINUTE= time.minute; 490 while (RTCSync()); 491 RTC->MODE2.Mode2Alarm->ALARM.bit.SECOND= time.second; 483 492 while (RTCSync()); 484 493 break; 485 494 case HHMMSS : 486 RTC->MODE2.Mode2Alarm->ALARM.bit.HOUR= local_time.hour;487 while (RTCSync()); 488 RTC->MODE2.Mode2Alarm->ALARM.bit.MINUTE= local_time.minute;489 while (RTCSync()); 490 RTC->MODE2.Mode2Alarm->ALARM.bit.SECOND= local_time.second;495 RTC->MODE2.Mode2Alarm->ALARM.bit.HOUR= time.hour; 496 while (RTCSync()); 497 RTC->MODE2.Mode2Alarm->ALARM.bit.MINUTE= time.minute; 498 while (RTCSync()); 499 RTC->MODE2.Mode2Alarm->ALARM.bit.SECOND= time.second; 491 500 while (RTCSync()); 492 501 break; 493 502 case DDHHMMSS : 494 RTC->MODE2.Mode2Alarm->ALARM.bit.DAY= local_date.day;495 while (RTCSync()); 496 RTC->MODE2.Mode2Alarm->ALARM.bit.HOUR= local_time.hour;497 while (RTCSync()); 498 RTC->MODE2.Mode2Alarm->ALARM.bit.MINUTE= local_time.minute;499 while (RTCSync()); 500 RTC->MODE2.Mode2Alarm->ALARM.bit.SECOND= local_time.second;503 RTC->MODE2.Mode2Alarm->ALARM.bit.DAY= date.day; 504 while (RTCSync()); 505 RTC->MODE2.Mode2Alarm->ALARM.bit.HOUR= time.hour; 506 while (RTCSync()); 507 RTC->MODE2.Mode2Alarm->ALARM.bit.MINUTE= time.minute; 508 while (RTCSync()); 509 RTC->MODE2.Mode2Alarm->ALARM.bit.SECOND= time.second; 501 510 while (RTCSync()); 502 511 break; 503 512 case MMDDHHMMSS : 504 RTC->MODE2.Mode2Alarm->ALARM.bit.MONTH= local_date.month;505 while (RTCSync()); 506 RTC->MODE2.Mode2Alarm->ALARM.bit.DAY= local_date.day;507 while (RTCSync()); 508 RTC->MODE2.Mode2Alarm->ALARM.bit.HOUR= local_time.hour;509 while (RTCSync()); 510 RTC->MODE2.Mode2Alarm->ALARM.bit.MINUTE= local_time.minute;511 while (RTCSync()); 512 RTC->MODE2.Mode2Alarm->ALARM.bit.SECOND= local_time.second;513 RTC->MODE2.Mode2Alarm->ALARM.bit.MONTH= date.month; 514 while (RTCSync()); 515 RTC->MODE2.Mode2Alarm->ALARM.bit.DAY= date.day; 516 while (RTCSync()); 517 RTC->MODE2.Mode2Alarm->ALARM.bit.HOUR= time.hour; 518 while (RTCSync()); 519 RTC->MODE2.Mode2Alarm->ALARM.bit.MINUTE= time.minute; 520 while (RTCSync()); 521 RTC->MODE2.Mode2Alarm->ALARM.bit.SECOND= time.second; 513 522 while (RTCSync()); 514 523 break; 515 524 case YYMMDDHHMMSS : 516 RTC->MODE2.Mode2Alarm->ALARM.bit.YEAR= local_date.year;517 while (RTCSync()); 518 RTC->MODE2.Mode2Alarm->ALARM.bit.MONTH= local_date.month;519 while (RTCSync()); 520 RTC->MODE2.Mode2Alarm->ALARM.bit.DAY= local_date.day;521 while (RTCSync()); 522 RTC->MODE2.Mode2Alarm->ALARM.bit.HOUR= local_time.hour;523 while (RTCSync()); 524 RTC->MODE2.Mode2Alarm->ALARM.bit.MINUTE= local_time.minute;525 while (RTCSync()); 526 RTC->MODE2.Mode2Alarm->ALARM.bit.SECOND= local_time.second;525 RTC->MODE2.Mode2Alarm->ALARM.bit.YEAR= date.year; 526 while (RTCSync()); 527 RTC->MODE2.Mode2Alarm->ALARM.bit.MONTH= date.month; 528 while (RTCSync()); 529 RTC->MODE2.Mode2Alarm->ALARM.bit.DAY= date.day; 530 while (RTCSync()); 531 RTC->MODE2.Mode2Alarm->ALARM.bit.HOUR= time.hour; 532 while (RTCSync()); 533 RTC->MODE2.Mode2Alarm->ALARM.bit.MINUTE= time.minute; 534 while (RTCSync()); 535 RTC->MODE2.Mode2Alarm->ALARM.bit.SECOND= time.second; 527 536 while (RTCSync()); 528 537 break; -
rtos_arduino/trunk/arduino_lib/libraries/RTC/src/RTCInt.h
r136 r175 2 2 RTC library for Arduino Zero. 3 3 Copyright (c) 2015 Arduino LLC. All right reserved. 4 5 4 This library is free software; you can redistribute it and/or 6 5 modify it under the terms of the GNU Lesser General Public 7 6 License as published by the Free Software Foundation; either 8 7 version 2.1 of the License, or (at your option) any later version. 9 10 8 This library is distributed in the hope that it will be useful, 11 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 11 Lesser General Public License for more details. 14 15 12 You should have received a copy of the GNU Lesser General Public 16 13 License along with this library; if not, write to the Free Software … … 38 35 #define POST_MERIDIAN 1 39 36 37 //Parameter for oscillatorType - M0 only 38 #define HIGH_PRECISION 0 39 #define LOW_POWER 1 40 40 41 #include "Arduino.h" 41 42 … … 60 61 RTCInt() {}; 61 62 62 TIME local_time;63 DATE local_date;63 TIME time; 64 DATE date; 64 65 66 void begin(bool timeMode, int oscillatorType); 65 67 void begin(bool timeMode); 66 68 -
rtos_arduino/trunk/arduino_lib/libraries/Rest/library.properties
r136 r175 5 5 sentence=Allows to use the sleep functionalities. For Arduino M0 or M0PRO only. 6 6 paragraph=With this library you can manage power on an Arduino M0/M0PRO. 7 category= power7 category=Device Control 8 8 url=http://www.arduino.org 9 9 architectures=samd -
rtos_arduino/trunk/arduino_lib/libraries/TFT/examples/Arduino/TFTDisplayText/TFTDisplayText.ino
r144 r175 21 21 // pin definition for the Uno 22 22 #define cs 10 23 #define dc 824 #define rst 923 #define dc 9 24 #define rst 8 25 25 26 26 // pin definition for the Leonardo
Note:
See TracChangeset
for help on using the changeset viewer.