Host library for controlling a WiConnect enabled Wi-Fi module.
Dependents: wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more
sdk/mbed/Gpio.cpp@1:6ec9998427ad, 2014-08-11 (annotated)
- Committer:
- dan_ackme
- Date:
- Mon Aug 11 03:29:30 2014 -0700
- Revision:
- 1:6ec9998427ad
- Parent:
- 0:ea85c4bb5e1f
- Child:
- 5:8d91a87ebba2
fixed compiler warnings
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dan_ackme | 0:ea85c4bb5e1f | 1 | /* |
dan_ackme | 0:ea85c4bb5e1f | 2 | * Copyright 2014, ACKme Networks |
dan_ackme | 0:ea85c4bb5e1f | 3 | * All Rights Reserved. |
dan_ackme | 0:ea85c4bb5e1f | 4 | * |
dan_ackme | 0:ea85c4bb5e1f | 5 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of ACKme Networks; |
dan_ackme | 0:ea85c4bb5e1f | 6 | * the contents of this file may not be disclosed to third parties, copied |
dan_ackme | 0:ea85c4bb5e1f | 7 | * or duplicated in any form, in whole or in part, without the prior |
dan_ackme | 0:ea85c4bb5e1f | 8 | * written permission of ACKme Networks. |
dan_ackme | 0:ea85c4bb5e1f | 9 | */ |
dan_ackme | 0:ea85c4bb5e1f | 10 | |
dan_ackme | 0:ea85c4bb5e1f | 11 | |
dan_ackme | 0:ea85c4bb5e1f | 12 | #include "Wiconnect.h" |
dan_ackme | 0:ea85c4bb5e1f | 13 | #include "internal/common.h" |
dan_ackme | 0:ea85c4bb5e1f | 14 | |
dan_ackme | 0:ea85c4bb5e1f | 15 | #include "platform.h" |
dan_ackme | 0:ea85c4bb5e1f | 16 | #include "gpio_api.h" |
dan_ackme | 0:ea85c4bb5e1f | 17 | |
dan_ackme | 0:ea85c4bb5e1f | 18 | |
dan_ackme | 0:ea85c4bb5e1f | 19 | |
dan_ackme | 0:ea85c4bb5e1f | 20 | /*************************************************************************************************/ |
dan_ackme | 0:ea85c4bb5e1f | 21 | Gpio::Gpio(Pin pin) : DigitalOut(pin) |
dan_ackme | 0:ea85c4bb5e1f | 22 | { |
dan_ackme | 0:ea85c4bb5e1f | 23 | } |
dan_ackme | 0:ea85c4bb5e1f | 24 | |
dan_ackme | 0:ea85c4bb5e1f | 25 | /*************************************************************************************************/ |
dan_ackme | 0:ea85c4bb5e1f | 26 | void Gpio::write(bool value) |
dan_ackme | 0:ea85c4bb5e1f | 27 | { |
dan_ackme | 0:ea85c4bb5e1f | 28 | gpio_write(&gpio, (int)value); |
dan_ackme | 0:ea85c4bb5e1f | 29 | } |
dan_ackme | 0:ea85c4bb5e1f | 30 | |
dan_ackme | 0:ea85c4bb5e1f | 31 | /*************************************************************************************************/ |
dan_ackme | 0:ea85c4bb5e1f | 32 | bool Gpio::read(void) |
dan_ackme | 0:ea85c4bb5e1f | 33 | { |
dan_ackme | 0:ea85c4bb5e1f | 34 | const int v = gpio_read(&gpio); |
dan_ackme | 0:ea85c4bb5e1f | 35 | return (bool)v; |
dan_ackme | 0:ea85c4bb5e1f | 36 | } |
dan_ackme | 0:ea85c4bb5e1f | 37 | |
dan_ackme | 0:ea85c4bb5e1f | 38 | /*************************************************************************************************/ |
dan_ackme | 0:ea85c4bb5e1f | 39 | Gpio& Gpio::operator= (bool value) |
dan_ackme | 0:ea85c4bb5e1f | 40 | { |
dan_ackme | 0:ea85c4bb5e1f | 41 | write(value); |
dan_ackme | 0:ea85c4bb5e1f | 42 | return *this; |
dan_ackme | 0:ea85c4bb5e1f | 43 | } |
dan_ackme | 0:ea85c4bb5e1f | 44 | |
dan_ackme | 0:ea85c4bb5e1f | 45 | /*************************************************************************************************/ |
dan_ackme | 0:ea85c4bb5e1f | 46 | Gpio& Gpio::operator= (const Gpio& other) |
dan_ackme | 0:ea85c4bb5e1f | 47 | { |
dan_ackme | 0:ea85c4bb5e1f | 48 | memcpy((void*)&gpio, (void*)&other.gpio, sizeof(gpio)); |
dan_ackme | 0:ea85c4bb5e1f | 49 | } |