Web server based weather station using Sparkfun Weather Meters.

Dependencies:   FatFileSystem mbed WeatherMeters SDFileSystem

Committer:
AdamGreen
Date:
Sat Feb 25 03:28:05 2012 +0000
Revision:
1:c7958aa34fa1
Parent:
0:616601bde9fb
Use published libraries where possible.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AdamGreen 0:616601bde9fb 1 #include "sys_arch.h"
AdamGreen 0:616601bde9fb 2 #include "mbed.h"
AdamGreen 0:616601bde9fb 3 //DG 2010
AdamGreen 0:616601bde9fb 4
AdamGreen 0:616601bde9fb 5 #ifdef __cplusplus
AdamGreen 0:616601bde9fb 6 extern "C" {
AdamGreen 0:616601bde9fb 7 #endif
AdamGreen 0:616601bde9fb 8
AdamGreen 0:616601bde9fb 9 #ifdef __COMPLEX_AND_BUGGUY_HANDLING__
AdamGreen 0:616601bde9fb 10 static Timer* pTmr = NULL;
AdamGreen 0:616601bde9fb 11
AdamGreen 0:616601bde9fb 12 void sys_init(void)
AdamGreen 0:616601bde9fb 13 {
AdamGreen 0:616601bde9fb 14 //Start Timer
AdamGreen 0:616601bde9fb 15 pTmr = new Timer();
AdamGreen 0:616601bde9fb 16 pTmr->start();
AdamGreen 0:616601bde9fb 17 }
AdamGreen 0:616601bde9fb 18
AdamGreen 0:616601bde9fb 19 u32_t sys_jiffies(void) /* since power up. */
AdamGreen 0:616601bde9fb 20 {
AdamGreen 0:616601bde9fb 21 return (u32_t) (pTmr->read_ms()/10); //In /10ms units
AdamGreen 0:616601bde9fb 22 }
AdamGreen 0:616601bde9fb 23
AdamGreen 0:616601bde9fb 24 u32_t sys_now(void)
AdamGreen 0:616601bde9fb 25 {
AdamGreen 0:616601bde9fb 26 return (u32_t) pTmr->read_ms(); //In /ms units
AdamGreen 0:616601bde9fb 27 }
AdamGreen 0:616601bde9fb 28 #elif0
AdamGreen 0:616601bde9fb 29 void sys_init(void)
AdamGreen 0:616601bde9fb 30 {
AdamGreen 0:616601bde9fb 31
AdamGreen 0:616601bde9fb 32 }
AdamGreen 0:616601bde9fb 33
AdamGreen 0:616601bde9fb 34 u32_t sys_jiffies(void) /* since power up. */
AdamGreen 0:616601bde9fb 35 {
AdamGreen 0:616601bde9fb 36 static int count = 0;
AdamGreen 0:616601bde9fb 37 return ++count;
AdamGreen 0:616601bde9fb 38 }
AdamGreen 0:616601bde9fb 39
AdamGreen 0:616601bde9fb 40 u32_t sys_now(void)
AdamGreen 0:616601bde9fb 41 {
AdamGreen 0:616601bde9fb 42 return (u32_t) time(NULL);
AdamGreen 0:616601bde9fb 43 }
AdamGreen 0:616601bde9fb 44 #else
AdamGreen 0:616601bde9fb 45 static Timer* pTmr = NULL;
AdamGreen 0:616601bde9fb 46
AdamGreen 0:616601bde9fb 47 void sys_init(void)
AdamGreen 0:616601bde9fb 48 {
AdamGreen 0:616601bde9fb 49 //Start Timer
AdamGreen 0:616601bde9fb 50 pTmr = new Timer();
AdamGreen 0:616601bde9fb 51 pTmr->start();
AdamGreen 0:616601bde9fb 52 }
AdamGreen 0:616601bde9fb 53
AdamGreen 0:616601bde9fb 54 u32_t sys_jiffies(void) /* since power up. */
AdamGreen 0:616601bde9fb 55 {
AdamGreen 0:616601bde9fb 56 static int count = 0;
AdamGreen 0:616601bde9fb 57 return ++count;
AdamGreen 0:616601bde9fb 58 //return (u32_t) (pTmr->read_us());
AdamGreen 0:616601bde9fb 59 }
AdamGreen 0:616601bde9fb 60
AdamGreen 0:616601bde9fb 61 u32_t sys_now(void)
AdamGreen 0:616601bde9fb 62 {
AdamGreen 0:616601bde9fb 63 return (u32_t) (pTmr->read_ms()); //In /ms units
AdamGreen 0:616601bde9fb 64 }
AdamGreen 0:616601bde9fb 65 #endif
AdamGreen 0:616601bde9fb 66
AdamGreen 0:616601bde9fb 67
AdamGreen 0:616601bde9fb 68 #ifdef __cplusplus
AdamGreen 0:616601bde9fb 69 }
AdamGreen 0:616601bde9fb 70 #endif