Skip to content

Commit

Permalink
API v026
Browse files Browse the repository at this point in the history
  • Loading branch information
Libelium committed Dec 19, 2016
1 parent 9deaa17 commit 0913773
Show file tree
Hide file tree
Showing 245 changed files with 43,682 additions and 7,286 deletions.
61 changes: 28 additions & 33 deletions libraries/BLE/WaspBLE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Version: 1.5
* Version: 3.0
* Design: David Gascón
* Implementation: Javier Siscart
*/
Expand Down Expand Up @@ -682,17 +682,8 @@ int8_t WaspBLE::ON(uint8_t UartMode)
if (UartMode >= 2) _uartBT = 1;
else _uartBT = UartMode;

// Power On the module with the corresponding pin
if(_uartBT == SOCKET0)
{
pinMode(BLE_PW_0,OUTPUT);
digitalWrite(BLE_PW_0,HIGH);
}
else if (_uartBT == SOCKET1)
{
pinMode(BLE_PW_1,OUTPUT);
digitalWrite(BLE_PW_1,HIGH);
}
// power on the socket
PWR.powerSocket(_uartBT, HIGH);

// delay to power up.
delay(100);
Expand Down Expand Up @@ -759,24 +750,18 @@ void WaspBLE::OFF()
closeSerial(_uartBT);

// update Waspmote Register
if(_uartBT == SOCKET0) WaspRegister &= ~(REG_SOCKET0);
if(_uartBT == SOCKET1) WaspRegister &= ~(REG_SOCKET1);
if (_uartBT == SOCKET0) WaspRegister &= ~(REG_SOCKET0);
if (_uartBT == SOCKET1) WaspRegister &= ~(REG_SOCKET1);

// to disable wake up pin.
sleep();

// Disable power pin.
if(!_uartBT)
{
pinMode(BLE_PW_0,OUTPUT);
digitalWrite(BLE_PW_0,LOW);
}
else
{
Utils.setMux(MUX_TO_LOW,MUX_TO_LOW);
pinMode(BLE_PW_1,OUTPUT);
digitalWrite(BLE_PW_1,LOW);
}
// unselect multiplexer
if (_uartBT == SOCKET0) Utils.setMuxUSB();
if (_uartBT == SOCKET1) Utils.muxOFF1();

// switch module OFF
PWR.powerSocket(_uartBT, LOW);
}


Expand Down Expand Up @@ -945,6 +930,19 @@ uint16_t WaspBLE::scanDevice(uint8_t* Mac, uint8_t maxTime, uint8_t TXPower)
strcpy_P(message, (char*)pgm_read_word(&(table_BLE[6])));
USB.printf(message, errorCode);
#endif

// Now it is necessary to stop scan.
if(endProcedure() != 0)
{
#if BLE_DEBUG > 0
// copy "Stop fail. err: %x\n" form flash
char message[25] ="";
strcpy_P(message, (char*)pgm_read_word(&(table_BLE[5])));
USB.printf(message, errorCode);
#endif
return errorCode;
}

return errorCode;
}

