Read NTP time from Ethernet and drive six 7-segment LEDs using a MAX7221 to show time, date, month, week, year etc....

Dependencies:   NTPClient_NetServices mbed

Committer:
cheungderek
Date:
Wed Jun 22 01:31:47 2011 +0000
Revision:
0:e083abcfe7a8
First release.
Just some testing but working code to read NTP time and drive 6 LEDs to display time, date, month, year etc...

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cheungderek 0:e083abcfe7a8 1 /*
cheungderek 0:e083abcfe7a8 2 * Author: Adam Dunkels <adam@sics.se>
cheungderek 0:e083abcfe7a8 3 *
cheungderek 0:e083abcfe7a8 4 */
cheungderek 0:e083abcfe7a8 5 #ifndef __LWIP_ARCH_CC_H__
cheungderek 0:e083abcfe7a8 6 #define __LWIP_ARCH_CC_H__
cheungderek 0:e083abcfe7a8 7
cheungderek 0:e083abcfe7a8 8 #define LITTLE_ENDIAN 1234
cheungderek 0:e083abcfe7a8 9
cheungderek 0:e083abcfe7a8 10 #define BYTE_ORDER LITTLE_ENDIAN
cheungderek 0:e083abcfe7a8 11
cheungderek 0:e083abcfe7a8 12 typedef unsigned char u8_t;
cheungderek 0:e083abcfe7a8 13 typedef signed char s8_t;
cheungderek 0:e083abcfe7a8 14 typedef unsigned short u16_t;
cheungderek 0:e083abcfe7a8 15 typedef signed short s16_t;
cheungderek 0:e083abcfe7a8 16 typedef unsigned int u32_t;
cheungderek 0:e083abcfe7a8 17 typedef signed int s32_t;
cheungderek 0:e083abcfe7a8 18 typedef unsigned int mem_ptr_t;
cheungderek 0:e083abcfe7a8 19
cheungderek 0:e083abcfe7a8 20 #ifndef NULL
cheungderek 0:e083abcfe7a8 21 #define NULL 0
cheungderek 0:e083abcfe7a8 22 #endif
cheungderek 0:e083abcfe7a8 23
cheungderek 0:e083abcfe7a8 24 #ifndef TRUE
cheungderek 0:e083abcfe7a8 25 #define TRUE 1
cheungderek 0:e083abcfe7a8 26 #endif
cheungderek 0:e083abcfe7a8 27
cheungderek 0:e083abcfe7a8 28 #ifndef FALSE
cheungderek 0:e083abcfe7a8 29 #define FALSE 0
cheungderek 0:e083abcfe7a8 30 #endif
cheungderek 0:e083abcfe7a8 31
cheungderek 0:e083abcfe7a8 32 #include <stdlib.h>
cheungderek 0:e083abcfe7a8 33 #define LWIP_RAND rand
cheungderek 0:e083abcfe7a8 34
cheungderek 0:e083abcfe7a8 35 #define LWIP_PLATFORM_DIAG(x) DBG x
cheungderek 0:e083abcfe7a8 36 #define LWIP_PLATFORM_ASSERT(x) DBG(x)
cheungderek 0:e083abcfe7a8 37
cheungderek 0:e083abcfe7a8 38 #define LWIP_PROVIDE_ERRNO
cheungderek 0:e083abcfe7a8 39
cheungderek 0:e083abcfe7a8 40 #define U16_F "hu"
cheungderek 0:e083abcfe7a8 41 #define S16_F "hd"
cheungderek 0:e083abcfe7a8 42 #define X16_F "hx"
cheungderek 0:e083abcfe7a8 43 #define U32_F "lu"
cheungderek 0:e083abcfe7a8 44 #define S32_F "ld"
cheungderek 0:e083abcfe7a8 45 #define X32_F "lx"
cheungderek 0:e083abcfe7a8 46
cheungderek 0:e083abcfe7a8 47 #if 0
cheungderek 0:e083abcfe7a8 48 /*Create compilation problems, and according to http://www.mail-archive.com/lwip-users@nongnu.org/msg06786.html,
cheungderek 0:e083abcfe7a8 49 lwIP uses packed structures, so packing the field is not really a good idea ;) */
cheungderek 0:e083abcfe7a8 50 #define PACK_STRUCT_FIELD(x) __packed x
cheungderek 0:e083abcfe7a8 51 #else
cheungderek 0:e083abcfe7a8 52 #define PACK_STRUCT_FIELD(x) x
cheungderek 0:e083abcfe7a8 53 #endif
cheungderek 0:e083abcfe7a8 54
cheungderek 0:e083abcfe7a8 55 #define PACK_STRUCT_STRUCT
cheungderek 0:e083abcfe7a8 56 #define PACK_STRUCT_BEGIN __packed
cheungderek 0:e083abcfe7a8 57 #define PACK_STRUCT_END
cheungderek 0:e083abcfe7a8 58
cheungderek 0:e083abcfe7a8 59 #define LWIP_CHKSUM_ALGORITHM 3
cheungderek 0:e083abcfe7a8 60
cheungderek 0:e083abcfe7a8 61
cheungderek 0:e083abcfe7a8 62 #endif /* __LWIP_ARCH_CC_H__ */