SampleIoT
Dependencies: C12832 EthernetInterface IBMIoTF LM75B MMA7660 MQTT mbed-rtos mbed
Fork of IBMIoTClientLibrarySample by
src/LPC1768.h@0:555ea43ec379, 2015-11-06 (annotated)
- Committer:
- sathipal
- Date:
- Fri Nov 06 07:39:04 2015 +0000
- Revision:
- 0:555ea43ec379
- Child:
- 1:e58533b6bc6b
Sample code that shows how to use IBMIoTF library to connect the mbed LPC1768 or FRDM-K64F devices to the IBM Internet of Things Cloud service.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sathipal | 0:555ea43ec379 | 1 | /******************************************************************************* |
sathipal | 0:555ea43ec379 | 2 | * Copyright (c) 2014 IBM Corp. |
sathipal | 0:555ea43ec379 | 3 | * |
sathipal | 0:555ea43ec379 | 4 | * All rights reserved. This program and the accompanying materials |
sathipal | 0:555ea43ec379 | 5 | * are made available under the terms of the Eclipse Public License v1.0 |
sathipal | 0:555ea43ec379 | 6 | * and Eclipse Distribution License v1.0 which accompany this distribution. |
sathipal | 0:555ea43ec379 | 7 | * |
sathipal | 0:555ea43ec379 | 8 | * The Eclipse Public License is available at |
sathipal | 0:555ea43ec379 | 9 | * http://www.eclipse.org/legal/epl-v10.html |
sathipal | 0:555ea43ec379 | 10 | * and the Eclipse Distribution License is available at |
sathipal | 0:555ea43ec379 | 11 | * http://www.eclipse.org/org/documents/edl-v10.php. |
sathipal | 0:555ea43ec379 | 12 | * |
sathipal | 0:555ea43ec379 | 13 | * Contributors: |
sathipal | 0:555ea43ec379 | 14 | * Ian Craggs - initial implementation |
sathipal | 0:555ea43ec379 | 15 | * Sam Grove - added mehtod to check the status of the Ethernet cable |
sathipal | 0:555ea43ec379 | 16 | *******************************************************************************/ |
sathipal | 0:555ea43ec379 | 17 | |
sathipal | 0:555ea43ec379 | 18 | #if !defined(LPC1768_H) |
sathipal | 0:555ea43ec379 | 19 | #define LPC1768_H |
sathipal | 0:555ea43ec379 | 20 | |
sathipal | 0:555ea43ec379 | 21 | C12832 lcd(p5, p7, p6, p8, p11); |
sathipal | 0:555ea43ec379 | 22 | DigitalOut led2(LED2); |
sathipal | 0:555ea43ec379 | 23 | PwmOut r(p23); |
sathipal | 0:555ea43ec379 | 24 | PwmOut g(p24); |
sathipal | 0:555ea43ec379 | 25 | PwmOut b(p25); |
sathipal | 0:555ea43ec379 | 26 | MMA7660 MMA(p28, p27); |
sathipal | 0:555ea43ec379 | 27 | LM75B sensor(p28, p27); |
sathipal | 0:555ea43ec379 | 28 | DigitalIn Down(p12); |
sathipal | 0:555ea43ec379 | 29 | DigitalIn Left(p13); |
sathipal | 0:555ea43ec379 | 30 | DigitalIn Click(p14); |
sathipal | 0:555ea43ec379 | 31 | DigitalIn Up(p15); |
sathipal | 0:555ea43ec379 | 32 | DigitalIn Right(p16); |
sathipal | 0:555ea43ec379 | 33 | AnalogIn ain1(p19); |
sathipal | 0:555ea43ec379 | 34 | AnalogIn ain2(p20); |
sathipal | 0:555ea43ec379 | 35 | |
sathipal | 0:555ea43ec379 | 36 | #define LED2_OFF 0 |
sathipal | 0:555ea43ec379 | 37 | #define LED2_ON 1 |
sathipal | 0:555ea43ec379 | 38 | |
sathipal | 0:555ea43ec379 | 39 | #define DEFAULT_TYPE_NAME "iotsample-mbed-lpc1768" |
sathipal | 0:555ea43ec379 | 40 | |
sathipal | 0:555ea43ec379 | 41 | #include "lpc_phy.h" |
sathipal | 0:555ea43ec379 | 42 | // need a wrapper since K64F and LPC1768 wont have the same name for mii read methods |
sathipal | 0:555ea43ec379 | 43 | static uint32_t linkStatus(void) |
sathipal | 0:555ea43ec379 | 44 | { |
sathipal | 0:555ea43ec379 | 45 | return (lpc_mii_read_data() & 1); |
sathipal | 0:555ea43ec379 | 46 | } |
sathipal | 0:555ea43ec379 | 47 | |
sathipal | 0:555ea43ec379 | 48 | #endif |