Expand Down Expand Up @@ -2641,17 +2639,14 @@ uint16_t WaspBLE::writeLocalAttribute(uint16_t handle, uint8_t * data, uint8_t l
uint16_t WaspBLE::writeLocalAttribute(uint16_t handle, uint8_t indicate, uint8_t * data, uint8_t length)
{
// maximum writtable data is 54 bytes length
uint8_t payload[54];

uint8_t flag = 0;

if (length > 54)
{
length = 54;
}

uint8_t payload[length+4];

uint8_t flag = 0;



payload[0] = (uint8_t)(handle & 0x00FF);
payload[1] = (uint8_t)((handle & 0xFF00) >> 8);
Expand Down Expand Up @@ -2811,7 +2806,7 @@ uint16_t WaspBLE::attributeWrite(uint8_t connection, uint16_t atthandle, char *
uint16_t WaspBLE::attributeWrite(uint8_t connection, uint16_t atthandle, uint8_t * data, uint8_t length)
{

uint8_t payload[length+4];
uint8_t payload[length];

payload[0] = connection;
payload[1] = (uint8_t)(atthandle & 0x00FF);
Expand Down
10 changes: 3 additions & 7 deletions libraries/BLE/WaspBLE.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*! \file WaspBLE.h
\briefLibrary for managing the Bluetooth low energy BLE112
Copyright (C) 2014 Libelium Comunicaciones Distribuidas S.L.
Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
http://www.libelium.com
This program is free software: you can redistribute it and/or modify
Expand All @@ -17,7 +17,7 @@
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Version: 1.2
Version: 3.0
Design: David Gascón
Implementation: Javier Siscart
Expand Down Expand Up @@ -50,11 +50,7 @@

// General constants
// Default baudrate
#define BT_BLUEGIGA_RATE 115200
// Bluetooth power pin when SOCKET1 is used. Same as DIGITAL 6
#define BLE_PW_1 6
// Bluetooth power pin when SOCKET0 is used. Same as Xbee_pw
#define BLE_PW_0 22
#define BT_BLUEGIGA_RATE 115200
// BLuetooth Sleep pin for SOCKET0. Same as XBEE_SLEEP
#define BLE_SLEEP 47
//max packet size allowed by the protocol
Expand Down
49 changes: 44 additions & 5 deletions libraries/BLE/keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ BLE_GAP_ADVERTISEMENT LITERAL1
BLE_GAP_SCAN_RESPONSE LITERAL1
BLE_DISABLE_BONDING LITERAL1
BLE_ENABLE_BONDING LITERAL1
BLE_DISABLE_MITM LITERAL1
BLE_DISABLE_MITM LITERAL1
BLE_ENABLE_MITM LITERAL1
BLE_INDICATE_ENABLED LITERAL1
BLE_INDICATE_DISABLED LITERAL1
BLE_EVENT_SYSTEM_BOOT LITERAL1
BLE_EVENT_SYSTEM_DEBUG LITERAL1
BLE_EVENT_SYSTEM_DEBUG LITERAL1
BLE_EVENT_SYSTEM_ENDPOINT_WATERMARK_RX LITERAL1
BLE_EVENT_SYSTEM_ENDPOINT_WATERMARK_TX LITERAL1
BLE_EVENT_SYSTEM_SCRIPT_FAILURE LITERAL1
BLE_EVENT_SYSTEM_SCRIPT_FAILURE LITERAL1
BLE_EVENT_SYSTEM_NO_LICENSE_KEY LITERAL1
BLE_EVENT_FLASH_PS_KEY LITERAL1
BLE_EVENT_ATTRIBUTES_VALUE LITERAL1
Expand All @@ -60,7 +60,7 @@ BLE_EVENT_ATTRIBUTES_STATUS LITERAL1
BLE_EVENT_CONNECTION_STATUS LITERAL1
BLE_EVENT_CONNECTION_VERSION_IND LITERAL1
BLE_EVENT_CONNECTION_FEATURE_IND LITERAL1
BLE_EVENT_CONNECTION_RAW_RX LITERAL1
BLE_EVENT_CONNECTION_RAW_RX LITERAL1
BLE_EVENT_CONNECTION_DISCONNECTED LITERAL1
BLE_EVENT_ATTCLIENT_INDICATED LITERAL1
BLE_EVENT_ATTCLIENT_PROCEDURE_COMPLETED LITERAL1
Expand Down Expand Up @@ -115,5 +115,44 @@ getOwnMac KEYWORD2
sendCommand KEYWORD2
readCommandAnswer KEYWORD2
WaspBLE KEYWORD2
mac KEYWORD2
rssi KEYWORD2
advData KEYWORD2
_baudrateBT KEYWORD2
_uartBT KEYWORD2
previousMAC KEYWORD2
GAP_discover_mode KEYWORD2
GAP_discoverable_mode KEYWORD2
GAP_connectable_mode KEYWORD2
scan_interval KEYWORD2
scan_window KEYWORD2
scan_policy KEYWORD2
adv_policy KEYWORD2
active KEYWORD2
scan_duplicate_filtering KEYWORD2
TXPower KEYWORD2
adv_interval_max KEYWORD2
adv_interval_min KEYWORD2
adv_channels KEYWORD2
set_scanrsp KEYWORD2
scanIndex KEYWORD2
parseScanEvent KEYWORD2
saveDevice KEYWORD2
parseName KEYWORD2
discoveredDevice KEYWORD2
my_bd_addr KEYWORD2
deviceRole KEYWORD2
scanNetworkCancel KEYWORD2
endProcedure KEYWORD2
getScanningParameters KEYWORD2
ADCRead KEYWORD2
sayHello KEYWORD2
ADCValue KEYWORD2
setBondableMode KEYWORD2
setKey KEYWORD2
deleteBonding KEYWORD2
getBonding KEYWORD2
setSecurityParameters KEYWORD2
parseEvent KEYWORD2

BLE KEYWORD3
BLE KEYWORD1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Library for managing the BME280 sensor
*
* Copyright (C) 2015 Libelium Comunicaciones Distribuidas S.L.
* Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
* http://www.libelium.com
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -17,7 +17,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Version: 1.3
* Version: 3.0
* Design: David Gascón
* Implementation: Alejandro Gállego
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*! \file BME280.h
\brief Library for managing the BME280 sensor
Copyright (C) 2015 Libelium Comunicaciones Distribuidas S.L.
Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
http://www.libelium.com
This program is free software: you can redistribute it and/or modify
Expand All @@ -17,7 +17,7 @@
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Version: 1.2
Version: 3.0
Design: David Gascón
Implementation: Alejandro Gállego
Expand Down
121 changes: 121 additions & 0 deletions libraries/BME280/keywords.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# BME280 #

BME280_I2C_ADDRESS1 LITERAL1
BME280_I2C_ADDRESS2 LITERAL1
BME280_I2C_ADDRESS LITERAL1
BME280_SLEEP_MODE LITERAL1
BME280_FORCED_MODE LITERAL1
BME280_NORMAL_MODE LITERAL1
BME280_SOFT_RESET_CODE LITERAL1
BME280_STANDBY_TIME_1_MS LITERAL1
BME280_STANDBY_TIME_63_MS LITERAL1
BME280_STANDBY_TIME_125_MS LITERAL1
BME280_STANDBY_TIME_250_MS LITERAL1
BME280_STANDBY_TIME_500_MS LITERAL1
BME280_STANDBY_TIME_1000_MS LITERAL1
BME280_STANDBY_TIME_10_MS LITERAL1
BME280_STANDBY_TIME_20_MS LITERAL1
BME280_OVERSAMP_SKIPPED LITERAL1
BME280_OVERSAMP_1X LITERAL1
BME280_OVERSAMP_2X LITERAL1
BME280_OVERSAMP_4X LITERAL1
BME280_OVERSAMP_8X LITERAL1
BME280_OVERSAMP_16X LITERAL1
BME280_FILTER_COEFF_OFF LITERAL1
BME280_FILTER_COEFF_2 LITERAL1
BME280_FILTER_COEFF_4 LITERAL1
BME280_FILTER_COEFF_8 LITERAL1
BME280_FILTER_COEFF_16 LITERAL1
BME280_DIG_T1_LSB_REG LITERAL1
BME280_DIG_T1_MSB_REG LITERAL1
BME280_DIG_T2_LSB_REG LITERAL1
BME280_DIG_T2_MSB_REG LITERAL1
BME280_DIG_T3_LSB_REG LITERAL1
BME280_DIG_T3_MSB_REG LITERAL1
BME280_DIG_P1_LSB_REG LITERAL1
BME280_DIG_P1_MSB_REG LITERAL1
BME280_DIG_P2_LSB_REG LITERAL1
BME280_DIG_P2_MSB_REG LITERAL1
BME280_DIG_P3_LSB_REG LITERAL1
BME280_DIG_P3_MSB_REG LITERAL1
BME280_DIG_P4_LSB_REG LITERAL1
BME280_DIG_P4_MSB_REG LITERAL1
BME280_DIG_P5_LSB_REG LITERAL1
BME280_DIG_P5_MSB_REG LITERAL1
BME280_DIG_P6_LSB_REG LITERAL1
BME280_DIG_P6_MSB_REG LITERAL1
BME280_DIG_P7_LSB_REG LITERAL1
BME280_DIG_P7_MSB_REG LITERAL1
BME280_DIG_P8_LSB_REG LITERAL1
BME280_DIG_P8_MSB_REG LITERAL1
BME280_DIG_P9_LSB_REG LITERAL1
BME280_DIG_P9_MSB_REG LITERAL1
BME280_DIG_H1_REG LITERAL1
BME280_DIG_H2_LSB_REG LITERAL1
BME280_DIG_H2_MSB_REG LITERAL1
BME280_DIG_H3_REG LITERAL1
BME280_DIG_H4_MSB_REG LITERAL1
BME280_DIG_H5_LSB_H4_LSB_REG LITERAL1
BME280_DIG_H5_MSB_REG LITERAL1
BME280_DIG_H6_REG LITERAL1
BME280_CHIP_ID_REG LITERAL1
BME280_RST_REG LITERAL1
BME280_STAT_REG LITERAL1
BME280_CTRL_MEAS_REG LITERAL1
BME280_CTRL_HUMIDITY_REG LITERAL1
BME280_CONFIG_REG LITERAL1
BME280_PRESSURE_MSB_REG LITERAL1
BME280_PRESSURE_LSB_REG LITERAL1
BME280_PRESSURE_XLSB_REG LITERAL1
BME280_TEMPERATURE_MSB_REG LITERAL1
BME280_TEMPERATURE_LSB_REG LITERAL1
BME280_TEMPERATURE_XLSB_REG LITERAL1
BME280_HUMIDITY_MSB_REG LITERAL1
BME280_HUMIDITY_LSB_REG LITERAL1
BME280_CHIP_ID_REG_CHIP_ID LITERAL1
BME280_STAT_REG_MEASURING__POS LITERAL1
BME280_STAT_REG_MEASURING__MSK LITERAL1
BME280_STAT_REG_MEASURING__LEN LITERAL1
BME280_STAT_REG_IM_UPDATE__POS LITERAL1
BME280_STAT_REG_IM_UPDATE__MSK LITERAL1
BME280_STAT_REG_IM_UPDATE__LEN LITERAL1
BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__POS LITERAL1
BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__MSK LITERAL1
BME280_CTRL_MEAS_REG_OVERSAMP_TEMPERATURE__LEN LITERAL1
BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__POS LITERAL1
BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__MSK LITERAL1
BME280_CTRL_MEAS_REG_OVERSAMP_PRESSURE__LEN LITERAL1
BME280_CTRL_MEAS_REG_POWER_MODE__POS LITERAL1
BME280_CTRL_MEAS_REG_POWER_MODE__MSK LITERAL1
BME280_CTRL_MEAS_REG_POWER_MODE__LEN LITERAL1
BME280_CTRL_HUMIDITY_REG_OVERSAM_HUMIDITY__POS LITERAL1
BME280_CTRL_HUMIDITY_REG_OVERSAM_HUMIDITY__MSK LITERAL1
BME280_CTRL_HUMIDITY_REG_OVERSAM_HUMIDITY__LEN LITERAL1
BME280_CONFIG_REG_TSB__POS LITERAL1
BME280_CONFIG_REG_TSB__MSK LITERAL1
BME280_CONFIG_REG_TSB__LEN LITERAL1
BME280_CONFIG_REG_FILTER__POS LITERAL1
BME280_CONFIG_REG_FILTER__MSK LITERAL1
BME280_CONFIG_REG_FILTER__LEN LITERAL1
BME280_CONFIG_REG_SPI3_ENABLE__POS LITERAL1
BME280_CONFIG_REG_SPI3_ENABLE__MSK LITERAL1
BME280_CONFIG_REG_SPI3_ENABLE__LEN LITERAL1
BME280_PRESSURE_XLSB_REG_DATA__POS LITERAL1
BME280_PRESSURE_XLSB_REG_DATA__MSK LITERAL1
BME280_PRESSURE_XLSB_REG_DATA__LEN LITERAL1
BME280_TEMPERATURE_XLSB_REG_DATA__POS LITERAL1
BME280_TEMPERATURE_XLSB_REG_DATA__MSK LITERAL1
BME280_TEMPERATURE_XLSB_REG_DATA__LEN LITERAL1

BME280 KEYWORD2
ON KEYWORD2
checkID KEYWORD2
readCalibration KEYWORD2
showCalibration KEYWORD2
getTemperature KEYWORD2
getPressure KEYWORD2
getHumidity KEYWORD2

BME KEYWORD1


Loading

0 comments on commit 0913773

Please sign in to comment.