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 * auth.h - PPP Authentication and phase control header file.
cheungderek 0:e083abcfe7a8 3 *
cheungderek 0:e083abcfe7a8 4 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
cheungderek 0:e083abcfe7a8 5 * portions Copyright (c) 1998 Global Election Systems Inc.
cheungderek 0:e083abcfe7a8 6 *
cheungderek 0:e083abcfe7a8 7 * The authors hereby grant permission to use, copy, modify, distribute,
cheungderek 0:e083abcfe7a8 8 * and license this software and its documentation for any purpose, provided
cheungderek 0:e083abcfe7a8 9 * that existing copyright notices are retained in all copies and that this
cheungderek 0:e083abcfe7a8 10 * notice and the following disclaimer are included verbatim in any
cheungderek 0:e083abcfe7a8 11 * distributions. No written agreement, license, or royalty fee is required
cheungderek 0:e083abcfe7a8 12 * for any of the authorized uses.
cheungderek 0:e083abcfe7a8 13 *
cheungderek 0:e083abcfe7a8 14 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
cheungderek 0:e083abcfe7a8 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
cheungderek 0:e083abcfe7a8 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
cheungderek 0:e083abcfe7a8 17 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
cheungderek 0:e083abcfe7a8 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
cheungderek 0:e083abcfe7a8 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
cheungderek 0:e083abcfe7a8 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
cheungderek 0:e083abcfe7a8 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
cheungderek 0:e083abcfe7a8 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
cheungderek 0:e083abcfe7a8 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cheungderek 0:e083abcfe7a8 24 *
cheungderek 0:e083abcfe7a8 25 ******************************************************************************
cheungderek 0:e083abcfe7a8 26 * REVISION HISTORY
cheungderek 0:e083abcfe7a8 27 *
cheungderek 0:e083abcfe7a8 28 * 03-01-01 Marc Boucher <marc@mbsi.ca>
cheungderek 0:e083abcfe7a8 29 * Ported to lwIP.
cheungderek 0:e083abcfe7a8 30 * 97-12-04 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
cheungderek 0:e083abcfe7a8 31 * Original derived from BSD pppd.h.
cheungderek 0:e083abcfe7a8 32 *****************************************************************************/
cheungderek 0:e083abcfe7a8 33 /*
cheungderek 0:e083abcfe7a8 34 * pppd.h - PPP daemon global declarations.
cheungderek 0:e083abcfe7a8 35 *
cheungderek 0:e083abcfe7a8 36 * Copyright (c) 1989 Carnegie Mellon University.
cheungderek 0:e083abcfe7a8 37 * All rights reserved.
cheungderek 0:e083abcfe7a8 38 *
cheungderek 0:e083abcfe7a8 39 * Redistribution and use in source and binary forms are permitted
cheungderek 0:e083abcfe7a8 40 * provided that the above copyright notice and this paragraph are
cheungderek 0:e083abcfe7a8 41 * duplicated in all such forms and that any documentation,
cheungderek 0:e083abcfe7a8 42 * advertising materials, and other materials related to such
cheungderek 0:e083abcfe7a8 43 * distribution and use acknowledge that the software was developed
cheungderek 0:e083abcfe7a8 44 * by Carnegie Mellon University. The name of the
cheungderek 0:e083abcfe7a8 45 * University may not be used to endorse or promote products derived
cheungderek 0:e083abcfe7a8 46 * from this software without specific prior written permission.
cheungderek 0:e083abcfe7a8 47 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
cheungderek 0:e083abcfe7a8 48 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
cheungderek 0:e083abcfe7a8 49 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
cheungderek 0:e083abcfe7a8 50 *
cheungderek 0:e083abcfe7a8 51 */
cheungderek 0:e083abcfe7a8 52
cheungderek 0:e083abcfe7a8 53 #ifndef AUTH_H
cheungderek 0:e083abcfe7a8 54 #define AUTH_H
cheungderek 0:e083abcfe7a8 55
cheungderek 0:e083abcfe7a8 56 /***********************
cheungderek 0:e083abcfe7a8 57 *** PUBLIC FUNCTIONS ***
cheungderek 0:e083abcfe7a8 58 ***********************/
cheungderek 0:e083abcfe7a8 59
cheungderek 0:e083abcfe7a8 60 /* we are starting to use the link */
cheungderek 0:e083abcfe7a8 61 void link_required (int);
cheungderek 0:e083abcfe7a8 62
cheungderek 0:e083abcfe7a8 63 /* we are finished with the link */
cheungderek 0:e083abcfe7a8 64 void link_terminated (int);
cheungderek 0:e083abcfe7a8 65
cheungderek 0:e083abcfe7a8 66 /* the LCP layer has left the Opened state */
cheungderek 0:e083abcfe7a8 67 void link_down (int);
cheungderek 0:e083abcfe7a8 68
cheungderek 0:e083abcfe7a8 69 /* the link is up; authenticate now */
cheungderek 0:e083abcfe7a8 70 void link_established (int);
cheungderek 0:e083abcfe7a8 71
cheungderek 0:e083abcfe7a8 72 /* a network protocol has come up */
cheungderek 0:e083abcfe7a8 73 void np_up (int, u16_t);
cheungderek 0:e083abcfe7a8 74
cheungderek 0:e083abcfe7a8 75 /* a network protocol has gone down */
cheungderek 0:e083abcfe7a8 76 void np_down (int, u16_t);
cheungderek 0:e083abcfe7a8 77
cheungderek 0:e083abcfe7a8 78 /* a network protocol no longer needs link */
cheungderek 0:e083abcfe7a8 79 void np_finished (int, u16_t);
cheungderek 0:e083abcfe7a8 80
cheungderek 0:e083abcfe7a8 81 /* peer failed to authenticate itself */
cheungderek 0:e083abcfe7a8 82 void auth_peer_fail (int, u16_t);
cheungderek 0:e083abcfe7a8 83
cheungderek 0:e083abcfe7a8 84 /* peer successfully authenticated itself */
cheungderek 0:e083abcfe7a8 85 void auth_peer_success (int, u16_t, char *, int);
cheungderek 0:e083abcfe7a8 86
cheungderek 0:e083abcfe7a8 87 /* we failed to authenticate ourselves */
cheungderek 0:e083abcfe7a8 88 void auth_withpeer_fail (int, u16_t);
cheungderek 0:e083abcfe7a8 89
cheungderek 0:e083abcfe7a8 90 /* we successfully authenticated ourselves */
cheungderek 0:e083abcfe7a8 91 void auth_withpeer_success (int, u16_t);
cheungderek 0:e083abcfe7a8 92
cheungderek 0:e083abcfe7a8 93 /* check authentication options supplied */
cheungderek 0:e083abcfe7a8 94 void auth_check_options (void);
cheungderek 0:e083abcfe7a8 95
cheungderek 0:e083abcfe7a8 96 /* check what secrets we have */
cheungderek 0:e083abcfe7a8 97 void auth_reset (int);
cheungderek 0:e083abcfe7a8 98
cheungderek 0:e083abcfe7a8 99 /* Check peer-supplied username/password */
cheungderek 0:e083abcfe7a8 100 u_char check_passwd (int, char *, int, char *, int, char **, int *);
cheungderek 0:e083abcfe7a8 101
cheungderek 0:e083abcfe7a8 102 /* get "secret" for chap */
cheungderek 0:e083abcfe7a8 103 int get_secret (int, char *, char *, char *, int *, int);
cheungderek 0:e083abcfe7a8 104
cheungderek 0:e083abcfe7a8 105 /* check if IP address is authorized */
cheungderek 0:e083abcfe7a8 106 int auth_ip_addr (int, u32_t);
cheungderek 0:e083abcfe7a8 107
cheungderek 0:e083abcfe7a8 108 /* check if IP address is unreasonable */
cheungderek 0:e083abcfe7a8 109 int bad_ip_adrs (u32_t);
cheungderek 0:e083abcfe7a8 110
cheungderek 0:e083abcfe7a8 111 #endif /* AUTH_H */