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
Diff: sdk/mbed/Gpio.cpp
- Revision:
- 0:ea85c4bb5e1f
- Child:
- 1:6ec9998427ad
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdk/mbed/Gpio.cpp Mon Aug 11 09:58:24 2014 +0000 @@ -0,0 +1,50 @@ +/* + * Copyright 2014, ACKme Networks + * All Rights Reserved. + * + * This is UNPUBLISHED PROPRIETARY SOURCE CODE of ACKme Networks; + * the contents of this file may not be disclosed to third parties, copied + * or duplicated in any form, in whole or in part, without the prior + * written permission of ACKme Networks. + */ + + +#include "Wiconnect.h" +#include "internal/common.h" + +#include "platform.h" +#include "gpio_api.h" + + + +/*************************************************************************************************/ +Gpio::Gpio(Pin pin) : DigitalOut(pin) +{ +} + +/*************************************************************************************************/ +void Gpio::write(bool value) +{ + gpio_write(&gpio, (int)value); +} + +/*************************************************************************************************/ +bool Gpio::read(void) +{ + const int v = gpio_read(&gpio); + return (bool)v; +} + +/*************************************************************************************************/ +Gpio& Gpio::operator= (bool value) +{ + write(value); + return *this; +} + +/*************************************************************************************************/ +Gpio& Gpio::operator= (const Gpio& other) +{ + memcpy((void*)&gpio, (void*)&other.gpio, sizeof(gpio)); +} +