osdep_arduino.c
Go to the documentation of this file.
00001 
00008 /*
00009  * Copyright (c) 2010 ThingMagic, Inc.
00010  *
00011  * Permission is hereby granted, free of charge, to any person obtaining a copy
00012  * of this software and associated documentation files (the "Software"), to deal
00013  * in the Software without restriction, including without limitation the rights
00014  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00015  * copies of the Software, and to permit persons to whom the Software is
00016  * furnished to do so, subject to the following conditions:
00017  *
00018  * The above copyright notice and this permission notice shall be included in
00019  * all copies or substantial portions of the Software.
00020  * 
00021  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00022  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00023  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00024  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00025  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00026  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00027  * THE SOFTWARE.
00028  */
00029 
00030 #if defined(ARDUINO) && ARDUINO >= 100
00031 #include "Arduino.h"
00032 #else
00033 #include "WProgram.h"
00034 #endif
00035 #include "osdep.h"
00036 #include "Time.h"
00037 
00038 uint64_t
00039 tmr_gettime(void)
00040 {
00041   return millis();
00042 }
00043 
00044 uint32_t
00045 tmr_gettime_low(void)
00046 {
00047   return (tmr_gettime() >>  0) & 0xffffffff;
00048 }
00049 
00050 uint32_t
00051 tmr_gettime_high(void)
00052 {
00053   return (tmr_gettime() >> 32) & 0xffffffff;
00054 }
00055 
00056 void
00057 tmr_sleep(uint32_t sleepms)
00058 {
00059   delay(sleepms);
00060 }
00061 
00062 TMR_TimeStructure
00063 tmr_gettimestructure()
00064 {
00065   uint64_t temp;
00066   time_t now;
00067   TMR_TimeStructure timestructure;
00068   static tmElements_t elements;
00069 
00070   temp = tmr_gettime();
00071   now = temp/1000;
00072 
00073   breakTime(now, elements);  // break time_t into elements
00074   timestructure.tm_year = (uint32_t)(1990 + elements.Year);
00075   timestructure.tm_mon = (uint32_t)(1 + elements.Month);
00076   timestructure.tm_mday = (uint32_t)elements.Day;
00077   timestructure.tm_hour = (uint32_t)elements.Hour;
00078   timestructure.tm_min = (uint32_t)elements.Minute;
00079   timestructure.tm_sec = (uint32_t)elements.Second;
00080   return timestructure;
00081 }


thingmagic_rfid
Author(s): Brian Bingham
autogenerated on Thu May 16 2019 03:01:23