Vybhav Kadaba
/
EV-PRO-MW1001_Development_updateFW
Bumped Mbed FW version to 01.20.0080
Diff: src/mbed/admw_gpio.cpp
- Revision:
- 32:52445bef314d
- Parent:
- 23:bb685f35b08b
--- a/src/mbed/admw_gpio.cpp Wed Oct 23 16:18:50 2019 +0000 +++ b/src/mbed/admw_gpio.cpp Fri Oct 25 05:08:19 2019 +0000 @@ -1,5 +1,5 @@ /****************************************************************************** -Copyright 2017 (c) Analog Devices, Inc. +Copyright 2019 (c) Analog Devices, Inc. All rights reserved. @@ -51,9 +51,11 @@ public: GpioContext( PinName resetPin, + PinName csPin, PinName alertErrorPin, PinName datareadyPin) : _reset(resetPin), + _cs(csPin), _alertError(alertErrorPin), _dataready(datareadyPin), _alertErrorIrq(alertErrorPin), @@ -77,7 +79,8 @@ private: DigitalOut _reset; - + DigitalOut _cs; + DigitalIn _alertError; DigitalIn _dataready; @@ -104,18 +107,22 @@ ADMW_GPIO_PIN ePinId, bool *pState) { - switch(ePinId) { - case ADMW_GPIO_PIN_ALERT_ERROR: - *pState = _alertError; - return ADMW_SUCCESS; - case ADMW_GPIO_PIN_DATAREADY: - *pState = _dataready; - return ADMW_SUCCESS; - case ADMW_GPIO_PIN_RESET: - *pState = _reset; - return ADMW_SUCCESS; - default: - return ADMW_INVALID_DEVICE_NUM; + switch(ePinId) + { + case ADMW_GPIO_PIN_ALERT_ERROR: + *pState = _alertError; + return ADMW_SUCCESS; + case ADMW_GPIO_PIN_DATAREADY: + *pState = _dataready; + return ADMW_SUCCESS; + case ADMW_GPIO_PIN_RESET: + *pState = _reset; + return ADMW_SUCCESS; + case ADMW_GPIO_PIN_CS: + *pState = _cs; + return ADMW_SUCCESS; + default: + return ADMW_INVALID_DEVICE_NUM; } } @@ -123,12 +130,16 @@ ADMW_GPIO_PIN ePinId, bool state) { - switch(ePinId) { - case ADMW_GPIO_PIN_RESET: - _reset = state; - break; - default: - return ADMW_INVALID_DEVICE_NUM; + switch(ePinId) + { + case ADMW_GPIO_PIN_RESET: + _reset = state; + break; + case ADMW_GPIO_PIN_CS: + _cs = state; + break; + default: + return ADMW_INVALID_DEVICE_NUM; } return ADMW_SUCCESS; @@ -139,19 +150,20 @@ ADMW_GPIO_CALLBACK callbackFn, void *pArg) { - switch(ePinId) { - case ADMW_GPIO_PIN_ALERT_ERROR: - _alertErrorIrqCallback = callbackFn; - _alertErrorIrqArg = pArg; - _alertErrorIrq.rise(callback(this, &GpioContext::_alertErrorIrqHandler)); - return ADMW_SUCCESS; - case ADMW_GPIO_PIN_DATAREADY: - _datareadyIrqCallback = callbackFn; - _datareadyIrqArg = pArg; - _datareadyIrq.rise(callback(this, &GpioContext::_datareadyIrqHandler)); - return ADMW_SUCCESS; - default: - return ADMW_INVALID_DEVICE_NUM; + switch(ePinId) + { + case ADMW_GPIO_PIN_ALERT_ERROR: + _alertErrorIrqCallback = callbackFn; + _alertErrorIrqArg = pArg; + _alertErrorIrq.rise(callback(this, &GpioContext::_alertErrorIrqHandler)); + return ADMW_SUCCESS; + case ADMW_GPIO_PIN_DATAREADY: + _datareadyIrqCallback = callbackFn; + _datareadyIrqArg = pArg; + _datareadyIrq.rise(callback(this, &GpioContext::_datareadyIrqHandler)); + return ADMW_SUCCESS; + default: + return ADMW_INVALID_DEVICE_NUM; } } @@ -182,6 +194,7 @@ ADMW_GPIO_HANDLE *phDevice) { GpioContext *pCtx = new GpioContext((PinName)pConfig->resetPin, + (PinName)pConfig->csPin, (PinName)pConfig->alertErrorPin, (PinName)pConfig->datareadyPin); if (!pCtx) {