A simple 128x32 graphical LCD program to quickstart with LCD on ARM mbed IoT Starter Kit. This requires mbed Applciation Shield with FRDM-K64F platform.

Dependencies:   C12832

Committer:
tushki7
Date:
Sun Apr 12 15:45:52 2015 +0000
Revision:
1:eb68c94a8ee5
Parent:
0:60d829a0353a
A simple 128x32 LCD program with ARM mbed IoT Starter Kit;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tushki7 0:60d829a0353a 1 /* mbed Microcontroller Library
tushki7 0:60d829a0353a 2 * Copyright (c) 2006-2013 ARM Limited
tushki7 0:60d829a0353a 3 *
tushki7 0:60d829a0353a 4 * Licensed under the Apache License, Version 2.0 (the "License");
tushki7 0:60d829a0353a 5 * you may not use this file except in compliance with the License.
tushki7 0:60d829a0353a 6 * You may obtain a copy of the License at
tushki7 0:60d829a0353a 7 *
tushki7 0:60d829a0353a 8 * http://www.apache.org/licenses/LICENSE-2.0
tushki7 0:60d829a0353a 9 *
tushki7 0:60d829a0353a 10 * Unless required by applicable law or agreed to in writing, software
tushki7 0:60d829a0353a 11 * distributed under the License is distributed on an "AS IS" BASIS,
tushki7 0:60d829a0353a 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
tushki7 0:60d829a0353a 13 * See the License for the specific language governing permissions and
tushki7 0:60d829a0353a 14 * limitations under the License.
tushki7 0:60d829a0353a 15 */
tushki7 0:60d829a0353a 16
tushki7 0:60d829a0353a 17 #include <time.h>
tushki7 0:60d829a0353a 18
tushki7 0:60d829a0353a 19 #ifdef __cplusplus
tushki7 0:60d829a0353a 20 extern "C" {
tushki7 0:60d829a0353a 21 #endif
tushki7 0:60d829a0353a 22
tushki7 0:60d829a0353a 23 /** Implementation of the C time.h functions
tushki7 0:60d829a0353a 24 *
tushki7 0:60d829a0353a 25 * Provides mechanisms to set and read the current time, based
tushki7 0:60d829a0353a 26 * on the microcontroller Real-Time Clock (RTC), plus some
tushki7 0:60d829a0353a 27 * standard C manipulation and formating functions.
tushki7 0:60d829a0353a 28 *
tushki7 0:60d829a0353a 29 * Example:
tushki7 0:60d829a0353a 30 * @code
tushki7 0:60d829a0353a 31 * #include "mbed.h"
tushki7 0:60d829a0353a 32 *
tushki7 0:60d829a0353a 33 * int main() {
tushki7 0:60d829a0353a 34 * set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37
tushki7 0:60d829a0353a 35 *
tushki7 0:60d829a0353a 36 * while(1) {
tushki7 0:60d829a0353a 37 * time_t seconds = time(NULL);
tushki7 0:60d829a0353a 38 *
tushki7 0:60d829a0353a 39 * printf("Time as seconds since January 1, 1970 = %d\n", seconds);
tushki7 0:60d829a0353a 40 *
tushki7 0:60d829a0353a 41 * printf("Time as a basic string = %s", ctime(&seconds));
tushki7 0:60d829a0353a 42 *
tushki7 0:60d829a0353a 43 * char buffer[32];
tushki7 0:60d829a0353a 44 * strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
tushki7 0:60d829a0353a 45 * printf("Time as a custom formatted string = %s", buffer);
tushki7 0:60d829a0353a 46 *
tushki7 0:60d829a0353a 47 * wait(1);
tushki7 0:60d829a0353a 48 * }
tushki7 0:60d829a0353a 49 * }
tushki7 0:60d829a0353a 50 * @endcode
tushki7 0:60d829a0353a 51 */
tushki7 0:60d829a0353a 52
tushki7 0:60d829a0353a 53 /** Set the current time
tushki7 0:60d829a0353a 54 *
tushki7 0:60d829a0353a 55 * Initialises and sets the time of the microcontroller Real-Time Clock (RTC)
tushki7 0:60d829a0353a 56 * to the time represented by the number of seconds since January 1, 1970
tushki7 0:60d829a0353a 57 * (the UNIX timestamp).
tushki7 0:60d829a0353a 58 *
tushki7 0:60d829a0353a 59 * @param t Number of seconds since January 1, 1970 (the UNIX timestamp)
tushki7 0:60d829a0353a 60 *
tushki7 0:60d829a0353a 61 * Example:
tushki7 0:60d829a0353a 62 * @code
tushki7 0:60d829a0353a 63 * #include "mbed.h"
tushki7 0:60d829a0353a 64 *
tushki7 0:60d829a0353a 65 * int main() {
tushki7 0:60d829a0353a 66 * set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37
tushki7 0:60d829a0353a 67 * }
tushki7 0:60d829a0353a 68 * @endcode
tushki7 0:60d829a0353a 69 */
tushki7 0:60d829a0353a 70 void set_time(time_t t);
tushki7 0:60d829a0353a 71
tushki7 0:60d829a0353a 72 /** Attach an external RTC to be used for the C time functions
tushki7 0:60d829a0353a 73 *
tushki7 0:60d829a0353a 74 * Do not call this function from an interrupt while an RTC read/write operation may be occurring
tushki7 0:60d829a0353a 75 *
tushki7 0:60d829a0353a 76 * @param read_rtc pointer to function which returns current UNIX timestamp
tushki7 0:60d829a0353a 77 * @param write_rtc pointer to function which sets current UNIX timestamp, can be NULL
tushki7 0:60d829a0353a 78 * @param init_rtc pointer to funtion which initializes RTC, can be NULL
tushki7 0:60d829a0353a 79 * @param isenabled_rtc pointer to function wich returns if the rtc is enabled, can be NULL
tushki7 0:60d829a0353a 80 */
tushki7 0:60d829a0353a 81 void attach_rtc(time_t (*read_rtc)(void), void (*write_rtc)(time_t), void (*init_rtc)(void), int (*isenabled_rtc)(void));
tushki7 0:60d829a0353a 82
tushki7 0:60d829a0353a 83 #ifdef __cplusplus
tushki7 0:60d829a0353a 84 }
tushki7 0:60d829a0353a 85 #endif