├── README.md
├── libraries
├── BG96
│ ├── WaspBG96.cpp
│ ├── WaspBG96.h
│ ├── keywords.txt
│ └── utility
│ │ ├── BG96_constants.h
│ │ └── BG96_error_codes.h
├── BLE
│ ├── WaspBLE.cpp
│ ├── WaspBLE.h
│ └── keywords.txt
├── BME280
│ ├── BME280.cpp
│ ├── BME280.h
│ └── keywords.txt
├── BT_Pro
│ ├── WaspBT_Pro.cpp
│ ├── WaspBT_Pro.h
│ └── keywords.txt
├── CAN
│ ├── WaspCAN.cpp
│ ├── WaspCAN.h
│ └── keywords.txt
├── Frame
│ ├── AgrXtrFrameConstants.h
│ ├── WaspFrame.cpp
│ ├── WaspFrame.h
│ ├── WaspFrameConstantsv12.h
│ ├── WaspFrameConstantsv15.h
│ ├── WtrXtrFrameConstants.h
│ └── keywords.txt
├── GPRS_Pro
│ ├── WaspGPRS_Pro.cpp
│ ├── WaspGPRS_Pro.h
│ └── keywords.txt
├── GPRS_SIM908
│ ├── WaspGPRS_SIM908.cpp
│ ├── WaspGPRS_SIM908.h
│ └── keywords.txt
├── GPRS_SIM928A
│ ├── WaspGPRS_SIM928A.cpp
│ ├── WaspGPRS_SIM928A.h
│ └── keywords.txt
├── GPS
│ ├── WaspGPS.cpp
│ ├── WaspGPS.h
│ └── keywords.txt
├── LMP91000
│ ├── LMP91000.cpp
│ └── LMP91000.h
├── LoRaWAN
│ ├── WaspLoRaWAN.cpp
│ ├── WaspLoRaWAN.h
│ └── keywords.txt
├── MCP3421
│ ├── MCP3421.cpp
│ └── MCP3421.h
├── ModbusMaster
│ ├── ModbusMaster.cpp
│ ├── ModbusMaster.h
│ └── keywords.txt
├── ModbusSlave
│ ├── ModbusSlave.cpp
│ ├── ModbusSlave.h
│ └── keywords.txt
├── OPC_N2
│ ├── WaspOPC_N2.cpp
│ ├── WaspOPC_N2.h
│ └── keywords.txt
├── ParticleMatter
│ ├── WaspPM.cpp
│ ├── WaspPM.h
│ └── keywords.txt
├── RFID1356
│ ├── WaspRFID13.cpp
│ ├── WaspRFID13.h
│ └── keywords.txt
├── RS232
│ ├── Wasp232.cpp
│ ├── Wasp232.h
│ └── keywords.txt
├── RS485
│ ├── Wasp485.cpp
│ ├── Wasp485.h
│ └── keywords.txt
├── SDI12
│ ├── SDI12.cpp
│ ├── SDI12.h
│ └── SDI12.h.gch
├── SX1272
│ ├── WaspSX1272.cpp
│ ├── WaspSX1272.h
│ └── keywords.txt
├── SensorAgr_v30
│ ├── WaspSensorAgr_v30.cpp
│ ├── WaspSensorAgr_v30.h
│ └── keywords.txt
├── SensorAmbient
│ ├── WaspSensorAmbient.cpp
│ ├── WaspSensorAmbient.h
│ └── keywords.txt
├── SensorCities_PRO
│ ├── WaspSensorCities_PRO.cpp
│ ├── WaspSensorCities_PRO.h
│ └── keywords.txt
├── SensorEvent_v30
│ ├── WaspSensorEvent_v30.cpp
│ ├── WaspSensorEvent_v30.h
│ └── keywords.txt
├── SensorGas_PRO
│ ├── WaspSensorGas_Pro.cpp
│ ├── WaspSensorGas_Pro.h
│ └── keywords.txt
├── SensorGas_v30
│ ├── WaspSensorGas_v30.cpp
│ ├── WaspSensorGas_v30.h
│ └── keywords.txt
├── SensorPrototyping_v20
│ ├── WaspSensorPrototyping_v20.cpp
│ ├── WaspSensorPrototyping_v20.h
│ └── keywords.txt
├── SensorRadiation
│ ├── WaspSensorRadiation.cpp
│ ├── WaspSensorRadiation.h
│ └── keywords.txt
├── SensorSW
│ ├── TurbiditySensor.cpp
│ ├── TurbiditySensor.h
│ ├── WaspSensorSW.cpp
│ ├── WaspSensorSW.h
│ ├── keywords.txt
│ └── utility
│ │ ├── ADC.cpp
│ │ ├── ADC.h
│ │ ├── filter.cpp
│ │ └── filter.h
├── SensorXtr
│ ├── WaspSensorXtr.cpp
│ ├── WaspSensorXtr.h
│ ├── keywords.txt
│ └── utility
│ │ ├── ADC.cpp
│ │ ├── ADC.h
│ │ ├── AqualaboModbusSensors.cpp
│ │ ├── AqualaboModbusSensors.h
│ │ ├── MCP23008.cpp
│ │ └── MCP23008.h
├── Sigfox
│ ├── WaspSigfox.cpp
│ ├── WaspSigfox.h
│ └── keywords.txt
├── SmartWaterIons
│ ├── keywords.txt
│ ├── smartWaterIons.cpp
│ ├── smartWaterIons.h
│ └── utility
│ │ ├── ADC7705.cpp
│ │ └── ADC7705.h
├── TSL2561
│ ├── TSL2561.cpp
│ ├── TSL2561.h
│ └── keywords.txt
├── UltrasoundSensor
│ ├── UltrasoundSensor.cpp
│ ├── UltrasoundSensor.h
│ └── keywords.txt
├── WIFI_PRO
│ ├── WaspWIFI_PRO.cpp
│ ├── WaspWIFI_PRO.h
│ ├── keywords.txt
│ └── utility
│ │ ├── ati_error_codes.h
│ │ └── ati_generator.h
├── WIFI_PRO_V3
│ ├── WaspWIFI_PRO_V3.cpp
│ ├── WaspWIFI_PRO_V3.h
│ ├── keywords.txt
│ └── utility
│ │ ├── wifi_constants.h
│ │ └── wifi_error_codes.h
├── Wasp4G
│ ├── Wasp4G.cpp
│ ├── Wasp4G.h
│ ├── keywords.txt
│ └── utility
│ │ ├── Wasp4G_constants.h
│ │ └── Wasp4G_error_codes.h
├── WaspAES
│ ├── WaspAES.cpp
│ ├── WaspAES.h
│ ├── keywords.txt
│ └── utility
│ │ ├── aes.h
│ │ ├── aes128_dec.c
│ │ ├── aes128_dec.h
│ │ ├── aes128_enc.c
│ │ ├── aes128_enc.h
│ │ ├── aes192_dec.c
│ │ ├── aes192_dec.h
│ │ ├── aes192_enc.c
│ │ ├── aes192_enc.h
│ │ ├── aes256_dec.c
│ │ ├── aes256_dec.h
│ │ ├── aes256_enc.c
│ │ ├── aes256_enc.h
│ │ ├── aes_dec.c
│ │ ├── aes_dec.h
│ │ ├── aes_enc.c
│ │ ├── aes_enc.h
│ │ ├── aes_invsbox.c
│ │ ├── aes_invsbox.h
│ │ ├── aes_keyschedule.c
│ │ ├── aes_keyschedule.h
│ │ ├── aes_sbox.c
│ │ ├── aes_sbox.h
│ │ └── aes_types.h
├── WaspHash
│ ├── WaspHash.cpp
│ ├── WaspHash.h
│ ├── keywords.txt
│ └── utility
│ │ ├── md5.c
│ │ ├── md5.h
│ │ ├── md5_sbox.c
│ │ ├── md5_sbox.h
│ │ ├── sha1.c
│ │ ├── sha1.h
│ │ ├── sha224.c
│ │ ├── sha224.h
│ │ ├── sha256.c
│ │ ├── sha256.h
│ │ ├── sha2_large_common.c
│ │ ├── sha2_large_common.h
│ │ ├── sha2_small_common.c
│ │ ├── sha2_small_common.h
│ │ ├── sha384.c
│ │ ├── sha384.h
│ │ ├── sha512.c
│ │ └── sha512.h
├── WaspRSA
│ ├── WaspRSA.cpp
│ ├── WaspRSA.h
│ ├── keywords.txt
│ └── utility
│ │ ├── bignum.c
│ │ ├── bignum.h
│ │ └── bn_mul.h
├── WaspStackEEPROM
│ ├── WaspStackEEPROM.cpp
│ ├── WaspStackEEPROM.h
│ └── keywords.txt
├── XBee802
│ ├── WaspXBee802.cpp
│ ├── WaspXBee802.h
│ └── keywords.txt
├── XBee868
│ ├── WaspXBee868.cpp
│ ├── WaspXBee868.h
│ └── keywords.txt
├── XBee868LP
│ ├── WaspXBee868LP.cpp
│ ├── WaspXBee868LP.h
│ └── keywords.txt
├── XBee900
│ ├── WaspXBee900.cpp
│ ├── WaspXBee900.h
│ └── keywords.txt
├── XBee900HP
│ ├── WaspXBee900HP.cpp
│ ├── WaspXBee900HP.h
│ └── keywords.txt
├── XBeeDM
│ ├── WaspXBeeDM.cpp
│ ├── WaspXBeeDM.h
│ └── keywords.txt
├── XBeeZB
│ ├── WaspXBeeZB.cpp
│ ├── WaspXBeeZB.h
│ └── keywords.txt
├── _3G
│ ├── Wasp3G.cpp
│ ├── Wasp3G.h
│ └── keywords.txt
└── _4_20mA
│ ├── currentLoop.cpp
│ ├── currentLoop.h
│ └── keywords.txt
└── waspmote-api
├── MemoryFree.cpp
├── MemoryFree.h
├── Printable.h
├── WConstants.h
├── WInterrupts.c
├── WaspACC.cpp
├── WaspACC.h
├── WaspClasses.h
├── WaspConstants.h
├── WaspEEPROM.cpp
├── WaspEEPROM.h
├── WaspGPRS_Pro_core.cpp
├── WaspGPRS_Pro_core.h
├── WaspI2C.cpp
├── WaspI2C.h
├── WaspOneWire.cpp
├── WaspOneWire.h
├── WaspPWR.cpp
├── WaspPWR.h
├── WaspRTC.cpp
├── WaspRTC.h
├── WaspSD.cpp
├── WaspSD.h
├── WaspSPI.cpp
├── WaspSPI.h
├── WaspUART.cpp
├── WaspUART.h
├── WaspUSB.cpp
├── WaspUSB.h
├── WaspUtils.cpp
├── WaspUtils.h
├── WaspVariables.h
├── WaspXBeeCore.cpp
├── WaspXBeeCore.h
├── Waspmote.h
├── binary.h
├── eeprom_utilities
├── aes132_comm.c
├── aes132_comm.h
└── aes132_i2c.h
├── main.cpp
├── pins_waspmote.c
├── pins_waspmote.h
├── sd_utilities
├── Sd2Card.cpp
├── Sd2Card.h
├── SdBaseFile.cpp
├── SdBaseFile.h
├── SdFat.cpp
├── SdFat.h
├── SdFatConfig.h
├── SdFatStructs.h
├── SdFile.cpp
├── SdFile.h
├── SdInfo.h
├── SdStream.cpp
├── SdStream.h
├── SdVolume.cpp
├── SdVolume.h
├── bufstream.h
├── ios.h
├── iostream.h
├── istream.cpp
├── istream.h
├── ostream.cpp
└── ostream.h
├── twi
├── status_codes.h
├── twi_megarf.c
└── twi_megarf.h
├── wiring.c
├── wiring.h
├── wiring_analog.c
├── wiring_digital.c
├── wiring_private.h
├── wiring_pulse.c
├── wiring_serial.c
└── wiring_shift.c
/README.md:
--------------------------------------------------------------------------------
1 | ### Waspmote API Repository
2 | Download the last version of the Community code of the open source sensor platform Waspmote.
3 |
4 | **Warning**: this branch of code is pending of approval and is meant to be used just for developers who want to share their modifications of the Waspmote API with community. The last version of the official (tested and stable) branch can be downloaded at:
5 |
6 | * https://github.com/Libelium/waspmoteapi
7 | * http://www.libelium.com/development/waspmote
8 |
9 |
--------------------------------------------------------------------------------
/libraries/BT_Pro/keywords.txt:
--------------------------------------------------------------------------------
1 | # BT_Pro keywords #
2 |
3 | ENABLE_DATE_AND_TIME LITERAL1
4 | ENABLE_FRIENDLY_NAME LITERAL1
5 | BT_BLUEGIGA_RATE LITERAL1
6 | DEFAULT_MAX_INQUIRY_RESULTS LITERAL1
7 | RX_BUFFER LITERAL1
8 | BLOCK_SIZE LITERAL1
9 | BLOCK_MAC_SIZE LITERAL1
10 | COMMAND_SIZE LITERAL1
11 | BT_PRO_PW_1 LITERAL1
12 | BT_PRO_PW_0 LITERAL1
13 | BT_NODE_ID_ADDR LITERAL1
14 | ERRORSD1 LITERAL1
15 | ERRORSD2 LITERAL1
16 | ERRORSD3 LITERAL1
17 | INQFILE LITERAL1
18 | TX_POWER_0 LITERAL1
19 | TX_POWER_1 LITERAL1
20 | TX_POWER_2 LITERAL1
21 | TX_POWER_3 LITERAL1
22 | TX_POWER_4 LITERAL1
23 | TX_POWER_5 LITERAL1
24 | TX_POWER_6 LITERAL1
25 | TX_POWER_DEFAULT_WT12 LITERAL1
26 | TX_POWER_MAX_WT12 LITERAL1
27 |
28 | WaspBT_Pro KEYWORD2
29 | numLinesBefore KEYWORD2
30 | numLinesAfter KEYWORD2
31 | numberOfDevices KEYWORD2
32 | commandMode KEYWORD2
33 | activeConnections KEYWORD2
34 | linkRSSI KEYWORD2
35 | friendlyName KEYWORD2
36 | ON KEYWORD2
37 | OFF KEYWORD2
38 | sleep KEYWORD2
39 | wakeUp KEYWORD2
40 | reset KEYWORD2
41 | getNodeID KEYWORD2
42 | setNodeID KEYWORD2
43 | getOwnMac KEYWORD2
44 | getOwnName KEYWORD2
45 | setOwnName KEYWORD2
46 | getTemp KEYWORD2
47 | scanNetwork KEYWORD2
48 | scanNetworkName KEYWORD2
49 | scanNetworkLimited KEYWORD2
50 | scanDevice KEYWORD2
51 | printInquiry KEYWORD2
52 | createConnection KEYWORD2
53 | removeConnection KEYWORD2
54 | sendData KEYWORD2
55 | enterCommandMode KEYWORD2
56 | returnToDataMode KEYWORD2
57 | checkActiveConnections KEYWORD2
58 | getRSSI KEYWORD2
59 | pair KEYWORD2
60 | removePairedDevices KEYWORD2
61 | isPaired KEYWORD2
62 | txPower KEYWORD2
63 | mac_address KEYWORD2
64 | CoD KEYWORD2
65 | devClass KEYWORD2
66 | commandAnswer KEYWORD2
67 | theCommand KEYWORD2
68 | mem_addr KEYWORD2
69 | identifier KEYWORD2
70 | lookForAnswer KEYWORD2
71 | changeInquiryPower KEYWORD2
72 | parseNames KEYWORD2
73 | parseBlock KEYWORD2
74 | waitInquiryAnswer KEYWORD2
75 | getSetDateID KEYWORD2
76 | waitScanDeviceAnswer KEYWORD2
77 | setInquiryTime KEYWORD2
78 | eraseSDFiles KEYWORD2
79 | createSDFiles KEYWORD2
80 | printBuffer KEYWORD2
81 | printBuffer2 KEYWORD2
82 |
83 | BT_Pro KEYWORD1
84 |
--------------------------------------------------------------------------------
/libraries/GPRS_Pro/WaspGPRS_Pro.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
3 | * http://www.libelium.com
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 2.1 of the License, or
8 | * (at your option) any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | *
18 | * Version: 3.0
19 | * Design: David Gascón
20 | * Implementation: Alejandro Gállego
21 | */
22 |
23 |
24 | #ifndef __WPROGRAM_H__
25 | #include "WaspClasses.h"
26 | #endif
27 |
28 | #include "WaspGPRS_Pro.h"
29 |
30 |
31 | // Preinstantiate Objects //////////////////////////////////////////////////////
32 |
33 | WaspGPRS_Pro GPRS_Pro = WaspGPRS_Pro();
34 |
--------------------------------------------------------------------------------
/libraries/GPRS_Pro/WaspGPRS_Pro.h:
--------------------------------------------------------------------------------
1 | /*! \file WaspGPRS_Pro.h
2 | \brief Library for managing the SIM900 module
3 |
4 | Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
5 | http://www.libelium.com
6 |
7 | This program is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU Lesser General Public License as published by
9 | the Free Software Foundation, either version 2.1 of the License, or
10 | (at your option) any later version.
11 |
12 | This program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU Lesser General Public License for more details.
16 |
17 | You should have received a copy of the GNU Lesser General Public License
18 | along with this program. If not, see .
19 |
20 | Version: 3.0
21 | Design: David Gascón
22 | Implementation: Alejandro Gállego
23 |
24 | */
25 |
26 | /*! \def WaspGPRS_Pro_h
27 | \brief The library flag
28 |
29 | */
30 | #ifndef WaspGPRS_Pro_h
31 | #define WaspGPRS_Pro_h
32 |
33 | /******************************************************************************
34 | * Includes
35 | ******************************************************************************/
36 |
37 | #include
38 | #include
39 |
40 |
41 | /******************************************************************************
42 | * Class
43 | ******************************************************************************/
44 |
45 | //! WaspGPRS_Pro Class
46 | /*!
47 | WaspGPRS Class defines all the variables and functions used to manage GPRS module
48 | */
49 | class WaspGPRS_Pro : public WaspGPRS_Pro_core
50 | {
51 |
52 | public:
53 |
54 | WaspGPRS_Pro(){};
55 |
56 | };
57 |
58 | extern WaspGPRS_Pro GPRS_Pro;
59 |
60 | #endif
61 |
--------------------------------------------------------------------------------
/libraries/GPRS_Pro/keywords.txt:
--------------------------------------------------------------------------------
1 | GPRS_Pro KEYWORD1
2 | WaspGPRS_Pro KEYWORD2
3 |
--------------------------------------------------------------------------------
/libraries/GPRS_SIM928A/WaspGPRS_SIM928A.h:
--------------------------------------------------------------------------------
1 | /*! \file WaspGPRS_SIM928A.h
2 | \brief Library for managing the SIM928A module
3 |
4 | Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
5 | http://www.libelium.com
6 |
7 | This program is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU Lesser General Public License as published by
9 | the Free Software Foundation, either version 2.1 of the License, or
10 | (at your option) any later version.
11 |
12 | This program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU Lesser General Public License for more details.
16 |
17 | You should have received a copy of the GNU Lesser General Public License
18 | along with this program. If not, see .
19 |
20 | Version: 3.0
21 | Design: David Gascón
22 | Implementation: Alejandro Gállego
23 |
24 | */
25 |
26 | /*! \def WaspGPRS_SIM928A_h
27 | \brief The library flag
28 |
29 | */
30 | #ifndef WaspGPRS_SIM928A_h
31 | #define WaspGPRS_SIM928A_h
32 |
33 | /******************************************************************************
34 | * Includes
35 | ******************************************************************************/
36 |
37 | #include
38 | #include
39 |
40 | /******************************************************************************
41 | * Class
42 | ******************************************************************************/
43 |
44 | //! WaspGPRS_SIM928A Class
45 | /*!
46 | WaspGPRS_SIM928A Class defines all the variables and functions used to manage SIM928A module
47 | */
48 | class WaspGPRS_SIM928A : public WaspGPRS_Pro_core
49 | {
50 | private:
51 |
52 | public:
53 |
54 | float longitude;
55 | float latitude;
56 |
57 | float altitude;
58 | char UTC_time[11];
59 | char date[9];
60 | int8_t sats_in_view;
61 | int8_t sats_in_use;
62 | float speedOG;
63 | float courseOG;
64 |
65 | float HDOP;
66 | float PDOP;
67 | float VDOP;
68 |
69 | int GPS_status;
70 | int fix_status;
71 | int SNR;
72 | int mode; //A=Autonomous, D=DGPS, E=DR, N = Output Data Not Valid R = Coarse Position
73 |
74 |
75 | WaspGPRS_SIM928A();
76 |
77 |
78 | //! This function switches on the GPS engine
79 | /*!
80 | \return 1 if success
81 | 0 if error
82 | */
83 | int8_t GPS_ON();
84 |
85 | //! This function switches off the GPS engine
86 | /*!
87 | \return 1 if success
88 | 0 if error
89 | */
90 | int8_t GPS_OFF();
91 |
92 | //! This function reads the data from satellites
93 | /*!
94 | \param bool parse: '0' raw string in buffer_GPRS and '1' for GPS data parsed and stored in variables
95 | \return 1 if success
96 | -1 if timeout
97 | -2 if error
98 | */
99 | int8_t getGPSData(bool parse);
100 |
101 | //! This function checks if the GPS position is fixed or not
102 | /*!
103 | \param char* buffer: string pointer to store the information data
104 | \return '0' if timeout
105 | '1' if GPS status is fixed
106 | '2' if GPS status is not fixed
107 | */
108 | int8_t checkGPS();
109 |
110 |
111 | //! This function checks if the position is fixed until time out
112 | /*!
113 | \return 0 if not connected
114 | 1 if connected
115 | */
116 | uint8_t waitForGPSSignal();
117 |
118 | //! This function checks if the position is fixed until time out
119 | /*!
120 | \param long timeout: max time to wait in seconds
121 | \return 0 if not connected
122 | 1 if connected
123 | */
124 | uint8_t waitForGPSSignal(long timeout);
125 |
126 | //! This function sets time and date from the GPS to the RTC.
127 | //! GPS has to be initialized first and got the time/date
128 | /*!
129 | \return 1 if success
130 | 0 otherwise
131 | */
132 | bool setRTCTimeFromGPS();
133 |
134 | };
135 |
136 | extern WaspGPRS_SIM928A GPRS_SIM928A;
137 |
138 | #endif
139 |
--------------------------------------------------------------------------------
/libraries/GPRS_SIM928A/keywords.txt:
--------------------------------------------------------------------------------
1 | # GPRS_SIM928A keywords #
2 |
3 | GPRS_SIM928A KEYWORD1
4 |
5 | longitude KEYWORD2
6 | latitude KEYWORD2
7 | altitude KEYWORD2
8 | UTC_time KEYWORD2
9 | sats_in_view KEYWORD2
10 | sats_in_use KEYWORD2
11 | speedOG KEYWORD2
12 | courseOG KEYWORD2
13 | HDOP KEYWORD2
14 | PDOP KEYWORD2
15 | VDOP KEYWORD2
16 | GPS_status KEYWORD2
17 | fix_status KEYWORD2
18 | SNR KEYWORD2
19 | mode KEYWORD2
20 | GPS_ON KEYWORD2
21 | GPS_OFF KEYWORD2
22 | getGPSData KEYWORD2
23 | checkGPS KEYWORD2
24 | waitForGPSSignal KEYWORD2
25 | waitForGPSSignal KEYWORD2
26 | setRTCTimeFromGPS KEYWORD2
27 |
28 | # GRPS_pro_core #
29 |
30 | GSM_FUSE LITERAL1
31 | HTTP_FUSE LITERAL1
32 | FTP_FUSE LITERAL1
33 | IP_FUSE LITERAL1
34 | OTA_FUSE LITERAL1
35 | GPRS_debug_mode LITERAL1
36 | BUFFER_SIZE LITERAL1
37 | BUFFER_UART LITERAL1
38 | AT_GPRS_APN LITERAL1
39 | AT_GPRS_LOGIN LITERAL1
40 | AT_GPRS_PASSW LITERAL1
41 | AT_COMMAND LITERAL1
42 | OK_RESPONSE LITERAL1
43 | AT_GPRS_DNS1 LITERAL1
44 | AT_GPRS_DNS2 LITERAL1
45 | ERROR_CME LITERAL1
46 | ERROR_CMS LITERAL1
47 | ERROR LITERAL1
48 | GPRS_PRO_ON LITERAL1
49 | GPRS_PRO_FULL LITERAL1
50 | GPRS_PRO_RF_OFF LITERAL1
51 | GPRS_PRO_MIN LITERAL1
52 | GPRS_PRO_SLEEP LITERAL1
53 | GPRS_PRO_POWER_OFF LITERAL1
54 | ENABLE LITERAL1
55 | DISABLE LITERAL1
56 | NORMAL_MODE LITERAL1
57 | SILENT_MODE LITERAL1
58 | LEVEL_OFF LITERAL1
59 | LEVEL_LOW LITERAL1
60 | LEVEL_MEDIUM LITERAL1
61 | LEVEL_HIGH LITERAL1
62 | LEVEL_CRESCENDO LITERAL1
63 | DEFAULT_CLIR LITERAL1
64 | SUPPRESS_CLIR LITERAL1
65 | INVOKE_CLIR LITERAL1
66 | GPRS_PRO_RATE LITERAL1
67 | DELAY_ON_SEND LITERAL1
68 | DEFAULT_TIMEOUT LITERAL1
69 | SEND_ONCE LITERAL1
70 | PORT_USED LITERAL1
71 | GET LITERAL1
72 | POST LITERAL1
73 | HEAD LITERAL1
74 | SINGLE_CONNECTION LITERAL1
75 | MULTI_CONNECTION LITERAL1
76 | UDP_CLIENT LITERAL1
77 | TCP_CLIENT LITERAL1
78 | TCP_SERVER LITERAL1
79 | UDP_EXTENDED LITERAL1
80 | NON_TRANSPARENT LITERAL1
81 | TRANSPARENT LITERAL1
82 | GPRS_DATA_LENGTH LITERAL1
83 | GPRS_DATA_LENGTH_U LITERAL1
84 | GPRS_MAX_DATA LITERAL1
85 | FRAME_DISABLED LITERAL1
86 | FRAME_ENABLED LITERAL1
87 |
88 | tlfIN KEYWORD2
89 | _baudRate KEYWORD2
90 | _pwrMode KEYWORD2
91 | _socket KEYWORD2
92 | socket_ID KEYWORD2
93 | data_read KEYWORD2
94 | cellID KEYWORD2
95 | RSSI KEYWORD2
96 | sms_index KEYWORD2
97 | IP_dir KEYWORD2
98 | IP_app_mode KEYWORD2
99 | CME_CMS_code KEYWORD2
100 | FTP_error_code KEYWORD2
101 | connected KEYWORD2
102 | buffer_GPRS KEYWORD2
103 | buffer_temporal KEYWORD2
104 | WaspGPRS_Pro_core KEYWORD2
105 | ON KEYWORD2
106 | OFF KEYWORD2
107 | begin KEYWORD2
108 | close KEYWORD2
109 | setMode KEYWORD2
110 | getMode KEYWORD2
111 | setTime KEYWORD2
112 | check KEYWORD2
113 | setPIN KEYWORD2
114 | changePIN KEYWORD2
115 | getIMSI KEYWORD2
116 | getIMEI KEYWORD2
117 | makeCall KEYWORD2
118 | makeLostCall KEYWORD2
119 | setInfoIncomingCall KEYWORD2
120 | readCall KEYWORD2
121 | hangUp KEYWORD2
122 | setMonitorVolume KEYWORD2
123 | setMonitorMode KEYWORD2
124 | setCLIPresentation KEYWORD2
125 | setCLIRestriction KEYWORD2
126 | getPhoneActStatus KEYWORD2
127 | setLoudspeakerLevel KEYWORD2
128 | setCallAlert KEYWORD2
129 | setMute KEYWORD2
130 | setTextModeSMS KEYWORD2
131 | sendSMS KEYWORD2
132 | setInfoIncomingSMS KEYWORD2
133 | incomingSMS KEYWORD2
134 | readSMS KEYWORD2
135 | getTotalSMS KEYWORD2
136 | deleteSMS KEYWORD2
137 | manageIncomingData KEYWORD2
138 | switchtoDataMode KEYWORD2
139 | switchtoCommandMode KEYWORD2
140 | sendCommand KEYWORD2
141 | configureGPRS_HTTP_FTP KEYWORD2
142 | uploadFile KEYWORD2
143 | downloadFile KEYWORD2
144 | readURL KEYWORD2
145 | isConnected KEYWORD2
146 | getcurrentOperator KEYWORD2
147 | getAvailableOperators KEYWORD2
148 | setPreferredOperator KEYWORD2
149 | getCellInfo KEYWORD2
150 | getWorkingBand KEYWORD2
151 | configureGPRS_TCP_UDP KEYWORD2
152 | setLocalPort KEYWORD2
153 | saveGPRS_TCP_UDPconfiguration KEYWORD2
154 | createSocket KEYWORD2
155 | sendData KEYWORD2
156 | readIPData KEYWORD2
157 | closeSocket KEYWORD2
158 | QuickcloseSocket KEYWORD2
159 | getIPfromDNS KEYWORD2
160 | IPHeader KEYWORD2
161 | SetAutoSendingTimer KEYWORD2
162 | ShowRemoteIP KEYWORD2
163 | ShowProtocolHeader KEYWORD2
164 | DiscardInputATData KEYWORD2
165 | SetDataManually KEYWORD2
166 | GetDataManually KEYWORD2
167 | setDNS KEYWORD2
168 | setDefault KEYWORD2
169 | whoamI KEYWORD2
170 | firmware_version KEYWORD2
171 | set_APN KEYWORD2
172 | show_APN KEYWORD2
173 | requestOTA KEYWORD2
174 |
--------------------------------------------------------------------------------
/libraries/GPS/keywords.txt:
--------------------------------------------------------------------------------
1 | # GPS keywords #
2 |
3 | GPS KEYWORD1
4 |
5 | OSP_MODE LITERAL1
6 | NMEA_MODE LITERAL1
7 | UNKNOWN_MODE LITERAL1
8 | GPS_ON LITERAL1
9 | GPS_OFF LITERAL1
10 | GPS_SIGNAL_TIMEOUT LITERAL1
11 | GPS_BUFFER_SIZE LITERAL1
12 | MAX_SIZE LITERAL1
13 | FILE_EPHEMERIS LITERAL1
14 |
15 | WaspGPS KEYWORD2
16 | timeGPS KEYWORD2
17 | dateGPS KEYWORD2
18 | clkOffset KEYWORD2
19 | timeOfWeek KEYWORD2
20 | weekNo KEYWORD2
21 | channel KEYWORD2
22 | resetCfg KEYWORD2
23 | coordinateLat KEYWORD2
24 | coordinateLon KEYWORD2
25 | coordinateAl KEYWORD2
26 | latitude KEYWORD2
27 | NS_indicator KEYWORD2
28 | longitude KEYWORD2
29 | EW_indicator KEYWORD2
30 | speed KEYWORD2
31 | altitude KEYWORD2
32 | course KEYWORD2
33 | RMCMode KEYWORD2
34 | signalStatus KEYWORD2
35 | state KEYWORD2
36 | satellites KEYWORD2
37 | accuracy KEYWORD2
38 | GSAMode1 KEYWORD2
39 | GSAMode2 KEYWORD2
40 | PDOPAccuracy KEYWORD2
41 | HDOPAccuracy KEYWORD2
42 | VDOPAccuracy KEYWORD2
43 | satellitesInView KEYWORD2
44 | ON KEYWORD2
45 | OFF KEYWORD2
46 | setMode KEYWORD2
47 | getMode KEYWORD2
48 | getCommMode KEYWORD2
49 | check KEYWORD2
50 | waitForSignal KEYWORD2
51 | getTime KEYWORD2
52 | getDate KEYWORD2
53 | getLatitude KEYWORD2
54 | convert2Degrees KEYWORD2
55 | getLongitude KEYWORD2
56 | getSpeed KEYWORD2
57 | getAltitude KEYWORD2
58 | getCourse KEYWORD2
59 | getPosition KEYWORD2
60 | setTimeFromGPS KEYWORD2
61 | saveEphems KEYWORD2
62 | loadEphems KEYWORD2
63 | showRawData KEYWORD2
64 | getFirmwareVersion KEYWORD2
65 |
--------------------------------------------------------------------------------
/libraries/MCP3421/MCP3421.h:
--------------------------------------------------------------------------------
1 | /*! \file MCP3421.h
2 | \brief Library for managing the MCP3421 ADC
3 |
4 | Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
5 | http://www.libelium.com
6 |
7 | This program is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU Lesser General Public License as published by
9 | the Free Software Foundation, either version 2.1 of the License, or
10 | (at your option) any later version.
11 |
12 | This program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU Lesser General Public License for more details.
16 |
17 | You should have received a copy of the GNU Lesser General Public License
18 | along with this program. If not, see .
19 |
20 | Version: 3.0
21 | Design: David Gascón
22 | Implementation: Alejandro Gállego
23 |
24 | */
25 |
26 | /*! \def MCP3421_h
27 | \brief The library flag
28 |
29 | */
30 | #ifndef MCP3421_h
31 | #define MCP3421_h
32 |
33 | /******************************************************************************
34 | * Includes
35 | ******************************************************************************/
36 |
37 | #include
38 |
39 |
40 | //! DEBUG MODE
41 | /*! 0: No debug mode enabled
42 | * 1: debug mode enabled for error output messages
43 | * 2: debug mode enabled for both error and ok messages
44 | */
45 | #define DEBUG_MCP3421 0
46 |
47 | #define PRINT_MCP3421(str) USB.print(F("[MCP3421] ")); USB.print(str);
48 | #define PRINTHEX_MCP3421(str, val) USB.print(F(str)); USB.printHex(val);
49 |
50 | #define MCP3421_I2C_READ_TIMEOUT 100
51 |
52 | // resolution value for ADC conversion
53 | #define MCP3421_RES_12_BIT 0
54 | #define MCP3421_RES_14_BIT 1
55 | #define MCP3421_RES_16_BIT 2
56 | #define MCP3421_RES_18_BIT 3
57 |
58 | #define MCP3421_LOW_RES 0
59 | #define MCP3421_MEDIUM_RES 1
60 | #define MCP3421_HIGH_RES 2
61 | #define MCP3421_ULTRA_HIGH_RES 3
62 |
63 | // gain setting for ADC
64 | #define MCP3421_GAIN_1 0
65 | #define MCP3421_GAIN_2 1
66 | #define MCP3421_GAIN_4 2
67 | #define MCP3421_GAIN_8 3
68 |
69 | // conversion
70 | #define MCP3421_RAW 0
71 | #define MCP3421_VOLTS 1
72 |
73 |
74 | #define I2C_ADDRESS_GASPRO_MCP3421_A0 0x68
75 | #define I2C_ADDRESS_GASPRO_MCP3421_A1 0x69
76 | #define I2C_ADDRESS_GASPRO_MCP3421_A2 0x6A
77 |
78 | /******************************************************************************
79 | * Class
80 | ******************************************************************************/
81 |
82 | //! MCP3421 Class
83 | /*!
84 | MCP3421 Class defines all the variables and functions used to manage ADC module
85 | */
86 | class MCP3421
87 | {
88 | private:
89 |
90 | public:
91 |
92 | MCP3421();
93 |
94 | /*!
95 | \param uint8_t resolution: resolution value for ADC conversion
96 | MCP3421_RES_12_BIT or MCP3421_LOW_RES
97 | MCP3421_RES_14_BIT or MCP3421_MEDIUM_RES
98 | MCP3421_RES_16_BIT or MCP3421_HIGH_RES
99 | MCP3421_RES_18_BIT or MCP3421_ULTRA_HIGH_RES
100 | \param uint8_t gain: gain setting for ADC
101 | MCP3421_GAIN_1
102 | MCP3421_GAIN_2
103 | MCP3421_GAIN_4
104 | MCP3421_GAIN_8
105 | \param uint8_t conversion: returns the raw value or converted to millivolts
106 | MCP3421_RAW
107 | MCP3421_VOLTS
108 | \return measure in milliVolts or raw
109 | */
110 | float readADC(uint8_t resolution, uint8_t gain);
111 |
112 | /*!
113 | \param uint8_t ADC_addr: I2C address for the ADC
114 | \param uint8_t resolution: resolution value for ADC conversion
115 | MCP3421_RES_12_BIT or MCP3421_LOW_RES
116 | MCP3421_RES_14_BIT or MCP3421_MEDIUM_RES
117 | MCP3421_RES_16_BIT or MCP3421_HIGH_RES
118 | MCP3421_RES_18_BIT or MCP3421_ULTRA_HIGH_RES
119 | \param uint8_t gain: gain setting for ADC
120 | MCP3421_GAIN_1
121 | MCP3421_GAIN_2
122 | MCP3421_GAIN_4
123 | MCP3421_GAIN_8
124 | \param uint8_t conversion: returns the raw value or converted to millivolts
125 | MCP3421_RAW
126 | MCP3421_VOLTS
127 | \return measure in milliVolts or raw
128 | */
129 | float readADC(uint8_t adc_addr, uint8_t resolution, uint8_t gain);
130 |
131 | };
132 |
133 | extern MCP3421 MCP;
134 |
135 | #endif
136 |
--------------------------------------------------------------------------------
/libraries/ModbusMaster/keywords.txt:
--------------------------------------------------------------------------------
1 | # ModbusMaster keywords #
2 |
3 |
4 | ModbusMaster KEYWORD2
5 | begin KEYWORD2
6 |
7 | readCoils KEYWORD2
8 | readDiscreteInputs KEYWORD2
9 | readHoldingRegisters KEYWORD2
10 | readInputRegisters KEYWORD2
11 | writeSingleCoil KEYWORD2
12 | writeSingleRegister KEYWORD2
13 | writeMultipleCoils KEYWORD2
14 | writeMultipleCoils KEYWORD2
15 | writeMultipleRegisters KEYWORD2
16 | writeMultipleRegisters KEYWORD2
17 | maskWriteRegister KEYWORD2
18 | getResponseBuffer KEYWORD2
19 | clearResponseBuffer KEYWORD2
20 | readWriteMultipleRegisters KEYWORD2
21 | readWriteMultipleRegisters KEYWORD2
22 | readRegiters KEYWORD2
23 |
24 | RS232_COM LITERAL1
25 | RS485_COM LITERAL1
26 |
27 |
--------------------------------------------------------------------------------
/libraries/ModbusSlave/keywords.txt:
--------------------------------------------------------------------------------
1 | # ModbusSlave keywords #
2 |
3 | configure KEYWORD2
4 | update KEYWORD2
5 | ModbusSlave KEYWORD2
6 |
7 | RS232_COM LITERAL1
8 | RS485_COM LITERAL1
9 |
--------------------------------------------------------------------------------
/libraries/OPC_N2/keywords.txt:
--------------------------------------------------------------------------------
1 | # OPC_N2 keyword #
2 |
3 | DUST_SENSOR_CS LITERAL1
4 | DUST_SENSOR_POWER LITERAL1
5 | SET_DIGITAL_POT LITERAL1
6 | DIGITAL_POT_ON LITERAL1
7 | DIGITAL_POT_OFF LITERAL1
8 | DIGITAL_POT_SET_LASER_PWR LITERAL1
9 | DIGITAL_POT_SET_FAN_PWR LITERAL1
10 | READ_INFO_STRING LITERAL1
11 | READ_CONFIG_VAR LITERAL1
12 | WRITE_CONFIG_VAR LITERAL1
13 | READ_HISTOGRAM LITERAL1
14 | SAVE_CONFIG LITERAL1
15 | CHECK_STATUS LITERAL1
16 | CHECK_STATUS_READY LITERAL1
17 |
18 | _binBoundaryValues KEYWORD2
19 | _binParticleVolume KEYWORD2
20 | _binParticleDensity KEYWORD2
21 | _binSampleVolumeWeight KEYWORD2
22 | _gain KEYWORD2
23 | _sample KEYWORD2
24 | _laserDAC KEYWORD2
25 | _fanDAC KEYWORD2
26 | _bin KEYWORD2
27 | _temp KEYWORD2
28 | _pressure KEYWORD2
29 | _periodCount KEYWORD2
30 | _bin1_MToF KEYWORD2
31 | _bin3_MToF KEYWORD2
32 | _bin5_MToF KEYWORD2
33 | _bin7_MToF KEYWORD2
34 | _PM1 KEYWORD2
35 | _PM2_5 KEYWORD2
36 | _PM10 KEYWORD2
37 | WaspOPC_N2 KEYWORD2
38 | ON KEYWORD2
39 | OFF KEYWORD2
40 | getInfoString KEYWORD2
41 | setDigitalPot KEYWORD2
42 | getHistogramData KEYWORD2
43 | getConfigVar KEYWORD2
44 | getPM KEYWORD2
45 | OPC_N2 KEYWORD1
46 |
--------------------------------------------------------------------------------
/libraries/ParticleMatter/keywords.txt:
--------------------------------------------------------------------------------
1 | # PM keyword #
2 |
3 | DUST_SENSOR_CS LITERAL1
4 | DUST_SENSOR_POWER LITERAL1
5 | SET_DIGITAL_POT LITERAL1
6 | DIGITAL_POT_ON_FAN LITERAL1
7 | DIGITAL_POT_OFF_FAN LITERAL1
8 | DIGITAL_POT_ON_LASER LITERAL1
9 | DIGITAL_POT_OFF_LASER LITERAL1
10 | DIGITAL_POT_SET_LASER_PWR LITERAL1
11 | DIGITAL_POT_SET_FAN_PWR LITERAL1
12 | READ_INFO_STRING LITERAL1
13 | READ_CONFIG_VAR LITERAL1
14 | WRITE_CONFIG_VAR LITERAL1
15 | READ_HISTOGRAM LITERAL1
16 | SAVE_CONFIG LITERAL1
17 | CHECK_STATUS LITERAL1
18 | CHECK_STATUS_READY LITERAL1
19 | PM_SPI_MODE LITERAL1
20 | PM_UART_MODE LITERAL1
21 | READ_SERIAL_NUMBER LITERAL1
22 |
23 | _binBoundaryValues KEYWORD2
24 | _binParticleVolume KEYWORD2
25 | _binParticleDensity KEYWORD2
26 | _binSampleVolumeWeight KEYWORD2
27 | _gain KEYWORD2
28 | _sample KEYWORD2
29 | _laserDAC KEYWORD2
30 | _fanDAC KEYWORD2
31 | _bin KEYWORD2
32 | _binL KEYWORD2
33 | _binH KEYWORD2
34 | _temp KEYWORD2
35 | _tempN2 KEYWORD2
36 | _hum KEYWORD2
37 | _pressureN2 KEYWORDS2
38 | _periodCount KEYWORD2
39 | _bin1_MToF KEYWORD2
40 | _bin3_MToF KEYWORD2
41 | _bin5_MToF KEYWORD2
42 | _bin7_MToF KEYWORD2
43 | _PM1 KEYWORD2
44 | _PM2_5 KEYWORD2
45 | _PM10 KEYWORD2
46 | _opcModel KEYWORD2
47 | WaspPM KEYWORD2
48 | ON KEYWORD2
49 | OFF KEYWORD2
50 | getInfoString KEYWORD2
51 | setDigitalPot KEYWORD2
52 | getHistogramData KEYWORD2
53 | getConfigVar KEYWORD2
54 | getPM KEYWORD2
55 | readSerialNumber KEYWORD2
56 |
57 |
58 | OPC_N2 KEYWORD2
59 | OPC_N3 KEYWORD2
60 |
61 | PM KEYWORD1
62 |
--------------------------------------------------------------------------------
/libraries/RFID1356/WaspRFID13.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Libelium/waspmoteapi/02591a22909666d51409765f232efe206659ea01/libraries/RFID1356/WaspRFID13.cpp
--------------------------------------------------------------------------------
/libraries/RFID1356/WaspRFID13.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Libelium/waspmoteapi/02591a22909666d51409765f232efe206659ea01/libraries/RFID1356/WaspRFID13.h
--------------------------------------------------------------------------------
/libraries/RFID1356/keywords.txt:
--------------------------------------------------------------------------------
1 | # RFID13 keywords #
2 |
3 | RFID13 KEYWORD3 RFID13
4 | UIdentifier KEYWORD2
5 | init KEYWORD2
6 | searchUID KEYWORD2
7 | ATQ KEYWORD2
8 | KeyAccess KEYWORD2
9 | blockData KEYWORD2
10 | authenticate KEYWORD2
11 | getFirmware KEYWORD2
12 | write KEYWORD2
13 | read KEYWORD2
14 | readWithAuth KEYWORD2
15 | writeWithAuth KEYWORD2
16 | writeAndCheck KEYWORD2
17 | writeAndCheckWithAuth KEYWORD2
18 | powerDown KEYWORD2
19 | wakeUp KEYWORD2
20 | print KEYWORD2
21 | equalUIDs KEYWORD2
22 | searchUID KEYWORD2
23 | string2vector KEYWORD2
24 | vector2int KEYWORD2
25 | setKeys KEYWORD2
26 | WaspRFID13 KEYWORD1
27 | PREAMBLE KEYWORD1
28 | STARTCODE1 KEYWORD1
29 | STARTCODE2 KEYWORD1
30 | POSTAMBLE KEYWORD1
31 | HOSTTOPN532 KEYWORD1
32 | FIRMWAREVERSION KEYWORD1
33 | GETGENERALSTATUS KEYWORD1
34 | SAMCONFIGURATION KEYWORD1
35 | INLISTPASSIVETARGET KEYWORD1
36 | INDATAEXCHANGE KEYWORD1
37 | MIFARE_READ KEYWORD1
38 | MIFARE_WRITE KEYWORD1
39 | AUTH_WITH_KEYA KEYWORD1
40 | GETFIRMWAREVERSION KEYWORD1
41 | READREGISTER KEYWORD1
42 | WRITEREGISTER KEYWORD1
43 | READGPIO KEYWORD1
44 | WRITEGPIO KEYWORD1
45 | SETSERIALBAUDRATE KEYWORD1
46 | SETPARAMETERS KEYWORD1
47 | POWERDOWN KEYWORD1
48 | RFCONFIGURATION KEYWORD1
49 | RFREGULATIONTEST KEYWORD1
50 | INATR KEYWORD1
51 | INPSL KEYWORD1
52 | INCOMMUNICATETHRU KEYWORD1
53 | INDESELECT KEYWORD1
54 | INRELEASE KEYWORD1
55 | INSELECT KEYWORD1
56 | INAUTOPOLL KEYWORD1
57 | TGINITASTARGET KEYWORD1
58 | TGSETGENERALBYTES KEYWORD1
59 | PN532_WAKEUP KEYWORD1
60 | PN532_MIFARE_ISO14443A KEYWORD1
61 | MIFARE_CMD_AUTH_A KEYWORD1
62 | MIFARE_CMD_AUTH_B KEYWORD1
63 | MIFARE_CMD_READ KEYWORD1
64 | MIFARE_CMD_WRITE KEYWORD1
65 | MIFARE_CMD_TRANSFER KEYWORD1
66 | MIFARE_CMD_DECREMENT KEYWORD1
67 | MIFARE_CMD_INCREMENT KEYWORD1
68 | MIFARE_CMD_STORE KEYWORD1
69 | RFID_RATE
70 |
71 | _delay 1 KEYWORD2
72 | timeOut KEYWORD2
73 | keyOld KEYWORD2
74 | keyA KEYWORD2
75 | keyB KEYWORD2
76 | config KEYWORD2
77 | add KEYWORD2
78 | dataRX KEYWORD2
79 | dataTX KEYWORD2
80 | keyAccess KEYWORD2
81 | _uart KEYWORD2
82 | _UID KEYWORD2
83 | _ATQ KEYWORD2
84 | configureSAM KEYWORD2
85 | sendTX KEYWORD2
86 | getACK KEYWORD2
87 | waitResponse KEYWORD2
88 | getData KEYWORD2
89 | checkSum KEYWORD2
90 | lengthCheckSum KEYWORD2
91 |
92 |
--------------------------------------------------------------------------------
/libraries/RS232/keywords.txt:
--------------------------------------------------------------------------------
1 | # RS232 keywords #
2 |
3 | DISABLE LITERAL1
4 | ENABLE LITERAL1
5 | NONE LITERAL1
6 | EVEN LITERAL1
7 | ODD LITERAL1
8 | ONE_STOP_BIT LITERAL1
9 | TWO_STOP_BITS LITERAL1
10 |
11 | Wasp232 KEYWORD1
12 | ON KEYWORD2
13 | OFF KEYWORD2
14 | baudRateConfig KEYWORD2
15 | read KEYWORD2
16 | send KEYWORD2
17 | available KEYWORD2
18 | flush KEYWORD2
19 | parityBit KEYWORD2
20 | stopBitConfig KEYWORD2
21 |
22 | W232 KEYWORD1
23 |
--------------------------------------------------------------------------------
/libraries/RS485/Wasp485.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Libelium/waspmoteapi/02591a22909666d51409765f232efe206659ea01/libraries/RS485/Wasp485.cpp
--------------------------------------------------------------------------------
/libraries/RS485/Wasp485.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Libelium/waspmoteapi/02591a22909666d51409765f232efe206659ea01/libraries/RS485/Wasp485.h
--------------------------------------------------------------------------------
/libraries/RS485/keywords.txt:
--------------------------------------------------------------------------------
1 | # RS485 keywords #
2 |
3 | ENABLE LITERAL1
4 | DISABLE LITERAL1
5 | ONE_STOP_BIT LITERAL1
6 | TWO_STOP_BITS LITERAL1
7 |
8 | Wasp485 KEYWORD1
9 | ON KEYWORD2
10 | OFF KEYWORD2
11 | baudRateConfig KEYWORD2
12 | read KEYWORD2
13 | send KEYWORD2
14 | available KEYWORD2
15 | flush KEYWORD2
16 | parityBit KEYWORD2
17 | stopBitConfig KEYWORD2
18 | W485 KEYWORD3
19 |
--------------------------------------------------------------------------------
/libraries/SDI12/SDI12.h.gch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Libelium/waspmoteapi/02591a22909666d51409765f232efe206659ea01/libraries/SDI12/SDI12.h.gch
--------------------------------------------------------------------------------
/libraries/SensorAgr_v30/keywords.txt:
--------------------------------------------------------------------------------
1 | #Agr_v30Keywords#
2 |
3 | ON KEYWORD2
4 | OFF KEYWORD2
5 | getDistance KEYWORD2
6 | getLuxes KEYWORD2
7 | getPressure KEYWORD2
8 | getTemperature KEYWORD2
9 | getHumidity KEYWORD2
10 | sleepAgr KEYWORD2
11 |
12 | readDendrometer KEYWORD2
13 | readDS18b20 KEYWORD2
14 | getLeafWetness KEYWORD2
15 | readPT1000 KEYWORD2
16 | readRadiation KEYWORD2
17 | readWatermark KEYWORK2
18 |
19 | attachPluvioInt KEYWORD2
20 | detachPluvioInt KEYWORD2
21 | getVaneDirection KEYWORD2
22 | getVaneFiltered KEYWORD2
23 | readAnemometer KEYWORD2
24 | readPluviometer KEYWORD2
25 | readPluviometerCurrent KEYWORD2
26 | readPluviometerDay KEYWORD2
27 | readPluviometerHour KEYWORD2
28 | gustWind KEYWORD2
29 | WaspSensorAgr_v30 KEYWORD2
30 | storePulse KEYWORD2
31 | readVaneDirection KEYWORD2
32 | setReference KEYWORD2
33 | readGrowth KEYWORD2
34 |
35 | SENS_AGR_VANE_ENE LITERAL1
36 | SENS_AGR_VANE_NE LITERAL1
37 | SENS_AGR_VANE_NNE LITERAL1
38 | SENS_AGR_VANE_N LITERAL1
39 | SENS_AGR_VANE_NNW LITERAL1
40 | SENS_AGR_VANE_NW LITERAL1
41 | SENS_AGR_VANE_WNW LITERAL1
42 | SENS_AGR_VANE_W LITERAL1
43 | SENS_AGR_VANE_WSW LITERAL1
44 | SENS_AGR_VANE_SW LITERAL1
45 | SENS_AGR_VANE_SSW LITERAL1
46 | SENS_AGR_VANE_S LITERAL1
47 | SENS_AGR_VANE_SSE LITERAL1
48 | SENS_AGR_VANE_SE LITERAL1
49 | SENS_AGR_VANE_ESE LITERAL1
50 | OUTDOOR LITERAL1
51 | INDOOR LITERAL1
52 | SENS_SA_WATERMARK LITERAL1
53 | SENS_SA_PT1000 LITERAL1
54 | SENS_SA_DENDROMETER LITERAL1
55 | SENS_SA_LW LITERAL1
56 | SENS_SA_APG LITERAL1
57 | SENS_SA_DENDROMETER LITERAL1
58 | SENS_SA_LW LITERAL1
59 | SENS_SA_APG LITERAL1
60 | SENS_SA_WDV LITERAL1
61 | SENS_SA_ANE LITERAL1
62 | SENS_SA_PLV LITERAL1
63 | SENS_SA_DD LITERAL1
64 | SENS_SA_DF LITERAL1
65 | SENS_SA_DC3 LITERAL1
66 | SENS_SA_DC2 LITERAL1
67 |
68 | WaspSensorAgr_v30 KEYWORD2
69 | Agriculture KEYWORD1
70 | dendrometerClass KEYWORD2
71 | ds18b20Class KEYWORD2
72 | leafWetnessClass KEYWORD2
73 | pt1000Class KEYWORD2
74 | radiationClass KEYWORD2
75 | watermarkClass KEYWORD2
76 | weatherStationClass KEYWORD2
77 | _dendro KEYWORD2
78 | _reference KEYWORD2
79 |
--------------------------------------------------------------------------------
/libraries/SensorAmbient/keywords.txt:
--------------------------------------------------------------------------------
1 | # Ambient Keywords #
2 |
3 | SENS_AMBIENT_SENSIRION_PWR LITERAL1
4 | SENS_AMBIENT_SENSIRION_DATA LITERAL1
5 | SENS_AMBIENT_LDR_OUT LITERAL1
6 | SENS_AMBIENT_SENSIRION_CLK LITERAL1
7 | SENS_AMBIENT_LDR_PWR LITERAL1
8 | SENS_AMBIENT_SENSIRION_GND LITERAL1
9 | SENS_AMBIENT_LDR_GND LITERAL1
10 | SENS_AMBIENT_TEMPERATURE LITERAL1
11 | SENS_AMBIENT_HUMIDITY LITERAL1
12 | SENS_AMBIENT_LDR LITERAL1
13 | SENS_AMBIENT_LUX LITERAL1
14 | SENS_PREC_HIGH LITERAL1
15 | SENS_PREC_LOW LITERAL1
16 | _TSL2561_H_ LITERAL1
17 | _TSL2561_H_ LITERAL1
18 | TSL2561_VISIBLE LITERAL1
19 | TSL2561_INFRARED LITERAL1
20 | TSL2561_FULLSPECTRUM LITERAL1
21 | TSL2561_ADDR_FLOAT LITERAL1
22 | TSL2561_PACKAGE_T_FN_CL LITERAL1
23 | TSL2561_READBIT LITERAL1
24 | TSL2561_COMMAND_BIT LITERAL1
25 | TSL2561_CLEAR_BIT LITERAL1
26 | TSL2561_WORD_BIT LITERAL1
27 | TSL2561_BLOCK_BIT LITERAL1
28 | TSL2561_CONTROL_POWERON LITERAL1
29 | TSL2561_CONTROL_POWEROFF LITERAL1
30 | TSL2561_LUX_LUXSCALE LITERAL1
31 | TSL2561_LUX_RATIOSCALE LITERAL1
32 | TSL2561_LUX_CHSCALE LITERAL1
33 | TSL2561_LUX_CHSCALE_TINT0 LITERAL1
34 | TSL2561_LUX_CHSCALE_TINT LITERAL11
35 | TSL2561_LUX_K1T LITERAL1
36 | TSL2561_LUX_B1T LITERAL1
37 | TSL2561_LUX_M1T LITERAL1
38 | TSL2561_LUX_K2T LITERAL1
39 | TSL2561_LUX_B2T LITERAL1
40 | TSL2561_LUX_M2T LITERAL1
41 | TSL2561_LUX_K3T LITERAL1
42 | TSL2561_LUX_B3T LITERAL1
43 | TSL2561_LUX_M3T LITERAL1
44 | TSL2561_LUX_K4T LITERAL1
45 | TSL2561_LUX_B4T LITERAL1
46 | TSL2561_LUX_M4T LITERAL1
47 | TSL2561_LUX_K5T LITERAL1
48 | TSL2561_LUX_B5T LITERAL1
49 | TSL2561_LUX_M5T LITERAL1
50 | TSL2561_LUX_K6T LITERAL1
51 | TSL2561_LUX_B6T LITERAL1
52 | TSL2561_LUX_M6T LITERAL1
53 | TSL2561_LUX_K7T LITERAL1
54 | TSL2561_LUX_B7T LITERAL1
55 | TSL2561_LUX_M7T LITERAL1
56 | TSL2561_LUX_K8T LITERAL1
57 | TSL2561_LUX_B8T LITERAL1
58 | TSL2561_LUX_M8T LITERAL1
59 | TSL2561_REGISTER_CONTROL LITERAL1
60 | TSL2561_REGISTER_TIMING LITERAL1
61 | TSL2561_REGISTER_THRESHHOLDL_LOW LITERAL1
62 | TSL2561_REGISTER_THRESHHOLDL_HIGH LITERAL1
63 | TSL2561_REGISTER_THRESHHOLDH_LOW LITERAL1
64 | TSL2561_REGISTER_THRESHHOLDH_HIGH LITERAL1
65 | TSL2561_REGISTER_INTERRUPT LITERAL1
66 | TSL2561_REGISTER_CRC LITERAL1
67 | TSL2561_REGISTER_ID LITERAL1
68 | TSL2561_REGISTER_CHAN0_LOW LITERAL1
69 | TSL2561_REGISTER_CHAN0_HIGH LITERAL1
70 | TSL2561_REGISTER_CHAN1_LOW LITERAL1
71 | TSL2561_REGISTER_CHAN1_HIGH LITERAL1
72 | TSL2561_INTEGRATIONTIME_13MS LITERAL1
73 | TSL2561_INTEGRATIONTIME_101MS LITERAL1
74 | TSL2561_INTEGRATIONTIME_402MS LITERAL1
75 | TSL2561_GAIN_0X LITERAL1
76 | TSL2561_GAIN_16X LITERAL1
77 | TSL2561_LUX_CHSCALE_TINT1 LITERAL1
78 |
79 | WaspSensorAmbient KEYWORD2
80 | setSensorMode KEYWORD2
81 | readValue KEYWORD2
82 | readLUXbright KEYWORD2
83 | readLUXmedium KEYWORD2
84 | readLUXdim KEYWORD2
85 | readLUMINOSITYbright KEYWORD2
86 | readLUMINOSITYmedium KEYWORD2
87 | readLUMINOSITYdim KEYWORD2
88 | getTemperatureBME KEYWORD2
89 | getHumidityBME KEYWORD2
90 | getPressureBME KEYWORD2
91 |
92 | SensorAmbient KEYWORD1
93 |
--------------------------------------------------------------------------------
/libraries/SensorCities_PRO/keywords.txt:
--------------------------------------------------------------------------------
1 | # Cities PRO Keywords #
2 |
3 | SENS_CITIES_PRO_NOISE LITERAL1
4 | SENS_CITIES_PRO_POLI1 LITERAL1
5 | SENS_CITIES_PRO_GAS1 LITERAL1
6 | SENS_CITIES_PRO_DUST LITERAL1
7 | SENS_CITIES_PRO_POLI2 LITERAL1
8 | SENS_CITIES_PRO_GAS2 LITERAL1
9 |
10 | SENS_CITIES_PRO_PWR_3V3 LITERAL1
11 | SENS_CITIES_PRO_PWR_5V LITERAL1
12 | SENS_CITIES_PRO_PWR_BOTH LITERAL1
13 | SENS_CITIES_PRO_NO_PWR LITERAL1
14 |
15 | SCP_PWR_POLI_1 LITERAL1
16 | SCP_I2C_MAIN_EN LITERAL1
17 | SCP_CS_NOISE LITERAL1
18 | SCP_PWR_NOISE LITERAL1
19 | SCP_PWR_DUST LITERAL1
20 | SCP_CS_DUST LITERAL1
21 | SCP_PWR_GAS_2 LITERAL1
22 | SCP_I2C_GAS_2 LITERAL1
23 | SCP_PWR_POLI_2 LITERAL1
24 | SCP_PWR_GAS_1 LITERAL1
25 | SCP_I2C_GAS_1 LITERAL1
26 | SCP_POLI_1_ADC LITERAL1
27 | SCP_POLI_2_ADC LITERAL1
28 | SCP_NOISE_ADC LITERAL1
29 |
30 | FAST_MODE LITERAL1
31 | SLOW_MODE LITERAL1
32 |
33 |
34 | WaspSensorCities_PRO KEYWORD2
35 | ON KEYWORD2
36 | OFF KEYWORD2
37 | setBoardMode KEYWORD2
38 | setSensorMode KEYWORD2
39 | setThreshold KEYWORD2
40 | setAudioGain KEYWORD2
41 | readValue KEYWORD2
42 | showLUT KEYWORD2
43 | readNoise KEYWORD2
44 | getSPLA KEYWORD2
45 | SPLA KEYWORD2
46 | noiseSensor KEYWORD2
47 | bmeCitiesSensor KEYWORD2
48 | ultrasoundCitiesSensor KEYWORD2
49 | luxesCitiesSensor KEYWORD2
50 |
51 | SensorCitiesPRO KEYWORD1
52 | noise KEYWORD1
53 |
--------------------------------------------------------------------------------
/libraries/SensorEvent_v30/keywords.txt:
--------------------------------------------------------------------------------
1 | # Event_v30 keywords #
2 |
3 | Events KEYWORD1
4 |
5 | WaspSensorEvent_v30 KEYWORD2
6 | ON KEYWORD2
7 | OFF KEYWORD2
8 | getDistance KEYWORD2
9 | getLuxes KEYWORD2
10 | getPressure KEYWORD2
11 | getTemperature KEYWORD2
12 | getHumidity KEYWORD2
13 | attachInt KEYWORD2
14 | detachInt KEYWORD2
15 | loadInt KEYWORD2
16 | enableFlowInt KEYWORD2
17 | disableFlowInt KEYWORD2
18 |
19 | getInt KEYWORD2
20 | flowClass KEYWORD2
21 | flowReading KEYWORD2
22 | hallSensorClass KEYWORD2
23 | readHallSensor KEYWORD2
24 | liquidLevelClass KEYWORD2
25 | readliquidLevel KEYWORD2
26 | liquidPresenceClass KEYWORD2
27 | readliquidPresence KEYWORD2
28 | pirSensorClass KEYWORD2
29 | readPirSensor KEYWORD2
30 | relayClass KEYWORD2
31 | readInRel KEYWORD2
32 | relayOFF KEYWORD2
33 | relayON KEYWORD2
34 |
35 | SENS_FLOW_FS100 LITERAL1
36 | SENS_FLOW_FS200 LITERAL1
37 | SENS_FLOW_FS400 LITERAL1
38 | SENS_FLOW_YFS401 LITERAL1
39 | SENS_FLOW_FS300 LITERAL1
40 | SENS_FLOW_YFG1 LITERAL1
41 | OUTDOOR LITERAL1
42 | INDOOR LITERAL1
43 |
--------------------------------------------------------------------------------
/libraries/SensorGas_v30/keywords.txt:
--------------------------------------------------------------------------------
1 | # Gas_v30 keywords #
2 |
3 | SOCKET_1 LITERAL1
4 | SOCKET_2 LITERAL1
5 | SOCKET_3 LITERAL1
6 | SOCKET_4 LITERAL1
7 | SOCKET_5 LITERAL1
8 | SOCKET_6 LITERAL1
9 | SOCKET_7 LITERAL1
10 | SOCKET_8 LITERAL1
11 |
12 | SOCKET_A LITERAL1
13 | SOCKET_B LITERAL1
14 | SOCKET_C LITERAL1
15 | SOCKET_D LITERAL1
16 | SOCKET_E LITERAL1
17 | SOCKET_F LITERAL1
18 |
19 | POINT_1 LITERAL1
20 | POINT_2 LITERAL1
21 | POINT_3 LITERAL1
22 | POINT_4 LITERAL1
23 | POINT_5 LITERAL1
24 | POINT_6 LITERAL1
25 | POINT_7 LITERAL1
26 | POINT_8 LITERAL1
27 | POINT_9 LITERAL1
28 | POINT_10 LITERAL1
29 |
30 |
31 | WaspSensorGas_v30 KEYWORD2
32 | ON KEYWORD2
33 | OFF KEYWORD2
34 |
35 |
36 | GasSensorClass KEYWORD2
37 | getTemperature KEYWORD2
38 | getPressure KEYWORD2
39 | getHumidity KEYWORD2
40 | readConcentration KEYWORD2
41 | setCalibrationPoints KEYWORD2
42 | readVoltage KEYWORD2
43 | readResistance KEYWORD2
44 | getLuxes KEYWORD2
45 | getDistance KEYWORD2
46 |
47 | O2SensorClass KEYWORD2
48 | CO2SensorClass KEYWORD2
49 | NO2SensorClass KEYWORD2
50 | COSensorClass KEYWORD2
51 | NH3SensorClass KEYWORD2
52 | O3SensorClass KEYWORD2
53 | VOCSensorClass KEYWORD2
54 | CH4SensorClass KEYWORD2
55 | LPGSensorClass KEYWORD2
56 | APSensorClass KEYWORD2
57 | SVSensorClass KEYWORD2
58 |
59 | socket1Class KEYWORD2
60 | socket2Class KEYWORD2
61 | socket3Class KEYWORD2
62 | socket4Class KEYWORD2
63 | socket5Class KEYWORD2
64 | socket6Class KEYWORD2
65 | socket7Class KEYWORD2
66 |
67 | Gases KEYWORD1
68 |
69 | O2Sensor KEYWORD1
70 | CO2Sensor KEYWORD1
71 | NO2Sensor KEYWORD1
72 | COSensor KEYWORD1
73 | NH3Sensor KEYWORD1
74 | VOCSensor KEYWORD1
75 | O3Sensor KEYWORD1
76 | CH4Sensor KEYWORD1
77 | LPGSensor KEYWORD1
78 | APPSensor KEYWORD1
79 | SVSensor KEYWORD1
80 |
--------------------------------------------------------------------------------
/libraries/SensorPrototyping_v20/WaspSensorPrototyping_v20.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Libelium Comunicaciones Distribuidas S.L.
3 | * http://www.libelium.com
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 2.1 of the License, or
8 | * (at your option) any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | *
18 | * Version: 3.1
19 | * Design: David Gascón
20 | * Implementation: Alberto Bielsa, Manuel Calahorra
21 | */
22 |
23 | #ifndef __WPROGRAM_H__
24 | #include
25 | #endif
26 |
27 | #include "WaspSensorPrototyping_v20.h"
28 |
29 |
30 |
31 | // Constructors ////////////////////////////////////////////////////////////////
32 |
33 | /* Constructor: Sets the mode of the digital pins and initializes them
34 | *
35 | */
36 | WaspSensorPrototyping_v20::WaspSensorPrototyping_v20()
37 | {
38 | // init power supply to OFF state
39 | PWR.setSensorPower(SENS_3V3, SENS_OFF);
40 | PWR.setSensorPower(SENS_5V, SENS_OFF);
41 |
42 | // update Waspmote Control Register
43 | WaspRegisterSensor |= REG_PROTOTYPING;
44 | }
45 |
46 | // Public Methods //////////////////////////////////////////////////////////////
47 |
48 | /* ON: Calls the setBoardMode function to turn on the board
49 | * Parameters: void
50 | * Return: void
51 | *
52 | */
53 | void WaspSensorPrototyping_v20::ON(void)
54 | {
55 | setBoardMode(SENS_ON);
56 | }
57 |
58 | /* OFF: Calls the setBoardMode function to turn off the board
59 | * Parameters: void
60 | * Return: void
61 | *
62 | */
63 | void WaspSensorPrototyping_v20::OFF(void)
64 | {
65 | setBoardMode(SENS_OFF);
66 | }
67 |
68 | /* setBoardMode: Sets the board mode indicated
69 | * Parameters: uint8_t mode
70 | * - SENS_ON : turn on the board
71 | * - SENS_OFF : turn off the board
72 | * Return: uint8_t error
73 | * - 1 : success / no error detected
74 | * - 0 : wrong mode introduced
75 | */
76 | int8_t WaspSensorPrototyping_v20::setBoardMode(uint8_t mode)
77 | {
78 | switch( mode )
79 | {
80 | case SENS_ON : // switch on the power supplies
81 | PWR.setSensorPower(SENS_3V3, SENS_ON);
82 | PWR.setSensorPower(SENS_5V, SENS_ON);
83 | // Sets RTC on to enable I2C
84 | if(!RTC.isON) RTC.setMode(RTC_ON, RTC_I2C_MODE);
85 | break;
86 | case SENS_OFF: // switch off the power supplies
87 | PWR.setSensorPower(SENS_3V3, SENS_OFF);
88 | PWR.setSensorPower(SENS_5V, SENS_OFF);
89 | break;
90 | default : return 0;
91 | }
92 |
93 | return 1;
94 | }
95 |
96 | /* readADC: reads the analog to digital converter on the board through the I2C
97 | * Parameters: void
98 | * Return: float value : voltage measured by the ADC, between -4.5V and 4.5V
99 | */
100 | float WaspSensorPrototyping_v20::readADC(void)
101 | {
102 | uint8_t data[2] = {0, 0};
103 | float val_def;
104 | uint16_t val;
105 | uint8_t error;
106 |
107 | I2C.begin();
108 |
109 | delay(100);
110 |
111 | I2C.begin();
112 | error = I2C.read((uint8_t)B0010100, data, 2);
113 |
114 | val = int(data[0])*256 + int(data[1]);
115 | val_def = ((float)val - 32769.0)*9.0;
116 | val_def = val_def/65535;
117 |
118 | return val_def;
119 | }
120 |
121 | /* readAnalogSensor: reads the indicated pin and converts its value into volts
122 | * Parameters: uint8_t pin : pin to be read, from ANALOG1 to ANALOG7
123 | * Return: float value : voltage read in the pin in volts
124 | * -1 if an incorrect pin was selected
125 | */
126 | float WaspSensorPrototyping_v20::readAnalogSensor(uint8_t pin)
127 | {
128 | uint16_t read_val;
129 | float def_val;
130 |
131 | if ( (pin >= ANALOG1) && (pin <= ANALOG7) )
132 | {
133 | read_val = analogRead(pin);
134 | read_val = analogRead(pin);
135 | def_val = (read_val*3.3)/1023;
136 | return def_val;
137 | }
138 | else return -1;
139 | }
140 |
141 |
142 | WaspSensorPrototyping_v20 SensorProtov20=WaspSensorPrototyping_v20();
143 |
--------------------------------------------------------------------------------
/libraries/SensorPrototyping_v20/WaspSensorPrototyping_v20.h:
--------------------------------------------------------------------------------
1 | /*! \file WaspSensorPrototyping_v20.h
2 | \brief Library for managing the Prototyping v2.0 Sensor Board
3 |
4 | Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
5 | http://www.libelium.com
6 |
7 | This program is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU Lesser General Public License as published by
9 | the Free Software Foundation, either version 2.1 of the License, or
10 | (at your option) any later version.
11 |
12 | This program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU Lesser General Public License for more details.
16 |
17 | You should have received a copy of the GNU Lesser General Public License
18 | along with this program. If not, see .
19 |
20 | Version: 3.0
21 | Design: David Gascón
22 | Implementation: Alberto Bielsa, Manuel Calahorra
23 |
24 | */
25 |
26 | /*! \def WaspSensorPrototyping_v20_h
27 | \brief The library flag
28 |
29 | */
30 | #ifndef WaspSensorPrototyping_v20_h
31 | #define WaspSensorPrototyping_v20_h
32 |
33 |
34 | /******************************************************************************
35 | * Includes
36 | ******************************************************************************/
37 |
38 | #include
39 |
40 |
41 | /******************************************************************************
42 | * Definitions & Declarations
43 | ******************************************************************************/
44 |
45 |
46 | /******************************************************************************
47 | * Class
48 | ******************************************************************************/
49 |
50 | //! WaspSensorPrototyping Class
51 | /*!
52 | WaspSensorPrototyping Class defines all the variables and functions used for
53 | managing the Prototyping Sensor Board
54 | */
55 | class WaspSensorPrototyping_v20
56 | {
57 | private:
58 |
59 | public:
60 |
61 | //! class constructor
62 | /*!
63 | It initializes the different digital pins
64 | \param void
65 | \return void
66 | */
67 | WaspSensorPrototyping_v20();
68 |
69 | //! Turns ON the board
70 | /*!
71 | \param void
72 | \return void
73 | */
74 | void ON(void);
75 |
76 | //! Turns OFF the board
77 | /*!
78 | \param void
79 | \return void
80 | */
81 | void OFF(void);
82 |
83 | //! It sets board power mode, setting ON/OFF 3v3 and 5V switches
84 | /*!
85 | \param uint8_t mode : SENS_ON or SENS_OFF
86 | \return int8_t error
87 | */
88 | int8_t setBoardMode(uint8_t mode);
89 |
90 | //! It reads the Analogic-to-Digital Converter
91 | /*!
92 | \param void
93 | \return the value returned by the conversor
94 | */
95 | float readADC(void);
96 |
97 | //! It reads an analog sensor and returns its measured value in Volts
98 | /*!
99 | \param uint8_t pin : specifies the analog pin where the sensor is connected
100 | \return the measured value in Volts (range [0-3.3] Volts)
101 | */
102 | float readAnalogSensor(uint8_t pin);
103 | };
104 |
105 | extern WaspSensorPrototyping_v20 SensorProtov20;
106 |
107 | #endif
108 |
--------------------------------------------------------------------------------
/libraries/SensorPrototyping_v20/keywords.txt:
--------------------------------------------------------------------------------
1 | # prototyping_v20 #
2 |
3 | WaspSensorPrototyping_v20 KEYWORD2
4 | ON KEYWORD2
5 | OFF KEYWORD2
6 | setBoardMode KEYWORD2
7 | readADC KEYWORD2
8 | readAnalogSensor KEYWORD2
9 |
10 | SensorProtov20 KEYWORD1
11 |
--------------------------------------------------------------------------------
/libraries/SensorRadiation/WaspSensorRadiation.h:
--------------------------------------------------------------------------------
1 | /*! \file WaspRadiation.h
2 | \brief Library for managing the Radiation board
3 |
4 | Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
5 | http://www.libelium.com
6 |
7 | This program is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU Lesser General Public License as published by
9 | the Free Software Foundation, either version 2.1 of the License, or
10 | (at your option) any later version.
11 |
12 | This program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU Lesser General Public License for more details.
16 |
17 | You should have received a copy of the GNU Lesser General Public License
18 | along with this program. If not, see .
19 |
20 | Version: 3.0
21 | Design: David Gascón
22 | Implementation: Marcos Yarza, Javier Siscart
23 |
24 | */
25 |
26 | /*! \def WaspRTC_h
27 | \brief The library flag
28 |
29 | */
30 |
31 | #ifndef WaspRadiationBoard_h
32 | #define WaspRadiationBoard_h
33 |
34 | /******************************************************************************
35 | * Includes
36 | ******************************************************************************/
37 | #include
38 |
39 |
40 | /******************************************************************************
41 | * Definitions & Declarations
42 | ******************************************************************************/
43 |
44 | // Threshold values for the led bar
45 | #define TH1 75
46 | #define TH2 150
47 | #define TH3 400
48 | #define TH4 600
49 | #define TH5 900
50 |
51 | // Conversion factor - CPM to uSV/h
52 | #define CONV_FACTOR 0.008120
53 |
54 |
55 |
56 |
57 | /******************************************************************************
58 | * Class
59 | ******************************************************************************/
60 |
61 | class WaspRadiationBoard{
62 |
63 | private:
64 |
65 |
66 | //! Function: Count pulses from sensor
67 | /*!
68 | */
69 | void countPulse();
70 |
71 |
72 | public:
73 |
74 | //! class constructor
75 | /*!
76 | It does nothing
77 | \param void
78 | \return void
79 | */
80 | WaspRadiationBoard();
81 |
82 | // Variables
83 |
84 | //! Variable : Stores last measured radiation value in uSv/h
85 | /*!
86 | */
87 | float radiationValue;
88 |
89 | //! Variable : Stores last measured radiation value in cpm
90 | /*!
91 | */
92 | float radiationValueCPM;
93 |
94 | //! Variable :
95 | /*!
96 | */
97 | int ledArray [5];
98 |
99 | //! Variable : stores number of pulses counted
100 | /*!
101 | */
102 | long count;
103 |
104 | //! Variable :
105 | /*!
106 | */
107 | long timePrevious;
108 |
109 | //! Variable :
110 | /*!
111 | */
112 | long time;
113 |
114 | //! Variable :
115 | /*!
116 | */
117 | long timePreviousMeassure;
118 |
119 | //! Function : Turns on radiation board
120 | /*!
121 | */
122 | void ON();
123 |
124 | //! Function : Turns off radiation board
125 | /*!
126 | */
127 | void OFF();
128 |
129 | //! Function : enables interrupts and blinks led bar
130 | /*!
131 | */
132 | void init();
133 |
134 | //! Function : Measures actual radiation value during 10 seconds.
135 | /*!
136 | */
137 | float getRadiation();
138 |
139 |
140 | //! Function : Measures actual radiation value during 10 seconds.
141 | /*!
142 | */
143 | float getRadiationInt();
144 |
145 | //! Function : Measures actual radiation value during specified time. Maximum measure time is 60 seconds
146 | /*!
147 | */
148 | float getRadiationInt(long time);
149 | //! Function : Measures actual radiation value during specified time. Maximum time is 60 seconds
150 | /*!
151 | */
152 | float getCPM(long time);
153 |
154 | //! Function : Refresh led bar value
155 | /*!
156 | */
157 | void ledBar(float value);
158 | };
159 |
160 |
161 | extern WaspRadiationBoard RadiationBoard;
162 |
163 | #endif
164 |
--------------------------------------------------------------------------------
/libraries/SensorRadiation/keywords.txt:
--------------------------------------------------------------------------------
1 | # Radiation keywords #
2 |
3 | TH1 LITERAL1
4 | TH2 LITERAL1
5 | TH3 LITERAL1
6 | TH4 LITERAL1
7 | TH5 LITERAL1
8 | CONV_FACTOR LITERAL1
9 |
10 | WaspRadiationBoard KEYWORD2
11 | radiationValue KEYWORD2
12 | radiationValueCPM KEYWORD2
13 | ledArray KEYWORD2
14 | count KEYWORD2
15 | timePrevious KEYWORD2
16 | timePreviousMeassure KEYWORD2
17 | ON KEYWORD2
18 | OFF KEYWORD2
19 | init KEYWORD2
20 | getRadiation KEYWORD2
21 | getRadiationInt KEYWORD2
22 | getCPM KEYWORD2
23 | ledBar KEYWORD2
24 | WaspSensorRadiation KEYWORD2
25 |
26 | RadiationBoard KEYWORD1
27 |
--------------------------------------------------------------------------------
/libraries/SensorSW/keywords.txt:
--------------------------------------------------------------------------------
1 | # SW Keywords #
2 |
3 | SENS_SW_DO LITERAL1
4 | SENS_SW_COND LITERAL1
5 | SENS_SW_PH LITERAL1
6 | SENS_SW_ORP LITERAL1
7 | SENS_SW_DI LITERAL1
8 | SW_COND_CAL_01 LITERAL1
9 | SW_COND_CAL_02 LITERAL1
10 | SW_COND_CAL_03 LITERAL1
11 | SW_COND_CAL_04 LITERAL1
12 | SW_COND_CAL_05 LITERAL1
13 | SW_COND_CAL_06 LITERAL1
14 | SW_COND_CAL_07 LITERAL1
15 | SW_COND_CAL_08 LITERAL1
16 | SW_COND_CAL_09 LITERAL1
17 | SW_COND_CAL_10 LITERAL1
18 | SW_COND_CAL_11 LITERAL1
19 | SW_COND_CAL_12 LITERAL1
20 | SW_COND_CAL_13 LITERAL1
21 | SW_COND_CAL_14 LITERAL1
22 | SW_COND_CAL_15 LITERAL1
23 | SW_COND_CAL_16 LITERAL1
24 | FILTER_SAMPLES LITERAL1
25 | TEMP_CHANNEL LITERAL1
26 | DO_CHANNEL LITERAL1
27 | PH_CHANNEL LITERAL1
28 | ORP_CHANNEL LITERAL1
29 | DI_CHANNEL LITERAL1
30 | COND_CHANNEL LITERAL1
31 | pH_SOCKET LITERAL1
32 | ORP_SOCKET LITERAL1
33 | DI_SOCKET LITERAL1
34 |
35 | WaspSensorSW KEYWORD2
36 | ON KEYWORD2
37 | OFF KEYWORD2
38 |
39 | SensorSW KEYWORD1
40 | Water KEYWORD1
41 |
42 |
43 | #Temperature#
44 |
45 | pt1000Class KEYWORD2
46 | readTemperature KEYWORD2
47 |
48 |
49 | #pH#
50 |
51 | pHClass KEYWORD2
52 | readpH KEYWORD2
53 | pHConversion KEYWORD2
54 | pHConversion KEYWORD2
55 | setCalibrationPoints KEYWORD2
56 |
57 |
58 | #Conductivity#
59 |
60 | conductivityClass KEYWORD2
61 | readConductivity KEYWORD2
62 | conductivityConversion KEYWORD2
63 | setCalibrationPoints KEYWORD2
64 |
65 |
66 | #ORP#
67 |
68 | ORPClass KEYWORD2
69 | readORP KEYWORD2
70 |
71 |
72 | #DO#
73 |
74 | DOClass KEYWORD2
75 | readDO KEYWORD2
76 | DOConversion KEYWORD2
77 | setCalibrationPoints KEYWORD2
78 |
79 |
80 | #DI#
81 |
82 | DIClass KEYWORD2
83 | readDI KEYWORD2
84 | setCalibrationPoints KEYWORD2
85 | calculateConcentration KEYWORD2
86 |
87 |
88 | #Turbidity#
89 |
90 | ADDRESS_REG LITERAL1
91 | TEMP_VALUE_REG LITERAL1
92 | TURB_VALUE_REG LITERAL1
93 | RESET_REG LITERAL1
94 | COMP_TEMP_REG LITERAL1
95 | TEMP_MEAS_STATUS LITERAL1
96 | TEMP_COEF_REG LITERAL1
97 | TEMP_CAL1_REG LITERAL1
98 | TEMP_CAL2_REG LITERAL1
99 | OPER_NAME_REG LITERAL1
100 | DATE_TEMP_REG LITERAL1
101 | TEMP_TYPE_CON LITERAL1
102 | TURB_TYPE_CON LITERAL1
103 | AVRG_PARA_REG LITERAL1
104 | DISABLED LITERAL1
105 | TURB_MEAS_STATUS LITERAL1
106 | NEW_MEAS_REG LITERAL1
107 | TEMP_NEW_MEAS LITERAL1
108 | TURB_NEW_MEAS LITERAL1
109 | OFFSET_0 LITERAL1
110 | TEMP_25 LITERAL1
111 | sensorAddress LITERAL1
112 | DEBUG_MODE LITERAL1
113 | filterSamples LITERAL1
114 | SENSOR_ADDRESS LITERAL1
115 | DEFAULT_ADDRESS LITERAL1
116 |
117 | ON KEYWORD2
118 | OFF KEYWORD2
119 | readTurbidit KEYWORD2
120 | getTurbidity KEYWORD2
121 | TurbiditySensor KEYWORD2
122 | readTurbidity KEYWORD2
123 | turbidityClass KEYWORD2
124 |
--------------------------------------------------------------------------------
/libraries/SensorSW/utility/ADC.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
3 | * http://www.libelium.com
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 2.1 of the License, or
8 | * (at your option) any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | *
18 | * Version: 3.0
19 | * Design: Ahmad Saad
20 | */
21 |
22 | #ifndef ADC_h
23 | #define ADC_h
24 |
25 | //!*************************************************************************************
26 | //! Includes
27 | //!*************************************************************************************
28 | #include
29 |
30 | //!*************************************************************************************
31 | //! Class declaration
32 | //!*************************************************************************************
33 | class adcClass
34 | {
35 |
36 | public:
37 |
38 | adcClass();
39 | void begin();
40 | float readADC(uint8_t channel);
41 | };
42 |
43 | extern adcClass myADC;
44 |
45 | #endif
46 |
--------------------------------------------------------------------------------
/libraries/SensorSW/utility/filter.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
3 | * http://www.libelium.com
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 2.1 of the License, or
8 | * (at your option) any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | *
18 | * Version: 3.0
19 | * Design: Ahmad Saad
20 | * */
21 |
22 | //!*************************************************************************************
23 | //! Includes
24 | //!*************************************************************************************
25 |
26 | #include "filter.h"
27 |
28 | #ifndef __WPROGRAM_H__
29 | #include
30 | #endif
31 |
32 |
33 | //!*************************************************************************************
34 | //! Filter Object
35 | //!*************************************************************************************
36 | filterClass myFilter;
37 |
38 |
39 | //!*************************************************************************************
40 | //! Name: filterClass()
41 | //! Description: Class contructor
42 | //! Param : void
43 | //! Returns: void
44 | //!*************************************************************************************
45 | filterClass::filterClass(){}
46 |
47 |
48 | //!*************************************************************************************
49 | //! Name: median()
50 | //! Description: Class contructor
51 | //! Param : float* array: values to filter
52 | //! uint8_t length: length of the vector
53 | //! Returns: void
54 | //!*************************************************************************************
55 | float filterClass::median(float* array, uint8_t length)
56 | {
57 | int k,l,m,n;
58 | float aux[length];
59 |
60 | // Initialization of the auxiliar array
61 | for(k=0;kaux[m])
70 | {
71 | for(n=length-1;n>m;n--) aux[n]=aux[n-1];
72 | aux[m]=array[l];
73 | m=l+1;
74 | continue;
75 | }
76 | }
77 | }
78 |
79 | // The value in the central position of the array is returned
80 | return aux[int(length/2)];
81 | }
82 |
83 |
--------------------------------------------------------------------------------
/libraries/SensorSW/utility/filter.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
3 | * http://www.libelium.com
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 2.1 of the License, or
8 | * (at your option) any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | *
18 | * Version: 3.0
19 | * Design: Ahmad Saad
20 | */
21 |
22 | #ifndef FILTER_h
23 | #define FILTER_h
24 |
25 | //!*************************************************************************************
26 | //! Includes
27 | //!*************************************************************************************
28 | #include
29 |
30 |
31 | //!*************************************************************************************
32 | //! Class declaration
33 | //!*************************************************************************************
34 | class filterClass
35 | {
36 | public:
37 |
38 | filterClass();
39 | float median(float* array, uint8_t length);
40 | };
41 |
42 | extern filterClass myFilter;
43 |
44 | #endif
45 |
--------------------------------------------------------------------------------
/libraries/SensorXtr/keywords.txt:
--------------------------------------------------------------------------------
1 | #AgrXtr_Keywords#
2 |
3 | ON KEYWORD2
4 | OFF KEYWORD2
5 |
6 | WaspSensorAgrXtr KEYWORD2
7 | SensorXtr KEYWORD1
8 | Decagon_5TE KEYWORD2
9 | Decagon_5TM KEYWORD2
10 | Decagon_GS3 KEYWORD2
11 | Meter_TEROS12 KEYWORD2
12 | Meter_TEROS11 KEYWORD2
13 | Decagon_VP4 KEYWORD2
14 | Decagon_MPS6 KEYWORD2
15 | Apogee_SO411 KEYWORD2
16 | Apogee_SI411 KEYWORD2
17 | Apogee_SF421 KEYWORD2
18 | leafWetness KEYWORD2
19 | dendrometer KEYWORD2
20 | weatherStation KEYWORD2
21 |
22 | Aqualabo_OPTOD KEYWORD2
23 | Aqualabo_PHEHT KEYWORD2
24 | Aqualabo_NTU KEYWORD2
25 | Aqualabo_CTZN KEYWORD2
26 | Aqualabo_MES5 KEYWORD2
27 | Aqualabo_C4E KEYWORD2
28 | Eureka_Manta KEYWORD2
29 | Aqualabo_SAC KEYWORD2
30 |
31 | set3v3 KEYWORD2
32 | set12v KEYWORD2
33 | isSensor KEYWORD2
34 | startSensor KEYWORD2
35 | setMux KEYWORD2
36 |
37 | setBarometricPressure KEYWORD2
38 | configureSensor KEYWORD2
39 |
40 | XTR_SOCKET_A LITERAL1
41 | XTR_SOCKET_B LITERAL1
42 | XTR_SOCKET_C LITERAL1
43 | XTR_SOCKET_D LITERAL1
44 | XTR_SOCKET_E LITERAL1
45 | XTR_SOCKET_F LITERAL1
46 |
47 | _5TE LITERAL1
48 | GS3 LITERAL1
49 | VP4 LITERAL1
50 | MPS6 LITERAL1
51 | SO411 LITERAL1
52 | SI411 LITERAL1
53 | TEROS12 LITERAL1
54 |
--------------------------------------------------------------------------------
/libraries/SensorXtr/utility/ADC.h:
--------------------------------------------------------------------------------
1 | /*! \file ADC.h
2 | * \brief Library for managing the ADC of Smart Agriculture Extreme sensor board
3 | *
4 | * Copyright (C) 2018 Libelium Comunicaciones Distribuidas S.L.
5 | * http://www.libelium.com
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 2.1 of the License, or
10 | * (at your option) any later version.
11 |
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 |
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | *
20 | * Version: 3.0
21 | * Design: Ahmad Saad, Javier Siscart.
22 | */
23 |
24 | #ifndef ADC_h
25 | #define ADC_h
26 |
27 | //!*************************************************************************************
28 | //! Includes
29 | //!*************************************************************************************
30 | #include
31 |
32 |
33 | /******************************************************************************
34 | * Definitions & Declarations
35 | ******************************************************************************/
36 | #define XTR_ADC_CS DIGITAL3
37 |
38 | //!*************************************************************************************
39 | //! Class declaration
40 | //!*************************************************************************************
41 | class LTC
42 | {
43 |
44 | public:
45 |
46 | LTC();
47 | void begin();
48 | float readADC(uint8_t channel);
49 | };
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/libraries/SensorXtr/utility/MCP23008.h:
--------------------------------------------------------------------------------
1 | /*! \file MCP23008.h
2 | \brief Library for managing library for the MCP23008 i2c port expander
3 |
4 | Copyright (C) 2018 Libelium Comunicaciones Distribuidas S.L.
5 | http://www.libelium.com
6 |
7 | This program is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU Lesser General Public License as published by
9 | the Free Software Foundation, either version 2.1 of the License, or
10 | (at your option) any later version.
11 |
12 | This program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU Lesser General Public License for more details.
16 |
17 | You should have received a copy of the GNU Lesser General Public License
18 | along with this program. If not, see .
19 |
20 | These displays use I2C to communicate, 2 pins are required to
21 | interface. Adafruit invests time and resources providing this open
22 | source code, please support Adafruit and open-source hardware by purchasing
23 | products from Adafruit!
24 |
25 | Written by Limor Fried/Ladyada for Adafruit Industries.
26 | BSD license, all text above must be included in any redistribution
27 |
28 | Version: 3.0
29 | Design: David Gascón
30 | Implementation: Javier Siscart, Víctor Boria
31 |
32 | */
33 |
34 | #ifndef MCP23008_H
35 | #define MCP23008_H
36 |
37 | /*******************************************************************************
38 | * Includes
39 | ******************************************************************************/
40 | #ifndef __WPROGRAM_H__
41 | #include
42 | #endif
43 |
44 | /*******************************************************************************
45 | * Definitions
46 | ******************************************************************************/
47 |
48 | #define MCP23008_ADDRESS 0x20
49 |
50 | // registers
51 | #define MCP23008_IODIR 0x00
52 | #define MCP23008_IPOL 0x01
53 | #define MCP23008_GPINTEN 0x02
54 | #define MCP23008_DEFVAL 0x03
55 | #define MCP23008_INTCON 0x04
56 | #define MCP23008_IOCON 0x05
57 | #define MCP23008_GPPU 0x06
58 | #define MCP23008_INTF 0x07
59 | #define MCP23008_INTCAP 0x08
60 | #define MCP23008_GPIO 0x09
61 | #define MCP23008_OLAT 0x0A
62 |
63 |
64 | /*******************************************************************************
65 | * Class
66 | ******************************************************************************/
67 |
68 | /*!
69 | * \class MCP23008
70 | * \brief class for Pin expansor
71 | */
72 | class MCP23008
73 | {
74 | private:
75 | uint8_t i2caddr;
76 | uint8_t read8(uint8_t addr);
77 | uint8_t write8(uint8_t addr, uint8_t data);
78 |
79 | public:
80 |
81 | MCP23008(); // Constructor
82 |
83 | uint8_t pinMode(uint8_t p, uint8_t d);
84 | uint8_t digitalWrite(uint8_t p, uint8_t d);
85 | uint8_t pullUp(uint8_t p, uint8_t d);
86 | uint8_t digitalRead(uint8_t p);
87 | uint8_t readGPIO(void);
88 | uint8_t writeGPIO(uint8_t);
89 | };
90 |
91 | #endif
92 |
--------------------------------------------------------------------------------
/libraries/Sigfox/keywords.txt:
--------------------------------------------------------------------------------
1 | getLANAddress KEYWORD2
2 | showPacket KEYWORD2
3 | factorySettings KEYWORD2
4 | setLANAddress KEYWORD2
5 | getMask KEYWORD2
6 | setMask KEYWORD2
7 | receiveMode KEYWORD2
8 | send KEYWORD2
9 | sendACK KEYWORD2
10 | testTransmit KEYWORD2
11 | continuosWave KEYWORD2
12 | sendKeepAlive KEYWORD2
13 | showFirmware KEYWORD2
14 | setAddressLAN KEYWORD2
15 | getAddressLAN KEYWORD2
16 | setFrequency KEYWORD2
17 | getFrequency KEYWORD2
18 | setPowerLAN KEYWORD2
19 | getPowerLAN KEYWORD2
20 | setMultiPacket KEYWORD2
21 | getMultiPacket KEYWORD2
22 | sendLAN KEYWORD2
23 | receive KEYWORD2
24 | saveSettings KEYWORD2
25 | defaultConfiguration KEYWORD2
26 | parsePacketLAN KEYWORD2
27 | disableRX KEYWORD2
28 | getRegion KEYWORD2
29 | setMacroChannelBitmask KEYWORD2
30 | getMacroChannelBitmask KEYWORD2
31 | setMacroChannel KEYWORD2
32 | getMacroChannel KEYWORD2
33 | setDownFreqOffset KEYWORD2
34 | getDownFreqOffset KEYWORD2
35 | setRegionRC4 KEYWORD2
36 | setRegionRC2 KEYWORD2
37 |
38 | _buffer KEYWORD2
39 | _length KEYWORD2
40 | _id KEYWORD2
41 | _power KEYWORD2
42 | _address KEYWORD2
43 | _mask KEYWORD2
44 | _frequency KEYWORD2
45 | _powerLAN KEYWORD2
46 | _packet KEYWORD2
47 | _firmware KEYWORD2
48 | _version KEYWORD2
49 | _region KEYWORD2
50 | _macroChannelBitmask KEYWORD2
51 | _macroChannel KEYWORD2
52 | _downFreqOffset KEYWORD2
53 |
54 | WaspSigfox KEYWORD2
55 |
56 | Sigfox KEYWORD1
57 | SIGFOX_RATE KEYWORD1
58 | AT_OK KEYWORD1
59 | AT_ERROR KEYWORD1
60 | AT_EOL KEYWORD1
61 | AT_HEADER KEYWORD1
62 | AT_HEADER_SLASH KEYWORD1
63 | SIGFOX_LAN_MAX_PAYLOAD KEYWORD1
64 |
65 | SIGFOX_ANSWER_OK LITERAL1
66 | SIGFOX_ANSWER_ERROR LITERAL1
67 | SIGFOX_NO_ANSWER LITERAL1
68 | SIGFOX_CMD_SET LITERAL1
69 | SIGFOX_CMD_READ LITERAL1
70 | SIGFOX_CMD_DISPLAY LITERAL1
71 |
72 | SIGFOX_REGION_UNKNOWN LITERAL1
73 | SIGFOX_REGION_ETSI LITERAL1
74 | SIGFOX_REGION_FCC LITERAL1
75 | SIGFOX_REGION_ARIB LITERAL1
76 |
--------------------------------------------------------------------------------
/libraries/SmartWaterIons/keywords.txt:
--------------------------------------------------------------------------------
1 | # Ions Keywords #
2 |
3 | SOCKETA LITERAL1
4 | SOCKETB LITERAL1
5 | SOCKETC LITERAL1
6 | SOCKETD LITERAL1
7 | SOCKET1 LITERAL1
8 | SOCKET2 LITERAL1
9 | SOCKET3 LITERAL1
10 | SOCKET4 LITERAL1
11 | MAX_POINTS LITERAL1
12 |
13 | WaspSensorSWIons KEYWORD2
14 | ON KEYWORD2
15 | OFF KEYWORD2
16 |
17 | #Ion#
18 |
19 | smartWaterIons KEYWORD2
20 | ionSensorClass KEYWORD2
21 | read KEYWORD2
22 | setCalibrationPoints KEYWORD2
23 | pHConversion KEYWORD2
24 | setpHCalibrationPoints KEYWORD2
25 | pointToPointCalibration KEYWORD2
26 | calculateConcentrationP2P KEYWORD2
27 | SWIonsBoard KEYWORD1
28 |
29 | #Temperature#
30 |
31 | pt1000Class KEYWORD2
32 | read KEYWORD2
33 |
34 |
35 | #SOCKET1#
36 |
37 | socket1Class KEYWORD2
38 | read KEYWORD2
39 |
40 |
41 | #SOCKET2#
42 |
43 | socket2Class KEYWORD2
44 | read KEYWORD2
45 |
46 |
47 | #SOCKET3#
48 |
49 | socket3Class KEYWORD2
50 | read KEYWORD2
51 |
52 |
53 | #SOCKET4#
54 |
55 | socket4Class KEYWORD2
56 | read KEYWORD2
57 |
58 |
--------------------------------------------------------------------------------
/libraries/SmartWaterIons/utility/ADC7705.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
3 | * http://www.libelium.com
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 2.1 of the License, or
8 | * (at your option) any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | *
18 | * Version: 3.0
19 | * Design: Ahmad Saad
20 | */
21 |
22 | #ifndef ADC_h
23 | #define ADC_h
24 |
25 | //!*************************************************************************************
26 | //! Includes
27 | //!*************************************************************************************
28 | #include
29 |
30 |
31 | //!*************************************************************************************
32 | //! Defines
33 | //!*************************************************************************************
34 | // Comm. Register Codes to set up a read from data reg on second channel:
35 | // spi_transfer(READ|DATA_REG|CH1)
36 | #define DRDY_BIT (7)
37 | #define COMM_REG (0x00)
38 | #define SETUP_REG (0x10)
39 | #define CLOCK_REG (0x20)
40 | #define DATA_REG (0x30)
41 | #define OFFSET_REG (0x60)
42 | #define GAIN_REG (0x70)
43 | #define READ (0x08)
44 | #define WRITE (0x00)
45 | #define STBY (0x04)
46 | #define AIN1 (0x00)
47 | #define AIN2 (0x01)
48 |
49 | // Setup Reg. Codes
50 | #define OP_NORMAL (0x00)
51 | #define OP_SELF_CAL (0x40)
52 | #define OP_ZS_CAL (0x80)
53 | #define OP_FS_CAL (0xC0)
54 | #define GAIN_1 (0x00)
55 | #define GAIN_2 (0x08)
56 | #define GAIN_4 (0x10)
57 | #define GAIN_8 (0x18)
58 | #define GAIN_16 (0x20)
59 | #define GAIN_32 (0x28)
60 | #define GAIN_64 (0x30)
61 | #define GAIN_128 (0x38)
62 | #define BIPOLAR (0x00)
63 | #define UNIPOLAR (0x04)
64 | #define BUF_ON (0x02)
65 | #define BUF_OFF (0x00)
66 | #define FSYNC (0x01)
67 | #define FSYNC_CLR (0x00)
68 |
69 | // Clock Reg. Codes
70 | // These settings let it update at about 20hz
71 | #define CLKDIS (0x00) // 00010000
72 | #define CLKDIV (0x08) // 00001000
73 | #define CLK (0x04) // 00000100
74 | #define FILTER (0x00) // 00000000
75 |
76 | // Pin setup
77 | #define CS_AD7705 DIGITAL1
78 | #define DRDY DIGITAL6
79 |
80 | #define timeOut 100
81 |
82 |
83 | //!*************************************************************************************
84 | //! Class declaration
85 | //!*************************************************************************************
86 | class adcClass
87 | {
88 |
89 | public:
90 |
91 | adcClass();
92 | void begin();
93 | void configure(uint8_t CHANNEL);
94 | float readADC(uint8_t channel);
95 | };
96 |
97 | extern adcClass myADC;
98 |
99 | #endif
100 |
--------------------------------------------------------------------------------
/libraries/TSL2561/keywords.txt:
--------------------------------------------------------------------------------
1 | # TSL2561 #
2 |
3 | TSL2561_VISIBLE LITERAL1
4 | TSL2561_INFRARED LITERAL1
5 | TSL2561_FULLSPECTRUM LITERAL1
6 | TSL2561_ADDR_FLOAT LITERAL1
7 | TSL2561_PACKAGE_T_FN_CL LITERAL1
8 | TSL2561_READBIT LITERAL1
9 | TSL2561_COMMAND_BIT LITERAL1
10 | TSL2561_CLEAR_BIT LITERAL1
11 | TSL2561_WORD_BIT LITERAL1
12 | TSL2561_BLOCK_BIT LITERAL1
13 | TSL2561_CONTROL_POWERON LITERAL1
14 | TSL2561_CONTROL_POWEROFF LITERAL1
15 | TSL2561_LUX_LUXSCALE LITERAL1
16 | TSL2561_LUX_RATIOSCALE LITERAL1
17 | TSL2561_LUX_CHSCALE LITERAL1
18 | TSL2561_LUX_CHSCALE_TINT0 LITERAL1
19 | TSL2561_LUX_CHSCALE_TINT1 LITERAL1
20 | TSL2561_LUX_K1T LITERAL1
21 | TSL2561_LUX_B1T LITERAL1
22 | TSL2561_LUX_M1T LITERAL1
23 | TSL2561_LUX_K2T LITERAL1
24 | TSL2561_LUX_B2T LITERAL1
25 | TSL2561_LUX_M2T LITERAL1
26 | TSL2561_LUX_K3T LITERAL1
27 | TSL2561_LUX_B3T LITERAL1
28 | TSL2561_LUX_M3T LITERAL1
29 | TSL2561_LUX_K4T LITERAL1
30 | TSL2561_LUX_B4T LITERAL1
31 | TSL2561_LUX_M4T LITERAL1
32 | TSL2561_LUX_K5T LITERAL1
33 | TSL2561_LUX_B5T LITERAL1
34 | TSL2561_LUX_M5T LITERAL1
35 | TSL2561_LUX_K6T LITERAL1
36 | TSL2561_LUX_B6T LITERAL1
37 | TSL2561_LUX_M6T LITERAL1
38 | TSL2561_LUX_K7T LITERAL1
39 | TSL2561_LUX_B7T LITERAL1
40 | TSL2561_LUX_M7T LITERAL1
41 | TSL2561_LUX_K8T LITERAL1
42 | TSL2561_LUX_B8T LITERAL1
43 | TSL2561_LUX_M8T LITERAL1
44 |
45 | TSL2561_CONTROL_REG LITERAL1
46 | TSL2561_TIMING_REG LITERAL1
47 | TSL2561_THRESHHOLDL_LOW_REG LITERAL1
48 | TSL2561_THRESHHOLDL_HIGH_REG LITERAL1
49 | TSL2561_THRESHHOLDH_LOW_REG LITERAL1
50 | TSL2561_THRESHHOLDH_HIGH_REG LITERAL1
51 | TSL2561_INTERRUPT_REG LITERAL1
52 | TSL2561_CRC_REG LITERAL1
53 | TSL2561_CHIP_ID_REG LITERAL1
54 | TSL2561_CHAN0_LOW_REG LITERAL1
55 | TSL2561_CHAN0_HIGH_REG LITERAL1
56 | TSL2561_CHAN1_LOW_REG LITERAL1
57 | TSL2561_CHAN1_HIGH_REG LITERAL1
58 |
59 |
60 | TSL2561_INTEGRATIONTIME_13MS LITERAL1
61 | TSL2561_INTEGRATIONTIME_101MS LITERAL1
62 | TSL2561_INTEGRATIONTIME_402MS LITERAL1
63 |
64 | TSL2561_GAIN_0X LITERAL1
65 | TSL2561_GAIN_16X LITERAL1
66 |
67 |
68 | TSL2561_CHIP_ID_REG_CHIP_ID LITERAL1
69 |
70 | INDOOR LITERAL1
71 | OUTDOOR LITERAL1
72 |
73 | TSL2561 KEYWORD2
74 | ON KEYWORD2
75 | getLuminosity KEYWORD2
76 |
77 | TSL KEYWORD1
78 |
79 |
80 |
--------------------------------------------------------------------------------
/libraries/UltrasoundSensor/UltrasoundSensor.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Library for managing the MB7040 and MB1202 sensors
3 | *
4 | * Copyright (C) 2018 Libelium Comunicaciones Distribuidas S.L.
5 | * http://www.libelium.com
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 2.1 of the License, or
10 | * (at your option) any later version.
11 |
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 |
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | *
20 | * Version: 3.1
21 | * Design: David Gascón
22 | * Implementation: Alejandro Gállego
23 | */
24 |
25 | #ifndef __WPROGRAM_H__
26 | #include "WaspClasses.h"
27 | #endif
28 |
29 |
30 | #include
31 |
32 |
33 | /* Function: This function performs a distance measurement
34 | * Return: distance in cm.
35 | * 9000 if error reading the distance
36 | * 10000 if error reading the sensor
37 | */
38 | uint16_t UltrasoundSensor::getDistance()
39 | {
40 |
41 | union l {
42 | uint16_t distance;
43 | uint8_t data[2];
44 | }measure;
45 |
46 | uint32_t tempo;
47 |
48 | // init I2C bus
49 | I2C.begin();
50 |
51 | // send command
52 | I2C.write(I2C_ADDRESS_MB7040_MB1202, MB7040_MB1202_RANGE_READING, 1);
53 |
54 | delay(100); //It is best to allow 100ms between readings to allow for proper acoustic dissipation.
55 |
56 | // Reads the measured distance
57 | I2C.read(I2C_ADDRESS_MB7040_MB1202,measure.data,2);
58 |
59 | uint8_t aux;
60 | aux = measure.data[0];
61 | measure.data[0] = measure.data[1];
62 | measure.data[1] = aux;
63 |
64 | return measure.distance;
65 | }
66 |
67 |
68 | // Preinstantiate Objects //////////////////////////////////////////////////////
69 |
70 | UltrasoundSensor Ultrasound = UltrasoundSensor();
71 |
--------------------------------------------------------------------------------
/libraries/UltrasoundSensor/UltrasoundSensor.h:
--------------------------------------------------------------------------------
1 | /*! \file UltrasoundSensor.h
2 | \brief Library for managing the MB7040 and MB1202 sensors
3 |
4 | Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
5 | http://www.libelium.com
6 |
7 | This program is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU Lesser General Public License as published by
9 | the Free Software Foundation, either version 2.1 of the License, or
10 | (at your option) any later version.
11 |
12 | This program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU Lesser General Public License for more details.
16 |
17 | You should have received a copy of the GNU Lesser General Public License
18 | along with this program. If not, see .
19 |
20 | Version: 3.0
21 | Design: David Gascón
22 | Implementation: Alejandro Gállego
23 |
24 | */
25 |
26 | /*! \def UltrasoundSensor_h
27 | \brief The library flag
28 |
29 | */
30 | #ifndef UltrasoundSensor_h
31 | #define UltrasoundSensor_h
32 |
33 | /******************************************************************************
34 | * Includes
35 | ******************************************************************************/
36 |
37 | #include
38 |
39 |
40 |
41 | /******************************************************************************
42 | * Defines
43 | ******************************************************************************/
44 |
45 | #define MB7040_MB1202_I2C_READ_TIMEOUT 100
46 |
47 | // Command to take a single reading
48 | #define MB7040_MB1202_RANGE_READING 0x51
49 |
50 |
51 | /******************************************************************************
52 | * Class
53 | ******************************************************************************/
54 |
55 | //! UltrasoundSensor Class
56 | /*!
57 | UltrasoundSensor Class defines all the variables and functions used to manage MB7040 and MB1202 sensors
58 | */
59 | class UltrasoundSensor
60 | {
61 | public:
62 |
63 | //! This function performs a distance measurement
64 | /*!
65 | \return 0 to 735: distance in cm.
66 | 9000 if error reading the distance
67 | 10000 if error reading the sensor
68 | */
69 | uint16_t getDistance();
70 |
71 | };
72 |
73 | extern UltrasoundSensor Ultrasound;
74 |
75 | #endif
76 |
--------------------------------------------------------------------------------
/libraries/UltrasoundSensor/keywords.txt:
--------------------------------------------------------------------------------
1 | # UltrasoundSensor Keywords #
2 |
3 | MB7040_MB1202_I2C_READ_TIMEOUT LITERAL1
4 | MB7040_MB1202_RANGE_READING LITERAL1
5 |
6 | getDistance KEYWORD2
7 |
8 | UltrasoundSensor KEYWORD2
9 | Ultrasound KEYWORD1
10 |
--------------------------------------------------------------------------------
/libraries/WIFI_PRO/keywords.txt:
--------------------------------------------------------------------------------
1 | # WiReach keywords #
2 |
3 | WIFI_PRO KEYWORD1
4 |
5 | WaspWIFI_PRO KEYWORD2
6 | _errorCode KEYWORD2
7 | _rtt KEYWORD2
8 | _value KEYWORD2
9 | _ip KEYWORD2
10 | _gw KEYWORD2
11 | _ftp_handle KEYWORD2
12 | _socket_handle KEYWORD2
13 | _backlog KEYWORD2
14 | _filesize KEYWORD2
15 | _rate KEYWORD2
16 | _level KEYWORD2
17 | _quality KEYWORD2
18 | _bssid KEYWORD2
19 | _channel KEYWORD2
20 | _snr KEYWORD2
21 | _buffer KEYWORD2
22 | _length KEYWORD2
23 | _netmask KEYWORD2
24 | _dns1 KEYWORD2
25 | _dns2 KEYWORD2
26 | _essid KEYWORD2
27 | _firmwareVersion KEYWORD2
28 | resetValues KEYWORD2
29 | setESSID KEYWORD2
30 | setPassword KEYWORD2
31 | softReset KEYWORD2
32 | isConnected KEYWORD2
33 | isConnectedMultiple KEYWORD2
34 | ping KEYWORD2
35 | printErrorCode KEYWORD2
36 | printSockets KEYWORD2
37 | scan KEYWORD2
38 | setIP KEYWORD2
39 | getIP KEYWORD2
40 | setDNS KEYWORD2
41 | setGateway KEYWORD2
42 | setNetmask KEYWORD2
43 | setURL KEYWORD2
44 | getURL KEYWORD2
45 | post KEYWORD2
46 | sendFrameToMeshlium KEYWORD2
47 | ftpOpenSession KEYWORD2
48 | ftpFileSize KEYWORD2
49 | ftpCloseSession KEYWORD2
50 | ftpUpload KEYWORD2
51 | ftpDownload KEYWORD2
52 | ftpMakeDir KEYWORD2
53 | ftpChangeCWD KEYWORD2
54 | ftpListing KEYWORD2
55 | ftpSecureOpenSession KEYWORD2
56 | setTCPclient KEYWORD2
57 | setUDP KEYWORD2
58 | send KEYWORD2
59 | receive KEYWORD2
60 | receiveTimeout KEYWORD2
61 | closeSocket KEYWORD2
62 | closeDownSockets KEYWORD2
63 | setTCPserver KEYWORD2
64 | getAllSocketStatus KEYWORD2
65 | getSocketStatus KEYWORD2
66 | setTimeServer KEYWORD2
67 | timeActivationFlag KEYWORD2
68 | setGMT KEYWORD2
69 | setTimeFromWIFI KEYWORD2
70 | requestOTA KEYWORD2
71 | roamingMode KEYWORD2
72 | getGateway KEYWORD2
73 | getNetmask KEYWORD2
74 | getDNS KEYWORD2
75 | getESSID KEYWORD2
76 | setCA KEYWORD2
77 | reportStatusComplete KEYWORD2
78 | setScanInterval KEYWORD2
79 | setLowThreshold KEYWORD2
80 | setHighThreshold KEYWORD2
81 | setWorkingMode KEYWORD2
82 | setServerPoolSize KEYWORD2
83 | socket KEYWORD2
84 | reportStatus KEYWORD2
85 | reportStatus4 KEYWORD2
86 | parseResponse KEYWORD2
87 | parseResponse2 KEYWORD2
88 | parseResponse3 KEYWORD2
89 | parseResponse4 KEYWORD2
90 | parseResponse5 KEYWORD2
91 | getResponseValue KEYWORD2
92 | getResponseValue2 KEYWORD2
93 | getResponseValue3 KEYWORD2
94 | getResponseValue4 KEYWORD2
95 | getResponseValue5 KEYWORD2
96 | changeBaudRate KEYWORD2
97 | userAbort KEYWORD2
98 | socketAbort KEYWORD2
99 | setContentType KEYWORD2
100 | reportStatus8 KEYWORD2
101 | getFirmwareVersion KEYWORD2
102 | sslHandshake KEYWORD2
103 |
104 | OPEN LITERAL1
105 | WEP64 LITERAL1
106 | WEP128 LITERAL1
107 | WPA LITERAL1
108 | WPA2 LITERAL1
109 | PROFILE_0 LITERAL1
110 | PROFILE_1 LITERAL1
111 | PROFILE_2 LITERAL1
112 | PROFILE_3 LITERAL1
113 | PROFILE_4 LITERAL1
114 | PROFILE_5 LITERAL1
115 | PROFILE_6 LITERAL1
116 | PROFILE_7 LITERAL1
117 | PROFILE_8 LITERAL1
118 | PROFILE_9 LITERAL1
119 | MODE_STATION LITERAL1
120 | MODE_ACCESS_POINT LITERAL1
121 | WIFI_PRO_SCANFILE LITERAL1
122 | WIFI_PRO_LISTFILE LITERAL1
123 | TYPE_SET_EQ LITERAL1
124 | TYPE_SET_DOT LITERAL1
125 | TYPE_ASSIGN LITERAL1
126 | TYPE_READ LITERAL1
127 | TYPE_ALLOWED LITERAL1
128 |
--------------------------------------------------------------------------------
/libraries/WIFI_PRO_V3/keywords.txt:
--------------------------------------------------------------------------------
1 | # WiReach keywords #
2 |
3 | WIFI_PRO_V3 KEYWORD2
4 | _errorCode KEYWORD2
5 | _rtt KEYWORD2
6 | _value KEYWORD2
7 | _ip KEYWORD2
8 | _gw KEYWORD2
9 | _tcp_session_id KEYWORD2
10 | _channel KEYWORD2
11 | _snr KEYWORD2
12 | _buffer KEYWORD2
13 | _length KEYWORD2
14 | _netmask KEYWORD2
15 | _dns1 KEYWORD2
16 | _dns2 KEYWORD2
17 | _essid KEYWORD2
18 | _firmwareVersion KEYWORD2
19 | _httpSessionId KEYWORD2
20 | resetValues KEYWORD2
21 | configureMode KEYWORD2
22 | configureStation KEYWORD2
23 | configureAp KEYWORD2
24 | configureApSettings KEYWORD2
25 | connect KEYWORD2
26 | softReset KEYWORD2
27 | isConnected KEYWORD2
28 | isConnectedMultiple KEYWORD2
29 | ping KEYWORD2
30 | printErrorCode KEYWORD2
31 | printSockets KEYWORD2
32 | scan KEYWORD2
33 | setIP KEYWORD2
34 | getIP KEYWORD2
35 | setDNS KEYWORD2
36 | setGateway KEYWORD2
37 | setNetmask KEYWORD2
38 | setURL KEYWORD2
39 | getURL KEYWORD2
40 | post KEYWORD2
41 | sendFrameToMeshlium KEYWORD2
42 | tcpSend KEYWORD2
43 | tcpReceive KEYWORD2
44 | tcpClose KEYWORD2
45 | tcpSetClient KEYWORD2
46 | tcpSetServer KEYWORD2
47 | tcpWaitClientConnection KEYWORD2
48 | tcpCloseAllSockets KEYWORD2
49 | setUDP KEYWORD2
50 | closeDownSockets KEYWORD2
51 | getAllSocketStatus KEYWORD2
52 | getSocketStatus KEYWORD2
53 | setTimeServer KEYWORD2
54 | timeActivationFlag KEYWORD2
55 | setGMT KEYWORD2
56 | setTimeFromWIFI KEYWORD2
57 | requestOTA KEYWORD2
58 | roamingMode KEYWORD2
59 | getGateway KEYWORD2
60 | getNetmask KEYWORD2
61 | getDNS KEYWORD2
62 | getESSID KEYWORD2
63 | setCA KEYWORD2
64 | reportStatusComplete KEYWORD2
65 | setScanInterval KEYWORD2
66 | setLowThreshold KEYWORD2
67 | setHighThreshold KEYWORD2
68 | setWorkingMode KEYWORD2
69 | setServerPoolSize KEYWORD2
70 | socket KEYWORD2
71 | reportStatus KEYWORD2
72 | reportStatus4 KEYWORD2
73 | parseResponse KEYWORD2
74 | parseResponse2 KEYWORD2
75 | parseResponse3 KEYWORD2
76 | parseResponse4 KEYWORD2
77 | parseResponse5 KEYWORD2
78 | getResponseValue KEYWORD2
79 | getResponseValue2 KEYWORD2
80 | getResponseValue3 KEYWORD2
81 | getResponseValue4 KEYWORD2
82 | getResponseValue5 KEYWORD2
83 | changeBaudRate KEYWORD2
84 | userAbort KEYWORD2
85 | socketAbort KEYWORD2
86 | setContentType KEYWORD2
87 | reportStatus8 KEYWORD2
88 | httpConfiguration KEYWORD2
89 | getFirmwareVersion KEYWORD2
90 | sslHandshake KEYWORD2
91 |
92 | OPEN LITERAL1
93 | WEP64 LITERAL1
94 | WEP128 LITERAL1
95 | WPA LITERAL1
96 | WPA2 LITERAL1
97 | DHCP_DISABLED LITERAL1
98 | DHCP_ENABLED LITERAL1
99 | AUTOCONNECT_ENABLED LITERAL1
100 | AUTOCONNECT_DISABLED LITERAL1
101 |
102 | PROFILE_0 LITERAL1
103 | PROFILE_1 LITERAL1
104 | PROFILE_2 LITERAL1
105 | PROFILE_3 LITERAL1
106 | PROFILE_4 LITERAL1
107 | PROFILE_5 LITERAL1
108 | PROFILE_6 LITERAL1
109 | PROFILE_7 LITERAL1
110 | PROFILE_8 LITERAL1
111 | PROFILE_9 LITERAL1
112 | MODE_STATION LITERAL1
113 | MODE_ACCESS_POINT LITERAL1
114 | TYPE_SET_EQ LITERAL1
115 | TYPE_SET_DOT LITERAL1
116 | TYPE_ASSIGN LITERAL1
117 | TYPE_READ LITERAL1
118 | TYPE_ALLOWED LITERAL1
119 |
--------------------------------------------------------------------------------
/libraries/WIFI_PRO_V3/utility/wifi_error_codes.h:
--------------------------------------------------------------------------------
1 | /*! \file ati_error_codes.h
2 | \brief Definition of the possible error codes
3 |
4 | Copyright (C) 2021 Libelium Comunicaciones Distribuidas S.L.
5 | http:// www.libelium.com
6 |
7 | This program is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU Lesser General Public License as published by
9 | the Free Software Foundation, either version 2.1 of the License, or
10 | (at your option) any later version.
11 |
12 | This program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU Lesser General Public License for more details.
16 |
17 | You should have received a copy of the GNU Lesser General Public License
18 | along with this program. If not, see .
19 |
20 | Version: 3.0
21 | Implementation: Yuri Carmona
22 |
23 | */
24 |
25 | #ifndef ATI_ERRORCODE_H_
26 | #define ATI_ERRORCODE_H_
27 |
28 | //! CME ERROR CODES
29 | #define ERROR_CODE_0 3 // Common Waspmote API timeout error
30 | #define ERROR_CODE_3 3 // Common Waspmote API timeout error
31 | #define ERROR_CODE_902 902 // Waspmote API: SD not present
32 | #define ERROR_CODE_903 903 // Waspmote API: SD file not created
33 | #define ERROR_CODE_904 904 // Waspmote API: SD error opening file
34 | #define ERROR_CODE_905 905 // Waspmote API: SD error setting file offset
35 | #define ERROR_CODE_906 906 // Waspmote API: SD error writing
36 | #define ERROR_CODE_907 907 // Waspmote API: rx buffer full
37 | #define ERROR_CODE_908 908 // Waspmote API: error downloading UPGRADE.TXT
38 | #define ERROR_CODE_909 909 // Waspmote API: filename in UPGRADE.TXT is not a 7-byte name
39 | #define ERROR_CODE_910 910 // Waspmote API: no FILE label is found in UPGRADE.TXT
40 | #define ERROR_CODE_911 911 // Waspmote API: NO_FILE is defined as FILE in UPGRADE.TXT
41 | #define ERROR_CODE_912 912 // Waspmote API: no PATH label is found in UPGRADE.TXT
42 | #define ERROR_CODE_913 910 // Waspmote API: no SIZE label is found in UPGRADE.TXT
43 | #define ERROR_CODE_914 914 // Waspmote API: no VERSION label is found in UPGRADE.TXT
44 | #define ERROR_CODE_915 915 // Waspmote API: version indicated in UPGRADE.TXT is lower/equal to Waspmote's version
45 | #define ERROR_CODE_916 916 // Waspmote API: file size does not match the indicated in UPGRADE.TXT
46 | #define ERROR_CODE_917 917 // Waspmote API: error downloading binary file
47 | #define ERROR_CODE_918 918 // Waspmote API: invalid data length
48 | #define ERROR_CODE_919 919 // Illegal delimiter
49 | #define ERROR_CODE_920 920 // Illegal value
50 | #define ERROR_CODE_921 921 // CR expected
51 | #define ERROR_CODE_922 922 // Number expected
52 | #define ERROR_CODE_923 923 // CR or ‘,’ expected
53 | #define ERROR_CODE_924 924 // DNS expected
54 | #define ERROR_CODE_925 925 // ‘:’ or ‘~’ expected
55 | #define ERROR_CODE_926 926 // String expected
56 | #define ERROR_CODE_927 927 // ‘:’ or ‘=’ expected
57 | #define ERROR_CODE_928 928 // Text expected
58 | #define ERROR_CODE_929 929 // Syntax error
59 | #define ERROR_CODE_930 930 // ‘,’ expected
60 | #define ERROR_CODE_931 931 // Illegal command code
61 | #define ERROR_CODE_932 932 // Error when setting parameter
62 | #define ERROR_CODE_933 933 // Error when getting parameter value
63 |
64 | #endif /* ATI_ERRORCODE_H_ */
65 |
--------------------------------------------------------------------------------
/libraries/WaspAES/keywords.txt:
--------------------------------------------------------------------------------
1 | # AES Keywords #
2 |
3 | AES_128 LITERAL1
4 | AES_192 LITERAL1
5 | AES_256 LITERAL1
6 | ECB LITERAL1
7 | CBC LITERAL1
8 | PKCS5 LITERAL1
9 | ZEROS LITERAL1
10 |
11 | WaspAES KEYWORD2
12 | seedGenerator KEYWORD2
13 | printMatrix KEYWORD2
14 | printMessage KEYWORD2
15 | sizeOfBlocks KEYWORD2
16 | encrypt KEYWORD2
17 |
18 | AES KEYWORD1
19 |
20 | #keyschedule#
21 |
22 | aes_init KEYWORD2
23 | aes128_init KEYWORD2
24 | aes192_init KEYWORD2
25 | aes256_init KEYWORD2
26 |
27 | #enc#
28 | aes_encrypt_core KEYWORD2
29 | gmix_column KEYWORD2
30 | aes256_enc KEYWORD2
31 | aes192_enc KEYWORD2
32 | aes128_enc KEYWORD2
33 |
34 | #dec#
35 |
36 | aes_decrypt_core KEYWORD2
37 | gned char gmul KEYWORD2
38 | inv_mix_column KEYWORD2
39 | aes256_dec KEYWORD2
40 | aes192_dec KEYWORD2
41 | aes128_dec KEYWORD2
42 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes.h:
--------------------------------------------------------------------------------
1 | /* aes.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 | Modified by Y.Carmona for Libelium in 2014
6 |
7 | This program is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU General Public License as published by
9 | the Free Software Foundation, either version 3 of the License, or
10 | (at your option) any later version.
11 |
12 | This program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public License
18 | along with this program. If not, see .
19 | */
20 | /**
21 | * \file aes.h
22 | * \email daniel.otte@rub.de
23 | * \author Daniel Otte
24 | * \date 2008-12-30
25 | * \license GPLv3 or later
26 | *
27 | */
28 | #ifndef AES_H_
29 | #define AES_H_
30 |
31 | /*! Debug mode in order to enable messages from the library
32 | */
33 | //~ #define ENCRYPTION_DEBUG
34 |
35 |
36 | #include
37 |
38 | #include "aes_types.h"
39 | #include "aes128_enc.h"
40 | #include "aes128_dec.h"
41 | #include "aes192_enc.h"
42 | #include "aes192_dec.h"
43 | #include "aes256_enc.h"
44 | #include "aes256_dec.h"
45 | //#include "aes_enc.h"
46 | //#include "aes_dec.h"
47 | #include "aes_keyschedule.h"
48 |
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes128_dec.c:
--------------------------------------------------------------------------------
1 | /* aes128_dec.c */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes128_dec.c
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-30
24 | * \license GPLv3 or later
25 | *
26 | */
27 |
28 | #include "aes.h"
29 | #include "aes_dec.h"
30 |
31 | void aes128_dec(void* buffer, aes128_ctx_t* ctx){
32 | aes_decrypt_core(buffer, (aes_genctx_t*)ctx, 10);
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes128_dec.h:
--------------------------------------------------------------------------------
1 | /* aes128_dec.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes128_dec.h
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-30
24 | * \license GPLv3 or later
25 | * \ingroup AES
26 | */
27 |
28 | #ifndef AES128_DEC_H_
29 | #define AES128_DEC_H_
30 |
31 | #include "aes_types.h"
32 | #include "aes_dec.h"
33 | #ifdef __cplusplus
34 | extern "C"
35 | {
36 | #endif
37 | /**
38 | * \brief decrypt with 128 bit key.
39 | *
40 | * This function decrypts one block with the AES algorithm under control of
41 | * a keyschedule produced from a 128 bit key.
42 | * \param buffer pointer to the block to decrypt
43 | * \param ctx pointer to the key schedule
44 | */
45 | void aes128_dec(void* buffer, aes128_ctx_t* ctx);
46 | #ifdef __cplusplus
47 | }
48 | #endif
49 |
50 |
51 | #endif /* AES128_DEC_H_ */
52 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes128_enc.c:
--------------------------------------------------------------------------------
1 | /* aes128_enc.c */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes128_enc.c
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-30
24 | * \license GPLv3 or later
25 | *
26 | */
27 |
28 | #include "aes.h"
29 | #include "aes_enc.h"
30 |
31 |
32 | void aes128_enc(void* buffer, aes128_ctx_t* ctx){
33 | aes_encrypt_core(buffer, (aes_genctx_t*)ctx, 10);
34 | }
35 |
36 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes128_enc.h:
--------------------------------------------------------------------------------
1 | /* aes128_enc.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes128_enc.h
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-30
24 | * \license GPLv3 or later
25 | * \ingroup AES
26 | */
27 |
28 | #ifndef AES128_ENC_H_
29 | #define AES128_ENC_H_
30 |
31 | #include "aes_types.h"
32 | #include "aes_enc.h"
33 |
34 | #ifdef __cplusplus
35 | extern "C"
36 | {
37 | #endif
38 | /**
39 | * \brief encrypt with 128 bit key.
40 | *
41 | * This function encrypts one block with the AES algorithm under control of
42 | * a keyschedule produced from a 128 bit key.
43 | * \param buffer pointer to the block to encrypt
44 | * \param ctx pointer to the key schedule
45 | */
46 | void aes128_enc(void* buffer, aes128_ctx_t* ctx);
47 | #ifdef __cplusplus
48 | }
49 | #endif
50 |
51 |
52 | #endif /* AES128_ENC_H_ */
53 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes192_dec.c:
--------------------------------------------------------------------------------
1 | /* aes192_dec.c */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes192_dec.c
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-31
24 | * \license GPLv3 or later
25 | *
26 | */
27 |
28 | #include "aes.h"
29 | #include "aes_dec.h"
30 |
31 | void aes192_dec(void* buffer, aes192_ctx_t* ctx){
32 | aes_decrypt_core(buffer, (aes_genctx_t*)ctx, 12);
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes192_dec.h:
--------------------------------------------------------------------------------
1 | /* aes192_dec.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes192_dec.h
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-31
24 | * \license GPLv3 or later
25 | * \ingroup AES
26 | */
27 |
28 | #ifndef AES192_DEC_H_
29 | #define AES192_DEC_H_
30 |
31 | #include "aes_types.h"
32 | #include "aes_dec.h"
33 |
34 | #ifdef __cplusplus
35 | extern "C"
36 | {
37 | #endif
38 |
39 | /**
40 | * \brief decrypt with 192 bit key.
41 | *
42 | * This function decrypts one block with the AES algorithm under control of
43 | * a keyschedule produced from a 192 bit key.
44 | * \param buffer pointer to the block to decrypt
45 | * \param ctx pointer to the key schedule
46 | */
47 | void aes192_dec(void* buffer, aes192_ctx_t* ctx);
48 |
49 |
50 |
51 | #ifdef __cplusplus
52 | }
53 | #endif
54 |
55 |
56 | #endif /* AES192_ENC_H_ */
57 |
58 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes192_enc.c:
--------------------------------------------------------------------------------
1 | /* aes192_enc.c */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes192_enc.c
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-31
24 | * \license GPLv3 or later
25 | *
26 | */
27 |
28 | #include "aes.h"
29 | #include "aes_enc.h"
30 |
31 | void aes192_enc(void* buffer, aes192_ctx_t* ctx){
32 | aes_encrypt_core(buffer, (aes_genctx_t*)ctx, 12);
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes192_enc.h:
--------------------------------------------------------------------------------
1 | /* aes192_enc.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes192_enc.h
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-31
24 | * \license GPLv3 or later
25 | * \ingroup AES
26 | */
27 |
28 | #ifndef AES192_ENC_H_
29 | #define AES192_ENC_H_
30 |
31 | #include "aes_types.h"
32 | #include "aes_enc.h"
33 |
34 | #ifdef __cplusplus
35 | extern "C"
36 | {
37 | #endif
38 |
39 | /**
40 | * \brief encrypt with 192 bit key.
41 | *
42 | * This function encrypts one block with the AES algorithm under control of
43 | * a keyschedule produced from a 192 bit key.
44 | * \param buffer pointer to the block to encrypt
45 | * \param ctx pointer to the key schedule
46 | */
47 | void aes192_enc(void* buffer, aes192_ctx_t* ctx);
48 |
49 | #ifdef __cplusplus
50 | }
51 | #endif
52 |
53 |
54 | #endif /* AES192_ENC_H_ */
55 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes256_dec.c:
--------------------------------------------------------------------------------
1 | /* aes256_dec.c */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes256_dec.c
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-31
24 | * \license GPLv3 or later
25 | *
26 | */
27 |
28 | #include "aes.h"
29 | #include "aes_dec.h"
30 |
31 | void aes256_dec(void* buffer, aes256_ctx_t* ctx){
32 | aes_decrypt_core(buffer, (aes_genctx_t*)ctx, 14);
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes256_dec.h:
--------------------------------------------------------------------------------
1 | /* aes256_dec.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes256_dec.h
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-31
24 | * \license GPLv3 or later
25 | * \ingroup AES
26 | */
27 |
28 | #ifndef AES256_DEC_H_
29 | #define AES256_DEC_H_
30 |
31 | #include "aes_types.h"
32 | #include "aes_dec.h"
33 |
34 | #ifdef __cplusplus
35 | extern "C"
36 | {
37 | #endif
38 | /**
39 | * \brief decrypt with 256 bit key.
40 | *
41 | * This function decrypts one block with the AES algorithm under control of
42 | * a keyschedule produced from a 256 bit key.
43 | * \param buffer pointer to the block to decrypt
44 | * \param ctx pointer to the key schedule
45 | */
46 | void aes256_dec(void* buffer, aes256_ctx_t* ctx);
47 |
48 | #ifdef __cplusplus
49 | }
50 | #endif
51 |
52 | #endif /* AES256_DEC_H_ */
53 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes256_enc.c:
--------------------------------------------------------------------------------
1 | /* aes256_enc.c */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes256_enc.c
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-31
24 | * \license GPLv3 or later
25 | *
26 | */
27 |
28 | #include "aes.h"
29 | #include "aes_enc.h"
30 |
31 | void aes256_enc(void* buffer, aes256_ctx_t* ctx){
32 | aes_encrypt_core(buffer, (aes_genctx_t*)ctx, 14);
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes256_enc.h:
--------------------------------------------------------------------------------
1 | /* aes256_enc.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes256_enc.h
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-31
24 | * \license GPLv3 or later
25 | * \ingroup AES
26 | */
27 |
28 | #ifndef AES256_ENC_H_
29 | #define AES256_ENC_H_
30 |
31 | #include "aes_types.h"
32 | #include "aes_enc.h"
33 |
34 | #ifdef __cplusplus
35 | extern "C"
36 | {
37 | #endif
38 |
39 | /**
40 | * \brief encrypt with 256 bit key.
41 | *
42 | * This function encrypts one block with the AES algorithm under control of
43 | * a keyschedule produced from a 256 bit key.
44 | * \param buffer pointer to the block to encrypt
45 | * \param ctx pointer to the key schedule
46 | */
47 | void aes256_enc(void* buffer, aes256_ctx_t* ctx);
48 |
49 | #ifdef __cplusplus
50 | }
51 | #endif
52 |
53 | #endif /* AES256_ENC_H_ */
54 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes_dec.h:
--------------------------------------------------------------------------------
1 | /* aes_dec.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes_dec.h
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-30
24 | * \license GPLv3 or later
25 | *
26 | */
27 | #ifndef AES_DEC_H_
28 | #define AES_DEC_H_
29 | #include "aes_types.h"
30 | #include
31 |
32 |
33 | void aes_decrypt_core(aes_cipher_state_t* state,const aes_genctx_t* ks, uint8_t rounds);
34 | unsigned char gmul(unsigned char a, unsigned char b);
35 | void inv_mix_column(unsigned char *r);
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes_enc.h:
--------------------------------------------------------------------------------
1 | /* aes_enc.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes_enc.h
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-30
24 | * \license GPLv3 or later
25 | *
26 | */
27 | #ifndef AES_ENC_H_
28 | #define AES_ENC_H_
29 | #include "aes_types.h"
30 | #include
31 |
32 | void aes_encrypt_core(aes_cipher_state_t* state, const aes_genctx_t* ks, uint8_t rounds);
33 | void gmix_column(unsigned char *r);
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes_invsbox.c:
--------------------------------------------------------------------------------
1 | /* aes inverted sbox */
2 |
3 | #include
4 | #include
5 | const uint8_t aes_invsbox[256] PROGMEM = {
6 | 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb,
7 | 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb,
8 | 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e,
9 | 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25,
10 | 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92,
11 | 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84,
12 | 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06,
13 | 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b,
14 | 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73,
15 | 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e,
16 | 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b,
17 | 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4,
18 | 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f,
19 | 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef,
20 | 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61,
21 | 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d
22 | };
23 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes_invsbox.h:
--------------------------------------------------------------------------------
1 | /* aes_invsbox.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes_invsbox.h
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-30
24 | * \license GPLv3 or later
25 | *
26 | */
27 | #ifndef AES_INVSBOX_H_
28 | #define AES_INVSBOX_H_
29 | #include
30 |
31 | extern uint8_t aes_invsbox[];
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes_keyschedule.c:
--------------------------------------------------------------------------------
1 | /* aes_keyschedule.c */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008, 2009 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes_keyschedule.c
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-30
24 | * \license GPLv3 or later
25 | *
26 | */
27 |
28 | #include
29 | #include "aes.h"
30 | #include "aes_keyschedule.h"
31 | #include "aes_sbox.h"
32 | #include
33 | #include
34 |
35 | static
36 | void aes_rotword(void* a){
37 | uint8_t t;
38 | t=((uint8_t*)a)[0];
39 | ((uint8_t*)a)[0] = ((uint8_t*)a)[1];
40 | ((uint8_t*)a)[1] = ((uint8_t*)a)[2];
41 | ((uint8_t*)a)[2] = ((uint8_t*)a)[3];
42 | ((uint8_t*)a)[3] = t;
43 | }
44 |
45 | const uint8_t rc_tab[] PROGMEM = { 0x01, 0x02, 0x04, 0x08,
46 | 0x10, 0x20, 0x40, 0x80,
47 | 0x1b, 0x36 };
48 |
49 | void aes_init(const void* key, uint16_t keysize_b, aes_genctx_t* ctx)
50 | {
51 | uint8_t hi,i,nk, next_nk;
52 | uint8_t rc=0;
53 | union
54 | {
55 | uint32_t v32;
56 | uint8_t v8[4];
57 | } tmp;
58 | nk=keysize_b>>5; /* 4, 6, 8 */
59 | hi=4*(nk+6+1);
60 | memcpy(ctx, key, keysize_b/8);
61 | next_nk = nk;
62 | for(i=nk;ikey[0].ks))[i-1];
65 | if(i!=next_nk)
66 | {
67 | if(nk==8 && i%8==4)
68 | {
69 | tmp.v8[0] = pgm_read_byte(aes_sbox+tmp.v8[0]);
70 | tmp.v8[1] = pgm_read_byte(aes_sbox+tmp.v8[1]);
71 | tmp.v8[2] = pgm_read_byte(aes_sbox+tmp.v8[2]);
72 | tmp.v8[3] = pgm_read_byte(aes_sbox+tmp.v8[3]);
73 | }
74 | }
75 | else
76 | {
77 | next_nk += nk;
78 | aes_rotword(&(tmp.v32));
79 | tmp.v8[0] = pgm_read_byte(aes_sbox+tmp.v8[0]);
80 | tmp.v8[1] = pgm_read_byte(aes_sbox+tmp.v8[1]);
81 | tmp.v8[2] = pgm_read_byte(aes_sbox+tmp.v8[2]);
82 | tmp.v8[3] = pgm_read_byte(aes_sbox+tmp.v8[3]);
83 | tmp.v8[0] ^= pgm_read_byte(rc_tab+rc);
84 | rc++;
85 | }
86 | ((uint32_t*)(ctx->key[0].ks))[i] = ((uint32_t*)(ctx->key[0].ks))[i-nk]
87 | ^ tmp.v32;
88 | }
89 | }
90 |
91 | void aes128_init(const void* key, aes128_ctx_t* ctx){
92 | aes_init(key, 128, (aes_genctx_t*)ctx);
93 |
94 | }
95 |
96 | void aes192_init(const void* key, aes192_ctx_t* ctx){
97 | aes_init(key, 192, (aes_genctx_t*)ctx);
98 | }
99 |
100 | void aes256_init(const void* key, aes256_ctx_t* ctx){
101 | aes_init(key, 256, (aes_genctx_t*)ctx);
102 | }
103 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes_keyschedule.h:
--------------------------------------------------------------------------------
1 | /* aes_keyschedule.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes_keyschedule.h
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-30
24 | * \license GPLv3 or later
25 | * \ingroup AES
26 | */
27 |
28 |
29 | #ifndef AES_KEYSCHEDULE_H_
30 | #define AES_KEYSCHEDULE_H_
31 |
32 | #include "aes_types.h"
33 |
34 | #ifdef __cplusplus
35 | extern "C"
36 | {
37 | #endif
38 | /**
39 | * \brief initialize the keyschedule
40 | *
41 | * This function computes the keyschedule from a given key with a given length
42 | * and stores it in the context variable
43 | * \param key pointer to the key material
44 | * \param keysize_b length of the key in bits (valid are 128, 192 and 256)
45 | * \param ctx pointer to the context where the keyschedule should be stored
46 | */
47 | void aes_init(const void* key, uint16_t keysize_b, aes_genctx_t* ctx);
48 |
49 | /**
50 | * \brief initialize the keyschedule for 128 bit key
51 | *
52 | * This function computes the keyschedule from a given 128 bit key
53 | * and stores it in the context variable
54 | * \param key pointer to the key material
55 | * \param ctx pointer to the context where the keyschedule should be stored
56 | */
57 | void aes128_init(const void* key, aes128_ctx_t* ctx);
58 |
59 | /**
60 | * \brief initialize the keyschedule for 192 bit key
61 | *
62 | * This function computes the keyschedule from a given 192 bit key
63 | * and stores it in the context variable
64 | * \param key pointer to the key material
65 | * \param ctx pointer to the context where the keyschedule should be stored
66 | */
67 | void aes192_init(const void* key, aes192_ctx_t* ctx);
68 |
69 | /**
70 | * \brief initialize the keyschedule for 256 bit key
71 | *
72 | * This function computes the keyschedule from a given 256 bit key
73 | * and stores it in the context variable
74 | * \param key pointer to the key material
75 | * \param ctx pointer to the context where the keyschedule should be stored
76 | */
77 | void aes256_init(const void* key, aes256_ctx_t* ctx);
78 |
79 | #ifdef __cplusplus
80 | }
81 | #endif
82 |
83 | #endif /* AES_KEYSCHEDULE_H_ */
84 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes_sbox.c:
--------------------------------------------------------------------------------
1 | /* aes sbox */
2 |
3 | #include
4 | #include
5 | const uint8_t aes_sbox[256] PROGMEM = {
6 | 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
7 | 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
8 | 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
9 | 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
10 | 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
11 | 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
12 | 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
13 | 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
14 | 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
15 | 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
16 | 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
17 | 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
18 | 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
19 | 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
20 | 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
21 | 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
22 | };
23 |
24 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes_sbox.h:
--------------------------------------------------------------------------------
1 | /* aes_sbox.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes_sbox.h
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-30
24 | * \license GPLv3 or later
25 | *
26 | */
27 | #ifndef AES_SBOX_H_
28 | #define AES_SBOX_H_
29 | #include
30 |
31 | extern uint8_t aes_sbox[];
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/libraries/WaspAES/utility/aes_types.h:
--------------------------------------------------------------------------------
1 | /* aes.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file aes_types.h
21 | * \email daniel.otte@rub.de
22 | * \author Daniel Otte
23 | * \date 2008-12-30
24 | * \license GPLv3 or later
25 | *
26 | */
27 | #ifndef AES_TYPES_H_
28 | #define AES_TYPES_H_
29 |
30 | #include
31 |
32 | typedef struct{
33 | uint8_t ks[16];
34 | } aes_roundkey_t;
35 |
36 | typedef struct{
37 | aes_roundkey_t key[10+1];
38 | } aes128_ctx_t;
39 |
40 | typedef struct{
41 | aes_roundkey_t key[12+1];
42 | } aes192_ctx_t;
43 |
44 | typedef struct{
45 | aes_roundkey_t key[14+1];
46 | } aes256_ctx_t;
47 |
48 | typedef struct{
49 | aes_roundkey_t key[1]; /* just to avoid the warning */
50 | } aes_genctx_t;
51 |
52 | typedef struct{
53 | uint8_t s[16];
54 | } aes_cipher_state_t;
55 |
56 | #endif
57 |
--------------------------------------------------------------------------------
/libraries/WaspHash/WaspHash.cpp:
--------------------------------------------------------------------------------
1 | /*!
2 | * Library for managing the HASH encryption library
3 | *
4 | * Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
5 | * http://www.libelium.com
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 2.1 of the License, or
10 | * (at your option) any later version.
11 |
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 |
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | *
20 | * Version: 3.0
21 | * Design: David Gascón
22 | * Implementation: Alvaro Gonzalez, Yuri Carmona
23 | *
24 | */
25 |
26 | #ifndef __WPROGRAM_H__
27 | #include "WaspClasses.h"
28 | #endif
29 |
30 |
31 | #include "WaspHash.h"
32 |
33 | /*******************************************************************************
34 | * Class methods
35 | *******************************************************************************/
36 |
37 | /// Constructors ///////////////////////////////////////////////////////
38 | WaspHash::WaspHash()
39 | {
40 | // nothing to do here
41 | }
42 |
43 |
44 | void WaspHash::printMessageDigest( char* algorithm
45 | , uint8_t* hash
46 | , uint8_t size)
47 | {
48 | USB.print(algorithm);
49 | USB.print(F("\""));
50 |
51 | // print hash string in HEX format
52 | for (uint8_t i=0; i.
19 |
20 | Version: 3.0
21 | Design: David Gascón
22 | Implementation: Alvaro Gonzalez, Yuri Carmona
23 |
24 | */
25 | #ifndef WaspHash_h
26 | #define WaspHash_h
27 |
28 | #include
29 | #include "utility/md5.h"
30 | #include "utility/md5_sbox.h"
31 | #include "utility/sha1.h"
32 | #include "utility/sha224.h"
33 | #include "utility/sha256.h"
34 | #include "utility/sha384.h"
35 | #include "utility/sha512.h"
36 | #include "utility/sha2_small_common.h"
37 | #include "utility/sha2_large_common.h"
38 |
39 | /*******************************************************************************
40 | * Definitions & Declarations
41 | ******************************************************************************/
42 | #define SHA1 1
43 | #define SHA224 2
44 | #define SHA256 3
45 | #define SHA384 4
46 | #define SHA512 5
47 |
48 | /******************************************************************************
49 | * Class
50 | ******************************************************************************/
51 |
52 | //! WaspHash Class
53 | /*!
54 | WaspHash Class defines all the variables and functions used to manage
55 | different hash algorithm
56 | */
57 |
58 | class WaspHash{
59 |
60 | private:
61 |
62 |
63 |
64 | public:
65 | //! class constructor
66 | /*!
67 | \param void
68 | \return void
69 | */
70 | WaspHash();
71 |
72 | void printMessageDigest(char* algorithm,uint8_t* hash,uint8_t size);
73 |
74 | //! Its refers to calculate MD5 Algorithm
75 | /*!
76 | takes as input a message of arbitrary length and produces as output
77 | a 128-bit "fingerprint" or "message digest" of the input
78 |
79 | \param hash_message variable which to store message digest
80 | \param message message original
81 | \param size_message size of original message
82 | \return void
83 | */
84 | void md5( uint8_t hash_message[],
85 | uint8_t* message,
86 | uint32_t size_message);
87 |
88 | //! Its refers to calculate SHA Algorithms
89 | /*!
90 | takes as input a message of arbitrary length and produces as output
91 | a 128-bit, 160-bit, 224-bit, 256-bit, 384-bit, 512-bit
92 | "fingerprint" or "message digest" of the input
93 |
94 | \param alg variable to select SHA Algoritm
95 | \param hash_message variable which to store message digest
96 | \param message message original
97 | \param size_message size of original message
98 | \return void
99 | */
100 | void sha( uint8_t alg,
101 | uint8_t hash_message[],
102 | uint8_t* message,
103 | uint32_t size_message);
104 |
105 | };
106 |
107 | extern WaspHash HASH;
108 |
109 | #endif
110 |
--------------------------------------------------------------------------------
/libraries/WaspHash/keywords.txt:
--------------------------------------------------------------------------------
1 | # Hash Keywords #
2 |
3 | SHA1 LITERAL1
4 | SHA224 LITERAL1
5 | SHA256 LITERAL1
6 | SHA384 LITERAL1
7 | SHA512 LITERAL1
8 |
9 | WaspHash KEYWORD2
10 | printMessageDigest KEYWORD2
11 | md5 KEYWORD2
12 | sha KEYWORD2
13 |
14 | HASH KEYWORD1
15 |
16 |
17 | #md5#
18 |
19 | MD5_HASH_BITS LITERAL1
20 | MD5_HASH_BYTES LITERAL1
21 | MD5_BLOCK_BITS LITERAL1
22 | MD5_BLOCK_BYTES LITERAL1
23 |
24 | md5_init KEYWORD2
25 | md5_nextBlock KEYWORD2
26 | md5_lastBlock KEYWORD2
27 | md5_ctx2hash KEYWORD2
28 | md5_1 KEYWORD2
29 |
30 |
31 | #sha1#
32 |
33 | SHA1_HASH_BITS LITERAL1
34 | SHA1_HASH_BYTES LITERAL1
35 | SHA1_BLOCK_BITS LITERAL1
36 | SHA1_BLOCK_BYTES LITERAL1
37 |
38 | sha1_init KEYWORD2
39 | sha1_nextBlock KEYWORD2
40 | sha1_lastBlock KEYWORD2
41 | sha1_ctx2hash KEYWORD2
42 | sha1_1 KEYWORD2
43 |
44 |
45 | #sha2#
46 |
47 | sha2_large_common_nextBlock KEYWORD2
48 | sha2_large_common_lastBlock KEYWORD2
49 | sha2_small_common_nextBlock KEYWORD2
50 | sha2_small_common_lastBlock KEYWORD2
51 |
52 |
53 | #sha224#
54 |
55 | SHA224_HASH_BITS LITERAL1
56 | SHA224_HASH_BYTES LITERAL1
57 | SHA224_BLOCK_BITS LITERAL1
58 | SHA224_BLOCK_BYTES LITERAL1
59 |
60 | sha224_init KEYWORD2
61 | sha224_nextBlock KEYWORD2
62 | sha224_lastBlock KEYWORD2
63 | sha224_ctx2hash KEYWORD2
64 | sha224_1 KEYWORD2
65 |
66 |
67 | #sha256#
68 |
69 | SHA256_HASH_BITS LITERAL1
70 | SHA256_HASH_BYTES LITERAL1
71 | SHA256_BLOCK_BITS LITERAL1
72 | SHA256_BLOCK_BYTES LITERAL1
73 |
74 | sha256_init KEYWORD2
75 | sha256_nextBlock KEYWORD2
76 | sha256_lastBlock KEYWORD2
77 | sha256_ctx2hash KEYWORD2
78 | sha256_1 KEYWORD2
79 |
80 |
81 | #sha384#
82 |
83 | SHA384_HASH_BITS LITERAL1
84 | SHA384_HASH_BYTES LITERAL1
85 | SHA384_BLOCK_BITS LITERAL1
86 | SHA3842_BLOCK_BYTES LITERAL1
87 |
88 | sha384_init KEYWORD2
89 | sha384_nextBlock KEYWORD2
90 | sha384_lastBlock KEYWORD2
91 | sha384_ctx2hash KEYWORD2
92 | sha384_1 KEYWORD2
93 |
94 |
95 | #sha512#
96 |
97 | SHA512_HASH_BITS
98 | SHA512_HASH_BYTES
99 | SHA512_BLOCK_BITS
100 | SHA5122_BLOCK_BYTES
101 |
102 | sha512_init KEYWORD2
103 | sha512_nextBlock KEYWORD2
104 | sha512_lastBlock KEYWORD2
105 | sha512_ctx2hash KEYWORD2
106 | sha512_1 KEYWORD2
107 |
--------------------------------------------------------------------------------
/libraries/WaspHash/utility/md5.h:
--------------------------------------------------------------------------------
1 | /* md5.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /*
20 | * File: md5.h
21 | * Author: Daniel Otte
22 | * Date: 31.07.2006
23 | * License: GPL
24 | * Description: Implementation of the MD5 hash algorithm as described in RFC 1321
25 | *
26 | */
27 |
28 |
29 | #ifndef MD5_H_
30 | #define MD5_H_
31 |
32 | #include
33 |
34 | #ifdef __cplusplus
35 | extern "C"
36 | {
37 | #endif
38 |
39 | #define MD5_HASH_BITS 128
40 | #define MD5_HASH_BYTES (MD5_HASH_BITS/8)
41 | #define MD5_BLOCK_BITS 512
42 | #define MD5_BLOCK_BYTES (MD5_BLOCK_BITS/8)
43 |
44 |
45 | typedef struct md5_ctx_st {
46 | uint32_t a[4];
47 | uint32_t counter;
48 | } md5_ctx_t;
49 |
50 | typedef uint8_t md5_hash_t[MD5_HASH_BYTES];
51 |
52 |
53 | void md5_init(md5_ctx_t *s);
54 | void md5_nextBlock(md5_ctx_t *state, const void* block);
55 | void md5_lastBlock(md5_ctx_t *state, const void* block, uint16_t length);
56 | void md5_ctx2hash(md5_hash_t* dest, const md5_ctx_t* state);
57 | void md5_1(md5_hash_t* dest, const void* msg, uint32_t length_b);
58 |
59 | #ifdef __cplusplus
60 | }
61 | #endif
62 |
63 | #endif /*MD5_H_*/
64 |
--------------------------------------------------------------------------------
/libraries/WaspHash/utility/md5_sbox.c:
--------------------------------------------------------------------------------
1 | /* md5_sbox.c */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | #include
20 | #include
21 |
22 | const uint32_t md5_T[] PROGMEM = {
23 | 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, 0xf57c0faf,
24 | 0x4787c62a, 0xa8304613, 0xfd469501, 0x698098d8, 0x8b44f7af,
25 | 0xffff5bb1, 0x895cd7be, 0x6b901122, 0xfd987193, 0xa679438e,
26 | 0x49b40821, 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,
27 | 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, 0x21e1cde6,
28 | 0xc33707d6, 0xf4d50d87, 0x455a14ed, 0xa9e3e905, 0xfcefa3f8,
29 | 0x676f02d9, 0x8d2a4c8a, 0xfffa3942, 0x8771f681, 0x6d9d6122,
30 | 0xfde5380c, 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
31 | 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, 0xd9d4d039,
32 | 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, 0xf4292244, 0x432aff97,
33 | 0xab9423a7, 0xfc93a039, 0x655b59c3, 0x8f0ccc92, 0xffeff47d,
34 | 0x85845dd1, 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
35 | 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 };
36 |
37 |
--------------------------------------------------------------------------------
/libraries/WaspHash/utility/md5_sbox.h:
--------------------------------------------------------------------------------
1 | /* md5_sbox.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | #ifndef MD5_SBOX_H_
20 | #define MD5_SBOX_H_
21 |
22 | #include
23 | #include
24 |
25 | extern const uint32_t md5_T[];
26 |
27 | #endif /*MD5_SBOX_H_*/
28 |
--------------------------------------------------------------------------------
/libraries/WaspHash/utility/sha1.h:
--------------------------------------------------------------------------------
1 | /* sha1.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file sha1.h
21 | * \author Daniel Otte
22 | * \email daniel.otte@rub.de
23 | * \date 2006-10-08
24 | * \license GPLv3 or later
25 | * \brief SHA-1 declaration.
26 | * \ingroup SHA-1
27 | *
28 | */
29 |
30 | #ifndef SHA1_H_
31 | #define SHA1_H_
32 |
33 | #include
34 |
35 | #ifdef __cplusplus
36 | extern "C"
37 | {
38 | #endif
39 | /** \def SHA1_HASH_BITS
40 | * definees the size of a SHA-1 hash in bits
41 | */
42 |
43 | /** \def SHA1_HASH_BYTES
44 | * definees the size of a SHA-1 hash in bytes
45 | */
46 |
47 | /** \def SHA1_BLOCK_BITS
48 | * definees the size of a SHA-1 input block in bits
49 | */
50 |
51 | /** \def SHA1_BLOCK_BYTES
52 | * definees the size of a SHA-1 input block in bytes
53 | */
54 | #define SHA1_HASH_BITS 160
55 | #define SHA1_HASH_BYTES (SHA1_HASH_BITS/8)
56 | #define SHA1_BLOCK_BITS 512
57 | #define SHA1_BLOCK_BYTES (SHA1_BLOCK_BITS/8)
58 |
59 | /** \typedef sha1_ctx_t
60 | * \brief SHA-1 context type
61 | *
62 | * A vatiable of this type may hold the state of a SHA-1 hashing process
63 | */
64 | typedef struct {
65 | uint32_t h[5];
66 | uint64_t length;
67 | } sha1_ctx_t;
68 |
69 | /** \typedef sha1_hash_t
70 | * \brief hash value type
71 | * A variable of this type may hold a SHA-1 hash value
72 | */
73 | typedef uint8_t sha1_hash_t[SHA1_HASH_BITS/8];
74 |
75 | /** \fn sha1_init(sha1_ctx_t *state)
76 | * \brief initializes a SHA-1 context
77 | * This function sets a ::sha1_ctx_t variable to the initialization vector
78 | * for SHA-1 hashing.
79 | * \param state pointer to the SHA-1 context variable
80 | */
81 | void sha1_init(sha1_ctx_t *state);
82 |
83 | /** \fn sha1_nextBlock(sha1_ctx_t *state, const void* block)
84 | * \brief process one input block
85 | * This function processes one input block and updates the hash context
86 | * accordingly
87 | * \param state pointer to the state variable to update
88 | * \param block pointer to the message block to process
89 | */
90 | void sha1_nextBlock (sha1_ctx_t *state, const void* block);
91 |
92 | /** \fn sha1_lastBlock(sha1_ctx_t *state, const void* block, uint16_t length_b)
93 | * \brief processes the given block and finalizes the context
94 | * This function processes the last block in a SHA-1 hashing process.
95 | * The block should have a maximum length of a single input block.
96 | * \param state pointer to the state variable to update and finalize
97 | * \param block pointer to themessage block to process
98 | * \param length_b length of the message block in bits
99 | */
100 | void sha1_lastBlock (sha1_ctx_t *state, const void* block, uint16_t length_b);
101 |
102 | /** \fn sha1_ctx2hash(sha1_hash_t *dest, sha1_ctx_t *state)
103 | * \brief convert a state variable into an actual hash value
104 | * Writes the hash value corresponding to the state to the memory pointed by dest.
105 | * \param dest pointer to the hash value destination
106 | * \param state pointer to the hash context
107 | */
108 | void sha1_ctx2hash (sha1_hash_t *dest, sha1_ctx_t *state);
109 |
110 | /** \fn sha1(sha1_hash_t *dest, const void* msg, uint32_t length_b)
111 | * \brief hashing a message which in located entirely in RAM
112 | * This function automatically hashes a message which is entirely in RAM with
113 | * the SHA-1 hashing algorithm.
114 | * \param dest pointer to the hash value destination
115 | * \param msg pointer to the message which should be hashed
116 | * \param length_b length of the message in bits
117 | */
118 | void sha1_1(sha1_hash_t *dest, const void* msg, uint32_t length_b);
119 |
120 | #ifdef __cplusplus
121 | }
122 | #endif
123 |
124 | #endif /*SHA1_H_*/
125 |
--------------------------------------------------------------------------------
/libraries/WaspHash/utility/sha224.c:
--------------------------------------------------------------------------------
1 | /* sha224.c */
2 | /*
3 | This file is part of the ARM-Crypto-Lib.
4 | Copyright (C) 2006-2010 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file sha224.c
21 | * \author Daniel Otte
22 | * \date 16.05.2006
23 | *
24 | * \par License:
25 | * GPL
26 | *
27 | * \brief SHA-224 implementation.
28 | *
29 | *
30 | */
31 |
32 | #include
33 | #include /* for memcpy, memmove, memset */
34 | #include
35 | #include "sha2_small_common.h"
36 | #include "sha224.h"
37 |
38 | #define LITTLE_ENDIAN
39 |
40 | #if defined LITTLE_ENDIAN
41 | #elif defined BIG_ENDIAN
42 | #else
43 | #error specify endianess!!!
44 | #endif
45 |
46 |
47 | /*************************************************************************/
48 |
49 | const
50 | uint32_t sha224_init_vector[] PROGMEM = {
51 | 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
52 | 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4
53 | };
54 |
55 |
56 | /*************************************************************************/
57 |
58 | /**
59 | * \brief \c sh224_init initialises a sha224 context for hashing.
60 | * \c sh224_init c initialises the given sha224 context for hashing
61 | * @param state pointer to a sha224 context
62 | * @return none
63 | */
64 | void sha224_init(sha224_ctx_t *state){
65 | state->length=0;
66 | memcpy_P(state->h, sha224_init_vector, 8*4);
67 | }
68 |
69 | /*************************************************************************/
70 | void sha224_nextBlock (sha224_ctx_t *state, const void* block){
71 | sha2_small_common_nextBlock(state, block);
72 | }
73 |
74 | /*************************************************************************/
75 | void sha224_lastBlock (sha224_ctx_t *state, const void* block, uint16_t length_b){
76 | sha2_small_common_lastBlock(state, block, length_b);
77 | }
78 | /*************************************************************************/
79 |
80 | /**
81 | * \brief function to process the last block being hashed
82 | * @param state Pointer to the context in which this block should be processed.
83 | * @param block Pointer to the message wich should be hashed.
84 | * @param length is the length of only THIS block in BITS not in bytes!
85 | * bits are big endian, meaning high bits come first.
86 | * if you have a message with bits at the end, the byte must be padded with zeros
87 | */
88 |
89 | /*************************************************************************/
90 |
91 | /*
92 | * length in bits!
93 | */
94 | void sha224_1(sha224_hash_t* dest, const void* msg, uint32_t length_b){ /* length could be choosen longer but this is for µC */
95 | sha224_ctx_t s;
96 | sha224_init(&s);
97 | while(length_b >= SHA224_BLOCK_BITS){
98 | sha224_nextBlock(&s, msg);
99 | msg = (uint8_t*)msg + SHA224_BLOCK_BITS/8;
100 | length_b -= SHA224_BLOCK_BITS;
101 | }
102 | sha224_lastBlock(&s, msg, length_b);
103 | sha224_ctx2hash(dest,&s);
104 | }
105 |
106 |
107 |
108 | /*************************************************************************/
109 |
110 | void sha224_ctx2hash(sha224_hash_t* dest, const sha224_ctx_t *state){
111 | #if defined LITTLE_ENDIAN
112 | uint8_t i, j, *s=(uint8_t*)(state->h);
113 | i=7;
114 | do{
115 | j=3;
116 | do{
117 | *((uint8_t*)dest) = s[j];
118 | dest = (uint8_t*)dest + 1;
119 | }while(j--);
120 | s += 4;
121 | }while(--i);
122 | #elif BIG_ENDIAN
123 | memcpy(dest, state->h, 28);
124 | #else
125 | # error unsupported endian type!
126 | #endif
127 | }
128 |
129 |
130 |
--------------------------------------------------------------------------------
/libraries/WaspHash/utility/sha256.c:
--------------------------------------------------------------------------------
1 | /* sha256.c */
2 | /*
3 | This file is part of the ARM-Crypto-Lib.
4 | Copyright (C) 2006-2010 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file sha256.c
21 | * \author Daniel Otte
22 | * \date 16.05.2006
23 | *
24 | * \par License:
25 | * GPL
26 | *
27 | * \brief SHA-256 implementation.
28 | *
29 | *
30 | */
31 |
32 | #include
33 | #include /* for memcpy, memmove, memset */
34 | #include
35 | #include "sha2_small_common.h"
36 | #include "sha256.h"
37 |
38 | #define LITTLE_ENDIAN
39 |
40 | #if defined LITTLE_ENDIAN
41 | #elif defined BIG_ENDIAN
42 | #else
43 | #error specify endianess!!!
44 | #endif
45 |
46 |
47 | /*************************************************************************/
48 |
49 | const
50 | uint32_t sha256_init_vector[] PROGMEM = {
51 | 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A,
52 | 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 };
53 |
54 |
55 | /*************************************************************************/
56 |
57 | /**
58 | * \brief \c sh256_init initialises a sha256 context for hashing.
59 | * \c sh256_init c initialises the given sha256 context for hashing
60 | * @param state pointer to a sha256 context
61 | * @return none
62 | */
63 | void sha256_init(sha256_ctx_t *state){
64 | state->length=0;
65 | memcpy_P(state->h, sha256_init_vector, 8*4);
66 | }
67 |
68 | /*************************************************************************/
69 | void sha256_nextBlock (sha256_ctx_t *state, const void* block){
70 | sha2_small_common_nextBlock(state, block);
71 | }
72 |
73 | /*************************************************************************/
74 | void sha256_lastBlock (sha256_ctx_t *state, const void* block, uint16_t length_b){
75 | sha2_small_common_lastBlock(state, block, length_b);
76 | }
77 | /*************************************************************************/
78 |
79 | /**
80 | * \brief function to process the last block being hashed
81 | * @param state Pointer to the context in which this block should be processed.
82 | * @param block Pointer to the message wich should be hashed.
83 | * @param length is the length of only THIS block in BITS not in bytes!
84 | * bits are big endian, meaning high bits come first.
85 | * if you have a message with bits at the end, the byte must be padded with zeros
86 | */
87 |
88 | /*************************************************************************/
89 |
90 | /*
91 | * length in bits!
92 | */
93 | void sha256_1(sha256_hash_t* dest, const void* msg, uint32_t length_b){ /* length could be choosen longer but this is for µC */
94 | sha256_ctx_t s;
95 | sha256_init(&s);
96 | while(length_b >= SHA256_BLOCK_BITS){
97 | sha256_nextBlock(&s, msg);
98 | msg = (uint8_t*)msg + SHA256_BLOCK_BITS/8;
99 | length_b -= SHA256_BLOCK_BITS;
100 | }
101 | sha256_lastBlock(&s, msg, length_b);
102 | sha256_ctx2hash(dest,&s);
103 | }
104 |
105 |
106 |
107 | /*************************************************************************/
108 |
109 | void sha256_ctx2hash(sha256_hash_t* dest, const sha256_ctx_t *state){
110 | #if defined LITTLE_ENDIAN
111 | uint8_t i, j, *s=(uint8_t*)(state->h);
112 | i=8;
113 | do{
114 | j=3;
115 | do{
116 | *((uint8_t*)dest) = s[j];
117 | dest = (uint8_t*)dest + 1;
118 | }while(j--);
119 | s += 4;
120 | }while(--i);
121 | #elif BIG_ENDIAN
122 | memcpy(dest, state->h, 32);
123 | #else
124 | # error unsupported endian type!
125 | #endif
126 | }
127 |
128 |
129 |
--------------------------------------------------------------------------------
/libraries/WaspHash/utility/sha256.h:
--------------------------------------------------------------------------------
1 | /* sha256.h */
2 | /*
3 | This file is part of the ARM-Crypto-Lib.
4 | Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | /**
20 | * \file sha256.h
21 | * \author Daniel Otte
22 | * \date 2006-05-16
23 | * \license GPLv3 or later
24 | *
25 | */
26 |
27 | #ifndef SHA256_H_
28 | #define SHA256_H_
29 |
30 | #include
31 | #include "sha2_small_common.h"
32 |
33 | #ifdef __cplusplus
34 | extern "C"
35 | {
36 | #endif
37 | /** \def SHA256_HASH_BITS
38 | * defines the size of a SHA-256 hash value in bits
39 | */
40 |
41 | /** \def SHA256_HASH_BYTES
42 | * defines the size of a SHA-256 hash value in bytes
43 | */
44 |
45 | /** \def SHA256_BLOCK_BITS
46 | * defines the size of a SHA-256 input block in bits
47 | */
48 |
49 | /** \def SHA256_BLOCK_BYTES
50 | * defines the size of a SHA-256 input block in bytes
51 | */
52 |
53 | #define SHA256_HASH_BITS 256
54 | #define SHA256_HASH_BYTES (SHA256_HASH_BITS/8)
55 | #define SHA256_BLOCK_BITS 512
56 | #define SHA256_BLOCK_BYTES (SHA256_BLOCK_BITS/8)
57 |
58 | /** \typedef sha256_ctx_t
59 | * \brief SHA-256 context type
60 | *
61 | * A variable of this type may hold the state of a SHA-256 hashing process
62 | */
63 | typedef sha2_small_common_ctx_t sha256_ctx_t;
64 |
65 | typedef uint8_t sha256_hash_t[SHA256_HASH_BITS/8];
66 | /** \fn void sha256_init(sha256_ctx_t *state)
67 | * \brief initialize a SHA-256 context
68 | *
69 | * This function sets a ::sha256_ctx_t to the initial values for hashing.
70 | * \param state pointer to the SHA-256 hashing context
71 | */
72 | void sha256_init(sha256_ctx_t *state);
73 |
74 | /** \fn void sha256_nextBlock (sha256_ctx_t* state, const void* block)
75 | * \brief update the context with a given block
76 | *
77 | * This function updates the SHA-256 hash context by processing the given block
78 | * of fixed length.
79 | * \param state pointer to the SHA-256 hash context
80 | * \param block pointer to the block of fixed length (512 bit = 64 byte)
81 | */
82 | void sha256_nextBlock (sha256_ctx_t* state, const void* block);
83 |
84 | /** \fn void sha256_lastBlock(sha256_ctx_t* state, const void* block, uint16_t length_b)
85 | * \brief finalize the context with the given block
86 | *
87 | * This function finalizes the SHA-256 hash context by processing the given block
88 | * of variable length.
89 | * \param state pointer to the SHA-256 hash context
90 | * \param block pointer to the block of fixed length (512 bit = 64 byte)
91 | * \param length_b the length of the block in bits
92 | */
93 | void sha256_lastBlock(sha256_ctx_t* state, const void* block, uint16_t length_b);
94 |
95 | /** \fn void sha256_ctx2hash(sha256_hash_t* dest, const sha256_ctx_t* state)
96 | * \brief convert the hash state into the hash value
97 | * This function reads the context and writes the hash value to the destination
98 | * \param dest pointer to the location where the hash value should be written
99 | * \param state pointer to the SHA-256 hash context
100 | */
101 | void sha256_ctx2hash(sha256_hash_t* dest, const sha256_ctx_t* state);
102 |
103 | /** \fn void sha256(sha256_hash_t* dest, const void* msg, uint32_t length_b)
104 | * \brief simple SHA-256 hashing function for direct hashing
105 | *
106 | * This function automatically hashes a given message of arbitary length with
107 | * the SHA-256 hashing algorithm.
108 | * \param dest pointer to the location where the hash value is going to be written to
109 | * \param msg pointer to the message thats going to be hashed
110 | * \param length_b length of the message in bits
111 | */
112 | void sha256_1(sha256_hash_t* dest, const void* msg, uint32_t length_b);
113 |
114 | #ifdef __cplusplus
115 | }
116 | #endif
117 |
118 | #endif /*SHA256_H_*/
119 |
--------------------------------------------------------------------------------
/libraries/WaspHash/utility/sha2_large_common.h:
--------------------------------------------------------------------------------
1 | /* sha2_large_common.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2011 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 |
20 | #ifndef SHA2_LARGE_COMMON_H_
21 | #define SHA2_LARGE_COMMON_H_
22 |
23 | typedef struct {
24 | uint64_t h[8];
25 | uint32_t length;
26 | } sha2_large_common_ctx_t;
27 |
28 |
29 | void sha2_large_common_nextBlock(sha2_large_common_ctx_t* ctx, const void* block);
30 | void sha2_large_common_lastBlock(sha2_large_common_ctx_t* ctx, const void* block, uint16_t length_b);
31 |
32 |
33 | #endif /* SHA2_LARGE_COMMON_H_ */
34 |
--------------------------------------------------------------------------------
/libraries/WaspHash/utility/sha2_small_common.h:
--------------------------------------------------------------------------------
1 | /* sha2_small_common.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2011 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 |
20 | #ifndef SHA2_SMALL_COMMON_H_
21 | #define SHA2_SMALL_COMMON_H_
22 |
23 |
24 |
25 | typedef struct {
26 | uint32_t h[8];
27 | uint32_t length;
28 | } sha2_small_common_ctx_t;
29 |
30 | void sha2_small_common_nextBlock(sha2_small_common_ctx_t* state, const void* block);
31 | void sha2_small_common_lastBlock(sha2_small_common_ctx_t* state, const void* block, uint16_t length_b);
32 |
33 | #endif /* SHA2_SMALL_COMMON_H_ */
34 |
--------------------------------------------------------------------------------
/libraries/WaspHash/utility/sha384.c:
--------------------------------------------------------------------------------
1 | /* sha384.c */
2 | /*
3 | This file is part of the ARM-Crypto-Lib.
4 | Copyright (C) 2006-2011 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 |
20 |
21 | #include
22 | #include
23 | #include
24 | #include "sha2_large_common.h"
25 | #include "sha384.h"
26 |
27 |
28 | void sha384_nextBlock (sha384_ctx_t* ctx, const void* block){
29 | sha2_large_common_nextBlock(ctx, block);
30 | }
31 |
32 | void sha384_lastBlock(sha384_ctx_t* ctx, const void* block, uint16_t length_b){
33 | sha2_large_common_lastBlock(ctx, block, length_b);
34 | }
35 |
36 | static const
37 | uint64_t sha384_init_values[8] PROGMEM = {
38 | 0xcbbb9d5dc1059ed8, 0x629a292a367cd507, 0x9159015a3070dd17, 0x152fecd8f70e5939,
39 | 0x67332667ffc00b31, 0x8eb44a8768581511, 0xdb0c2e0d64f98fa7, 0x47b5481dbefa4fa4
40 | };
41 |
42 |
43 | void sha384_init(sha384_ctx_t* ctx){
44 | ctx->length = 0;
45 | memcpy_P(ctx->h, sha384_init_values, 8*8);
46 | }
47 |
48 | void sha384_ctx2hash(sha384_hash_t* dest, const sha384_ctx_t* ctx){
49 | uint8_t i=6, j, *s = (uint8_t*)(ctx->h);
50 | do{
51 | j=7;
52 | do{
53 | *((uint8_t*)dest) = s[j];
54 | dest = (uint8_t*)dest + 1;
55 | }while(j--);
56 | s += 8;
57 | }while(--i);
58 | }
59 |
60 |
61 | void sha384_1(sha384_hash_t* dest, const void* msg, uint32_t length_b){
62 | sha384_ctx_t ctx;
63 | sha384_init(&ctx);
64 | while(length_b >= 1024){
65 | sha384_nextBlock(&ctx, msg);
66 | msg = (uint8_t*)msg + 1024/8;
67 | length_b -= 1024;
68 | }
69 | sha384_lastBlock(&ctx, msg, length_b);
70 | sha384_ctx2hash(dest, &ctx);
71 | }
72 |
--------------------------------------------------------------------------------
/libraries/WaspHash/utility/sha384.h:
--------------------------------------------------------------------------------
1 | /* sha384.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2011 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 |
20 | #ifndef SHA384_H_
21 | #define SHA384_H_
22 |
23 |
24 | #include
25 | #include "sha2_large_common.h"
26 |
27 | #ifdef __cplusplus
28 | extern "C"
29 | {
30 | #endif
31 |
32 | #define SHA384_HASH_BITS 384
33 | #define SHA384_HASH_BYTES (SHA384_HASH_BITS/8)
34 | #define SHA384_BLOCK_BITS 1024
35 | #define SHA3842_BLOCK_BYTES (SHA384_BLOCK_BITS/8)
36 |
37 | typedef sha2_large_common_ctx_t sha384_ctx_t;
38 |
39 | typedef uint8_t sha384_hash_t[SHA384_HASH_BITS/8];
40 |
41 | void sha384_init(sha384_ctx_t *ctx);
42 | void sha384_nextBlock (sha384_ctx_t* ctx, const void* block);
43 | void sha384_lastBlock(sha384_ctx_t* ctx, const void* block, uint16_t length_b);
44 | void sha384_ctx2hash(sha384_hash_t* dest, const sha384_ctx_t* ctx);
45 | void sha384_1(sha384_hash_t* dest, const void* msg, uint32_t length_b);
46 |
47 | #ifdef __cplusplus
48 | }
49 | #endif
50 |
51 | #endif /* SHA384_H_ */
52 |
--------------------------------------------------------------------------------
/libraries/WaspHash/utility/sha512.c:
--------------------------------------------------------------------------------
1 | /* sha512.c */
2 | /*
3 | This file is part of the ARM-Crypto-Lib.
4 | Copyright (C) 2006-2011 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 |
20 | #include
21 | #include
22 | #include
23 | #include "sha2_large_common.h"
24 | #include "sha512.h"
25 |
26 |
27 | void sha512_nextBlock (sha512_ctx_t* ctx, const void* block){
28 | sha2_large_common_nextBlock(ctx, block);
29 | }
30 |
31 | void sha512_lastBlock(sha512_ctx_t* ctx, const void* block, uint16_t length_b){
32 | sha2_large_common_lastBlock(ctx, block, length_b);
33 | }
34 |
35 | static const
36 | uint64_t sha512_init_values[8] PROGMEM = {
37 | 0x6a09e667f3bcc908LL, 0xbb67ae8584caa73bLL, 0x3c6ef372fe94f82bLL, 0xa54ff53a5f1d36f1LL,
38 | 0x510e527fade682d1LL, 0x9b05688c2b3e6c1fLL, 0x1f83d9abfb41bd6bLL, 0x5be0cd19137e2179LL
39 | };
40 |
41 |
42 | void sha512_init(sha512_ctx_t* ctx){
43 | ctx->length = 0;
44 | memcpy_P(ctx->h, sha512_init_values, 8*8);
45 | }
46 |
47 | void sha512_ctx2hash(sha512_hash_t* dest, const sha512_ctx_t* ctx){
48 | uint8_t i=8, j, *s = (uint8_t*)(ctx->h);
49 | do{
50 | j=7;
51 | do{
52 | *((uint8_t*)dest) = s[j];
53 | dest = (uint8_t*)dest + 1;
54 | }while(j--);
55 | s += 8;
56 | }while(--i);
57 | }
58 |
59 |
60 | void sha512_1(sha512_hash_t* dest, const void* msg, uint32_t length_b){
61 | sha512_ctx_t ctx;
62 | sha512_init(&ctx);
63 | while(length_b >= 1024){
64 | sha512_nextBlock(&ctx, msg);
65 | msg = (uint8_t*)msg + 1024/8;
66 | length_b -= 1024;
67 | }
68 | sha512_lastBlock(&ctx, msg, length_b);
69 | sha512_ctx2hash(dest, &ctx);
70 | }
71 |
--------------------------------------------------------------------------------
/libraries/WaspHash/utility/sha512.h:
--------------------------------------------------------------------------------
1 | /* sha512.h */
2 | /*
3 | This file is part of the AVR-Crypto-Lib.
4 | Copyright (C) 2011 Daniel Otte (daniel.otte@rub.de)
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 |
20 | #ifndef SHA512_H_
21 | #define SHA512_H_
22 |
23 | #include
24 | #include "sha2_large_common.h"
25 |
26 | #ifdef __cplusplus
27 | extern "C"
28 | {
29 | #endif
30 |
31 | #define SHA512_HASH_BITS 512
32 | #define SHA512_HASH_BYTES (SHA512_HASH_BITS/8)
33 | #define SHA512_BLOCK_BITS 1024
34 | #define SHA5122_BLOCK_BYTES (SHA512_BLOCK_BITS/8)
35 |
36 | typedef sha2_large_common_ctx_t sha512_ctx_t;
37 |
38 | typedef uint8_t sha512_hash_t[SHA512_HASH_BITS/8];
39 |
40 | void sha512_init(sha512_ctx_t *ctx);
41 | void sha512_nextBlock (sha512_ctx_t* ctx, const void* block);
42 | void sha512_lastBlock(sha512_ctx_t* ctx, const void* block, uint16_t length_b);
43 | void sha512_ctx2hash(sha512_hash_t* dest, const sha512_ctx_t* ctx);
44 | void sha512_1(sha512_hash_t* dest, const void* msg, uint32_t length_b);
45 |
46 | #ifdef __cplusplus
47 | }
48 | #endif
49 |
50 | #endif /* SHA512_H_ */
51 |
--------------------------------------------------------------------------------
/libraries/WaspRSA/WaspRSA.h:
--------------------------------------------------------------------------------
1 | /*! \file WaspRSA.h
2 | * \brief Library for encrypting messages using the RSA algorithm
3 | *
4 | * Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
5 | * http://www.libelium.com
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 2.1 of the License, or
10 | * (at your option) any later version.
11 |
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 |
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .
19 | *
20 | * Version: 3.0
21 | * Design: David Gascón
22 | * Implementation: Alvaro Gonzalez, Yuri Carmona
23 | */
24 |
25 | /*! \def WaspRSA_h
26 | \brief The library flag
27 |
28 | */
29 | #ifndef WaspRSA_h
30 | #define WaspRSA_h
31 | #include "utility/bignum.h"
32 | #include "utility/bn_mul.h"
33 | /******************************************************************************
34 | * Includes
35 | ******************************************************************************/
36 | #include
37 |
38 |
39 | /******************************************************************************
40 | * Class
41 | ******************************************************************************/
42 |
43 | //! WaspRSA Class
44 | /*!
45 | WaspRSA Class defines all the variables and functions used for managing the
46 | RSA algorithm
47 | */
48 | class WaspRSA
49 | {
50 | private:
51 |
52 |
53 | public:
54 |
55 | //! class constructor
56 | /*! It initializes some variables
57 | \param void
58 | \return void
59 | */
60 | WaspRSA();
61 |
62 | //! It encrypt a message with RSA algorithm
63 | /*! It gets the baud rate from 'USB_RATE'
64 | \param char* modulus: The modulus necesary to calculate encrypted message
65 | with RSA algorithm
66 | * \param char* modulus:
67 | \return char*: encrypted message
68 | */
69 | int encrypt( char* message
70 | , char* exponent
71 | , char* modulus
72 | , char* encrypted_message
73 | , int slen );
74 |
75 | int encrypt( uint8_t* message
76 | , uint16_t length
77 | , char* exponent
78 | , char* modulus
79 | , char* encrypted_message
80 | , int slen );
81 |
82 |
83 |
84 | void printMessage( char* encrypted_message );
85 |
86 |
87 | };
88 |
89 | extern WaspRSA RSA;
90 |
91 | #endif
92 |
--------------------------------------------------------------------------------
/libraries/WaspRSA/keywords.txt:
--------------------------------------------------------------------------------
1 | # RSA keywords #
2 |
3 | WaspRSA KEYWORD2
4 | encrypt KEYWORD2
5 | printMessage KEYWORD2
6 |
7 | RSA KEYWORD1
8 |
9 | #bignum#
10 |
11 | POLARSSL_ERR_MPI_FILE_IO_ERROR LITERAL1
12 | POLARSSL_ERR_MPI_BAD_INPUT_DATA LITERAL1
13 | POLARSSL_ERR_MPI_INVALID_CHARACTER LITERAL1
14 | POLARSSL_ERR_MPI_BUFFER_TOO_SMALL LITERAL1
15 | POLARSSL_ERR_MPI_NEGATIVE_VALUE LITERAL1
16 | POLARSSL_ERR_MPI_DIVISION_BY_ZERO LITERAL1
17 | POLARSSL_ERR_MPI_NOT_ACCEPTABLE LITERAL1
18 |
19 | mpi_free KEYWORD2
20 | mpi_grow KEYWORD2
21 | mpi_copy KEYWORD2
22 | mpi_swap KEYWORD2
23 | mpi_lset KEYWORD2
24 | mpi_lsb KEYWORD2
25 | mpi_msb KEYWORD2
26 | mpi_size KEYWORD2
27 | mpi_read_string KEYWORD2
28 | mpi_write_strin KEYWORD2
29 | mpi_read_file KEYWORD2
30 | mpi_write_file KEYWORD2
31 | mpi_read_binary KEYWORD2
32 | mpi_write_binar KEYWORD2
33 | mpi_shift_l KEYWORD2
34 | mpi_shift_r KEYWORD2
35 | mpi_cmp_abs KEYWORD2
36 | mpi_cmp_mpi KEYWORD2
37 | mpi_cmp_int KEYWORD2
38 | mpi_add_abs KEYWORD2
39 | mpi_sub_abs KEYWORD2
40 | mpi_add_mpi KEYWORD2
41 | mpi_sub_mpi KEYWORD2
42 | mpi_add_int KEYWORD2
43 | mpi_sub_int KEYWORD2
44 | mpi_mul_mpi KEYWORD2
45 | mpi_mul_int KEYWORD2
46 | mpi_div_mpi KEYWORD2
47 | mpi_div_int KEYWORD2
48 | mpi_mod_mpi KEYWORD2
49 | mpi_mod_int KEYWORD2
50 | mpi_exp_mod KEYWORD2
51 | mpi_gcd KEYWORD2
52 | mpi_inv_mod KEYWORD2
53 | mpi_is_prime KEYWORD2
54 | mpi_gen_prime KEYWORD2
55 | mpi_self_test KEYWORD2
56 |
--------------------------------------------------------------------------------
/libraries/WaspStackEEPROM/keywords.txt:
--------------------------------------------------------------------------------
1 | # EEPROM Keywords #
2 |
3 | START_STACK LITERAL1
4 | START_ADDRESS LITERAL1
5 | END_STACK LITERAL1
6 | BLOCK_SIZE LITERAL1
7 |
8 | WaspStackEEPROM KEYWORD2
9 | initBlockSize KEYWORD2
10 | initStack KEYWORD2
11 | push KEYWORD2
12 | push_front KEYWORD2
13 | push_back KEYWORD2
14 | pop KEYWORD2
15 | pop_front KEYWORD2
16 | pop_back KEYWORD2
17 | isFull KEYWORD2
18 | isEmpty KEYWORD2
19 | getStoredFrames KEYWORD2
20 | getMaxFrames KEYWORD2
21 |
22 | stack KEYWORD1
23 |
--------------------------------------------------------------------------------
/libraries/XBee802/keywords.txt:
--------------------------------------------------------------------------------
1 | # XBee802 Keywords #
2 |
3 | WaspXBee802 KEYWORD2
4 | init KEYWORD2
5 | setRetries KEYWORD2
6 | getRetries KEYWORD2
7 | setDelaySlots KEYWORD2
8 | getDelaySlots KEYWORD2
9 | setMacMode KEYWORD2
10 | getMacMode KEYWORD2
11 | setEnergyThreshold KEYWORD2
12 | getEnergyThreshold KEYWORD2
13 | getCCAcounter KEYWORD2
14 | resetCCAcounter KEYWORD2
15 | getACKcounter KEYWORD2
16 | resetACKcounter KEYWORD2
17 | sendXBeePriv KEYWORD2
18 | retries KEYWORD2
19 | delaySlots KEYWORD2
20 | macMode KEYWORD2
21 | energyThreshold KEYWORD2
22 | counterCCA KEYWORD2
23 | counterACK KEYWORD2
24 | _payload KEYWORD2
25 | _length KEYWORD2
26 |
27 | xbee802 KEYWORD1
28 |
--------------------------------------------------------------------------------
/libraries/XBee868/keywords.txt:
--------------------------------------------------------------------------------
1 | # XBee868 Keywords #
2 |
3 | WaspXBee868 KEYWORD2
4 | init KEYWORD2
5 | getRFerrors KEYWORD2
6 | getGoodPackets KEYWORD2
7 | getChannelRSSI KEYWORD2
8 | getTransmisionErrors KEYWORD2
9 | getTemperature KEYWORD2
10 | getSupplyVoltage KEYWORD2
11 | getDeviceType KEYWORD2
12 | getPayloadBytes KEYWORD2
13 | setMultipleBroadcast KEYWORD2
14 | getMultipleBroadcast KEYWORD2
15 | setMacRetries KEYWORD2
16 | getMacRetries KEYWORD2
17 | getDutyCycle KEYWORD2
18 | getResetReason KEYWORD2
19 | getACKerrors KEYWORD2
20 | sendXBeePriv KEYWORD2
21 | ACKerrors KEYWORD2
22 | errorsRF KEYWORD2
23 | goodPackets KEYWORD2
24 | channelRSSI KEYWORD2
25 | transmisionErrors KEYWORD2
26 | supplyVoltage KEYWORD2
27 | maxPayloadBytes KEYWORD2
28 | deviceType KEYWORD2
29 | multipleBroadcast KEYWORD2
30 | macRetries KEYWORD2
31 | dutyCycle KEYWORD2
32 | resetReason KEYWORD2
33 | _payload KEYWORD2
34 | _length KEYWORD2
35 |
36 | xbee868 KEYWORD1
37 |
--------------------------------------------------------------------------------
/libraries/XBee868LP/keywords.txt:
--------------------------------------------------------------------------------
1 | _errorsRF KEYWORD2
2 | _goodPackets KEYWORD2
3 | _transmisionErrors KEYWORD2
4 | _availableFreq KEYWORD2
5 | _channelMask KEYWORD2
6 | _minFreqCount KEYWORD2
7 | _preambleID KEYWORD2
8 | _transmitOptions KEYWORD2
9 | _networkHops KEYWORD2
10 | _netDelaySlots KEYWORD2
11 | _meshNetRetries KEYWORD2
12 | _retries KEYWORD2
13 | multipleBroadcast KEYWORD2
14 | channelRSSI KEYWORD2
15 | maxPayloadBytes KEYWORD2
16 |
17 | getAvailableFreq KEYWORD2
18 | getChannelMask KEYWORD2
19 | getChannelRSSI KEYWORD2
20 | getGoodPackets KEYWORD2
21 | getMeshNetworkRetries KEYWORD2
22 | getMultipleBroadcast KEYWORD2
23 | getNetworkDelaySlots KEYWORD2
24 | getPayloadBytes KEYWORD2
25 | getNetworkHops KEYWORD2
26 | getPreambleID KEYWORD2
27 | getRetries KEYWORD2
28 | getRFerrors KEYWORD2
29 | getTransmisionErrors KEYWORD2
30 | getTransmitOptions KEYWORD2
31 | init KEYWORD2
32 | sendXBeePriv KEYWORD2
33 | setMeshNetworkRetries KEYWORD2
34 | setChannelMask KEYWORD2
35 | setNetworkDelaySlots KEYWORD2
36 | setMultipleBroadcast KEYWORD2
37 | setNetworkHops KEYWORD2
38 | setPreambleID KEYWORD2
39 | setRetries KEYWORD2
40 | setTransmitOptions KEYWORD2
41 | WaspXBee868LP KEYWORD2
42 |
43 | xbee868LP KEYWORD1
44 |
45 | TO_DIGIMESH LITERAL1
46 | TO_POINT_TO_MULTIPOINT LITERAL1
47 |
--------------------------------------------------------------------------------
/libraries/XBee900/keywords.txt:
--------------------------------------------------------------------------------
1 | # XBee900 Keywords #
2 |
3 | WaspXBee900 KEYWORD2
4 | init KEYWORD2
5 | getRFerrors KEYWORD2
6 | getGoodPackets KEYWORD2
7 | getChannelRSSI KEYWORD2
8 | getTransmisionErrors KEYWORD2
9 | getTemperature KEYWORD2
10 | getSupplyVoltage KEYWORD2
11 | restoreCompiled KEYWORD2
12 | sendXBeePriv KEYWORD2
13 | errorsRF KEYWORD2
14 | goodPackets KEYWORD2
15 | channelRSSI KEYWORD2
16 | transmisionErrors KEYWORD2
17 | networkHops KEYWORD2
18 | netDelaySlots KEYWORD2
19 | netRouteRequest KEYWORD2
20 | meshNetRetries KEYWORD2
21 | supplyVoltage KEYWORD2
22 | _payload KEYWORD2
23 | _length KEYWORD2
24 |
25 | xbee900 KEYWORD1
26 |
--------------------------------------------------------------------------------
/libraries/XBee900HP/keywords.txt:
--------------------------------------------------------------------------------
1 |
2 | # KEYWORD3 specifies objects
3 | xbee900HP KEYWORD1
4 |
5 | # KEYWORD2 specifies functions and attributes#
6 | getRFerrors KEYWORD2
7 | _errorsRF KEYWORD2
8 | getAvailableFreq KEYWORD2
9 | _availableFreq KEYWORD2
10 | setChannelMask KEYWORD2
11 | getChannelMask KEYWORD2
12 | _channelMask KEYWORD2
13 | getMinFreqCount KEYWORD2
14 | _minFreqCount KEYWORD2
15 | setPreambleID KEYWORD2
16 | getPreambleID KEYWORD2
17 | _preambleID KEYWORD2
18 | setTransmitOptions KEYWORD2
19 | getTransmitOptions KEYWORD2
20 | _transmitOptions KEYWORD2
21 | writeValues KEYWORD2
22 |
23 | WaspXBee900HP KEYWORD2
24 |
--------------------------------------------------------------------------------
/libraries/XBeeDM/keywords.txt:
--------------------------------------------------------------------------------
1 | # XBeeDM Keywords #
2 |
3 | WaspXBeeDM KEYWORD2
4 | init KEYWORD2
5 | getGoodPackets KEYWORD2
6 | getTransmisionErrors KEYWORD2
7 | setNetworkHops KEYWORD2
8 | getNetworkHops KEYWORD2
9 | setNetworkDelaySlots KEYWORD2
10 | getNetworkDelaySlots KEYWORD2
11 | setMeshNetworkRetries KEYWORD2
12 | getMeshNetworkRetries KEYWORD2
13 | setRetries KEYWORD2
14 | getRetries KEYWORD2
15 | sendXBeePriv KEYWORD2
16 | goodPackets KEYWORD2
17 | transmisionErrors KEYWORD2
18 | networkHops KEYWORD2
19 | netDelaySlots KEYWORD2
20 | meshNetRetries KEYWORD2
21 | retries KEYWORD2
22 | setAwakeTime KEYWORD2
23 | setSleepTime KEYWORD2
24 | setSleepMode KEYWORD2
25 | _payload KEYWORD2
26 | _length KEYWORD2
27 |
28 | xbeeDM KEYWORD1
29 |
--------------------------------------------------------------------------------
/libraries/XBeeZB/keywords.txt:
--------------------------------------------------------------------------------
1 | # XBeeZB Keywords #
2 |
3 | WaspXBeeZB KEYWORD2
4 | init KEYWORD2
5 | resetNetwork KEYWORD2
6 | getParentNetworkAddress KEYWORD2
7 | getRemainingChildren KEYWORD2
8 | setDeviceType KEYWORD2
9 | getDeviceType KEYWORD2
10 | getPayloadBytes KEYWORD2
11 | getOperating64PAN KEYWORD2
12 | getOperating16PAN KEYWORD2
13 | setMaxUnicastHops KEYWORD2
14 | getMaxUnicastHops KEYWORD2
15 | setMaxBroadcastHops KEYWORD2
16 | getMaxBroadcastHops KEYWORD2
17 | setStackProfile KEYWORD2
18 | getStackProfile KEYWORD2
19 | setPeriodSleep KEYWORD2
20 | setJoinTime KEYWORD2
21 | getJoinTime KEYWORD2
22 | setChannelVerification KEYWORD2
23 | getChannelVerification KEYWORD2
24 | setJoinNotification KEYWORD2
25 | getJoinNotification KEYWORD2
26 | setAggregateNotification KEYWORD2
27 | getAggregateNotification KEYWORD2
28 | getAssociationIndication KEYWORD2
29 | setEncryptionOptions KEYWORD2
30 | getEncryptionOptions KEYWORD2
31 | setNetworkKey KEYWORD2
32 | setPowerMode KEYWORD2
33 | getPowerMode KEYWORD2
34 | getSupplyVoltage KEYWORD2
35 | setAPSencryption KEYWORD2
36 | sendXBeePriv KEYWORD2
37 | setKnownDestination KEYWORD2
38 | parentNA KEYWORD2
39 | remainingChildren KEYWORD2
40 | deviceType KEYWORD2
41 | maxPayloadBytes KEYWORD2
42 | operating64PAN KEYWORD2
43 | operating16PAN KEYWORD2
44 | maxUnicastHops KEYWORD2
45 | maxBroadcastHops KEYWORD2
46 | stackProfile KEYWORD2
47 | periodSleep KEYWORD2
48 | joinTime KEYWORD2
49 | channelVerification KEYWORD2
50 | joinNotification KEYWORD2
51 | aggregateNotification KEYWORD2
52 | associationIndication KEYWORD2
53 | encryptOptions KEYWORD2
54 | networkKey KEYWORD2
55 | powerMode KEYWORD2
56 | supplyVoltage KEYWORD2
57 | setScanningChannels KEYWORD2
58 | setCoordinator KEYWORD2
59 | getCoordinator KEYWORD2
60 | setPAN KEYWORD2
61 | _payload KEYWORD2
62 | _length KEYWORD2
63 | error_AT KEYWORD2
64 | coordinatorEnable KEYWORD2
65 |
66 | xbeeZB KEYWORD1
67 |
--------------------------------------------------------------------------------
/libraries/_4_20mA/currentLoop.h:
--------------------------------------------------------------------------------
1 | /*! \file currentLoop.h
2 |
3 | \brief Library for managing the 4-20mA
4 | Copyright (C) 2017 Libelium Comunicaciones Distribuidas S.L.
5 | http://www.libelium.com
6 |
7 | This program is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU Lesser General Public License as published by
9 | the Free Software Foundation, either version 2.1 of the License, or
10 | (at your option) any later version.
11 |
12 | This program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU Lesser General Public License for more details.
16 |
17 | You should have received a copy of the GNU Lesser General Public License
18 | along with this program. If not, see .
19 |
20 | Version: 3.1
21 | Implementation: Ahmad Saad
22 | */
23 |
24 | #ifndef currentLoop_h
25 | #define currentLoop_h
26 |
27 | /***********************************************************************
28 | * Includes
29 | ***********************************************************************/
30 | #include
31 |
32 | /***********************************************************************
33 | * Configuration Selection
34 | ************************************************************************/
35 | #define CHANNEL1 0x01 //ANALOG1
36 | #define CHANNEL2 0x02 //ANALOG2
37 | #define CHANNEL3 0x03 //ANALOG5
38 | #define CHANNEL4 0x04 //ANALOG6
39 |
40 | #define SUPPLY12V 12
41 | #define SUPPLY5V 5
42 |
43 |
44 | /***********************************************************************
45 | * Class
46 | **********************************************************************/
47 | class currentLoop{
48 |
49 | public:
50 |
51 | //! The constructor of the class
52 | currentLoop();
53 |
54 | //! Powers ON the 4-20mA supply 5V or 12V
55 | uint8_t ON(uint8_t powerSupply);
56 |
57 | //! Powers OFF the 4-20mA supply 5V or 12V
58 | uint8_t OFF(uint8_t powerSupply);
59 |
60 | //! Get the sensor value in integer format
61 | int readChannel(uint8_t channel);
62 |
63 | //! Get the sensor value as a voltage in Volts
64 | float readVoltage(uint8_t channel);
65 |
66 | //! Get the sensor value as a current in mA
67 | float readCurrent(uint8_t channel);
68 |
69 | //! Get the sensor value as a current in mA and introduce
70 | //! a correction offSet factor.
71 | float readCurrent(uint8_t channel, float offSet);
72 |
73 | //! It checks if the current loop is well connected
74 | uint8_t isConnected(uint8_t channel);
75 |
76 | private:
77 |
78 | //! This variable stores the last value read from th ADC
79 | long _analogValue;
80 |
81 | };
82 |
83 | extern currentLoop currentLoopBoard;
84 |
85 | #endif
86 |
--------------------------------------------------------------------------------
/libraries/_4_20mA/keywords.txt:
--------------------------------------------------------------------------------
1 | # _4_20mA keywords #
2 |
3 | CHANNEL1 LITERAL1
4 | CHANNEL2 LITERAL1
5 | CHANNEL3 LITERAL1
6 | CHANNEL4 LITERAL1
7 | SUPPLY12V LITERAL1
8 | SUPPLY5V LITERAL1
9 | currentLoopBoard KEYWORD1
10 | readChannel KEYWORD2
11 | readVoltage KEYWORD2
12 | readCurrent KEYWORD2
13 | isConnected KEYWORD2
14 | currentLoop KEYWORD2
15 |
--------------------------------------------------------------------------------
/waspmote-api/MemoryFree.cpp:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * MemoryFree.cpp
4 | * returns the number of free RAM bytes
5 | */
6 | #include "MemoryFree.h"
7 | extern unsigned int __data_start;
8 | extern unsigned int __data_end;
9 | extern unsigned int __bss_start;
10 | extern unsigned int __bss_end;
11 | extern unsigned int __heap_start;
12 | extern void *__brkval;
13 | int freeMemory()
14 | {
15 | int free_memory;
16 | if((int)__brkval == 0)
17 | free_memory = ((int)&free_memory) - ((int)&__bss_end);
18 | else
19 | free_memory = ((int)&free_memory) - ((int)__brkval);
20 | return free_memory;
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/waspmote-api/MemoryFree.h:
--------------------------------------------------------------------------------
1 | /*
2 | * MemoryFree header
3 | */
4 | #ifndef MEMORY_FREE_H
5 | #define MEMORY_FREE_H
6 | #ifdef __cplusplus
7 | extern "C" {
8 | #endif
9 | int freeMemory();
10 | #ifdef __cplusplus
11 | }
12 | #endif
13 | #endif
14 |
15 |
--------------------------------------------------------------------------------
/waspmote-api/Printable.h:
--------------------------------------------------------------------------------
1 | /*
2 | Printable.h - Interface class that allows printing of complex types
3 | Copyright (c) 2011 Adrian McEwen. All right reserved.
4 | Modified for Waspmote by Libelium, 2016
5 |
6 | This library is free software; you can redistribute it and/or
7 | modify it under the terms of the GNU Lesser General Public
8 | License as published by the Free Software Foundation; either
9 | version 2.1 of the License, or (at your option) any later version.
10 |
11 | This library is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | Lesser General Public License for more details.
15 |
16 | You should have received a copy of the GNU Lesser General Public
17 | License along with this library; if not, write to the Free Software
18 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 |
20 | Version: 3.0
21 |
22 | */
23 |
24 | #ifndef Printable_h
25 | #define Printable_h
26 |
27 | #include
28 |
29 | class __FlashStringHelper;
30 | #define F(string_literal) (reinterpret_cast< const __FlashStringHelper *>(PSTR(string_literal)))
31 |
32 | class USB;
33 | /** The Printable class provides a way for new classes to allow themselves to be printed.
34 | By deriving from Printable and implementing the printTo method, it will then be possible
35 | for users to print out instances of this class by passing them into the usual
36 | Print::print and Print::println methods.
37 | */
38 |
39 | class Printable
40 | {
41 | public:
42 | virtual size_t printTo(USB& p) const = 0;
43 | };
44 |
45 | #endif
46 |
47 |
--------------------------------------------------------------------------------
/waspmote-api/WConstants.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 Libelium Comunicaciones Distribuidas S.L.
3 | * http://www.libelium.com
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 2.1 of the License, or
8 | * (at your option) any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | *
18 | * Version: 3.0
19 | * Design: David Gascón
20 | * Implementation: David Cuartielles, Alberto Bielsa
21 | */
22 |
23 | #include "wiring.h"
24 |
25 |
--------------------------------------------------------------------------------
/waspmote-api/WaspClasses.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Libelium Comunicaciones Distribuidas S.L.
3 | * http://www.libelium.com
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 2.1 of the License, or
8 | * (at your option) any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | *
18 | * Version: 3.2
19 | * Design: David Gascón
20 | * Implementation: David Cuartielles, Alberto Bielsa, Yuri Carmona
21 | */
22 |
23 |
24 | // strings and math
25 | #include
26 | #include
27 | #include
28 | #include
29 |
30 | // interrupts and sleep
31 | #include
32 | #include
33 | #include
34 | #include
35 |
36 | #include "pins_waspmote.h"
37 | #include "WaspConstants.h"
38 | #include "wiring.h"
39 |
40 |
41 | #ifdef __cplusplus
42 |
43 | #include "WaspUtils.h"
44 | #include "WaspUSB.h"
45 | #include "WaspRTC.h"
46 | #include "WaspACC.h"
47 | #include "WaspSD.h"
48 | #include "WaspPWR.h"
49 | #include "WaspXBeeCore.h"
50 | #include "MemoryFree.h"
51 | #include "WaspEEPROM.h"
52 | #include "WaspOneWire.h"
53 |
54 | // I2C library
55 | #include "WaspI2C.h"
56 |
57 |
58 | // SPI library
59 | #include "WaspSPI.h"
60 |
61 |
62 | // One wire library
63 | #include "WaspOneWire.h"
64 |
65 |
66 | #endif
67 |
68 |
--------------------------------------------------------------------------------
/waspmote-api/WaspEEPROM.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Based on library by Rob Tillaart
3 | * URL: http://arduino.cc/playground/Main/LibraryForI2CEEPROM
4 | * VERSION: 1.0.05
5 | *
6 | * Copyright (C) 2018 Libelium Comunicaciones Distribuidas S.L.
7 | * http://www.libelium.com
8 | *
9 | * This program is free software: you can redistribute it and/or modify
10 | * it under the terms of the GNU Lesser General Public License as published by
11 | * the Free Software Foundation, either version 2.1 of the License, or
12 | * (at your option) any later version.
13 |
14 | * This program is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU Lesser General Public License for more details.
18 |
19 | * You should have received a copy of the GNU Lesser General Public License
20 | * along with this program. If not, see .
21 | *
22 | * Version: 3.2
23 | * Design: David Gascon
24 | * Implementation: Yuri Carmona
25 | */
26 |
27 | #ifndef I2C_EEPROM_H
28 | #define I2C_EEPROM_H
29 |
30 |
31 | #include
32 | #include
33 |
34 |
35 | //! DEBUG MODE
36 | /*! 0: No debug mode enabled
37 | * 1: debug mode enabled for error output messages
38 | * 2: debug mode enabled for both error and ok messages
39 | * \Remarks do not enable mode 2 unless SOCKET1 is used
40 | */
41 | #define DEBUG_EEPROM 0
42 |
43 | // define print MACRO
44 | #define PRINT_EEPROM(str) USB.print(F("[EEPROM] ")); USB.print(str);
45 |
46 |
47 | // I2C_EEPROM_PAGESIZE must be multiple of 2 e.g. 16, 32 or 64
48 | // 24LC256 -> 64 bytes
49 | #define I2C_EEPROM_PAGESIZE 64
50 |
51 | // TWI buffer needs max 2 bytes for address
52 | #define I2C_TWIBUFFERSIZE 30
53 |
54 | // to break blocking read/write
55 | #define I2C_EEPROM_TIMEOUT 1000
56 |
57 | // comment next line to keep lib small
58 | #define I2C_EEPROM_EXTENDED
59 |
60 | // define registers
61 | #define EEPROM_STATUS_REGISTER 0xFFF0
62 |
63 |
64 | class WaspEEPROM
65 | {
66 | public:
67 | WaspEEPROM();
68 |
69 | uint8_t _buffer[100];
70 | uint8_t _response[100];
71 | uint8_t _length;
72 |
73 | uint8_t ON();
74 | int writeByte(uint16_t address, uint8_t value);
75 | int writeBlock(uint16_t address, uint8_t* buffer, uint16_t length);
76 | int setBlock(uint16_t address, uint8_t value, uint16_t length);
77 |
78 | uint8_t readByte(uint16_t address);
79 | uint16_t readBlock(uint16_t address, uint8_t* buffer, uint16_t length);
80 |
81 | #ifdef I2C_EEPROM_EXTENDED
82 | uint8_t determineSize();
83 | #endif
84 | uint8_t readRegister(uint16_t address, uint8_t* buffer, uint8_t length);
85 | uint8_t sendCommand(uint8_t* command);
86 | uint8_t sleepCommand();
87 | uint8_t readSerialNumber();
88 | uint8_t blockRead(uint16_t address, uint8_t length);
89 | uint8_t readJEDEC();
90 | uint8_t reset();
91 |
92 | uint8_t encrypt(uint8_t index, uint8_t *data, uint16_t length, uint8_t *encryptedData, uint16_t *encryptedLength);
93 | uint8_t encryptBlock16(uint8_t index, uint8_t *data, uint8_t len);
94 | uint8_t saveKey(uint8_t index, uint8_t *key, uint8_t len);
95 | uint8_t setKeyConfig(uint8_t index, uint8_t *reg);
96 | uint8_t showConfigurationMemoryMap();
97 |
98 | private:
99 | uint8_t _deviceAddress;
100 | uint32_t _lastWrite; // for waitReady
101 |
102 | int _pageBlock(uint16_t address, uint8_t* buffer, uint16_t length, bool incrBuffer);
103 | int _WriteBlock(uint16_t address, uint8_t* buffer, uint8_t length);
104 | uint8_t _ReadBlock(uint16_t address, uint8_t* buffer, uint8_t length);
105 |
106 | uint8_t waitReady();
107 | };
108 |
109 | extern WaspEEPROM eeprom;
110 |
111 |
112 | #endif
113 | // END OF FILE
114 |
--------------------------------------------------------------------------------
/waspmote-api/WaspVariables.h:
--------------------------------------------------------------------------------
1 | /*! \file WaspVariables.h
2 | \brief General variables used through the libraries
3 |
4 | Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
5 | http://www.libelium.com
6 |
7 | This program is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU Lesser General Public License as published by
9 | the Free Software Foundation, either version 2.1 of the License, or
10 | (at your option) any later version.
11 |
12 | This program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU Lesser General Public License for more details.
16 |
17 | You should have received a copy of the GNU Lesser General Public License
18 | along with this program. If not, see .
19 |
20 | Version: 3.0
21 | Design: David Gascón
22 | Implementation: Alberto Bielsa, David Cuartielles
23 |
24 | */
25 |
26 | /******************************************************************************
27 | * Includes
28 | ******************************************************************************/
29 |
30 | #include
31 |
32 | /******************************************************************************
33 | * Definitions & Declarations
34 | ******************************************************************************/
35 |
36 | /*! \def intFlag
37 | \brief Flag used for storing the modules that have generated an interruption
38 | */
39 | /*! \def intConf
40 | \brief Flag used for storing the modules that are enabled to generate an interruption
41 | */
42 | /*! \def intCounter
43 | \brief Flag that stores the number of interruptions have been generated
44 | */
45 | /*! \def intArray
46 | \brief Flag used for storing the number of times each different kind of interruption has been generated
47 | */
48 |
49 | volatile uint16_t intFlag;
50 | volatile uint16_t intConf;
51 |
52 | volatile uint8_t intCounter;
53 | volatile uint8_t intArray[8];
54 |
55 | /*! \def WaspRegister
56 | \brief Bitmap used for managing the different modules and power supplies
57 | by different libraries
58 | */
59 | volatile uint16_t WaspRegister;
60 | volatile uint16_t WaspRegisterSensor;
61 |
62 | /*! \def pwrGasRegister
63 | \brief Bitmap used for managing the power supply for Gases PRO board
64 | 0: dust sensor
65 | 1: gas sensor on socket 1 or C
66 | 2: gas sensor on socket 2
67 | 3: gas sensor on socket 3 or F
68 | 4: gas sensor on socket 4 or A
69 | 5: gas sensor on socket 5 or B
70 | 6: gas sensor on socket 6
71 | */
72 | volatile uint8_t pwrGasPRORegister;
73 |
74 | volatile uint8_t pwrCitiesPRORegister;
75 |
76 |
77 |
--------------------------------------------------------------------------------
/waspmote-api/Waspmote.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
3 | * http://www.libelium.com
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 2.1 of the License, or
8 | * (at your option) any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | *
18 | * Version: 3.0
19 | * Design: David Gascón
20 | * Implementation: David Cuartielles, Alberto Bielsa
21 | */
22 |
23 |
24 | #ifndef __WPROGRAM_H__
25 | #define __WPROGRAM_H__
26 |
27 |
28 | #include "WaspClasses.h"
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/waspmote-api/sd_utilities/SdFat.h:
--------------------------------------------------------------------------------
1 | /* Arduino SdFat Library
2 | * Copyright (C) 2012 by William Greiman
3 | * Modified for Waspmote by Libelium, 2016
4 | *
5 | * This file is part of the Arduino SdFat Library
6 | *
7 | * This Library is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This Library is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with the Arduino SdFat Library. If not, see
19 | * .
20 | *
21 | * Version: 3.0
22 | *
23 | */
24 | #ifndef SdFat_h
25 | #define SdFat_h
26 | /**
27 | * \file
28 | * \brief SdFat class
29 | */
30 | //------------------------------------------------------------------------------
31 | /** Macro for debug. */
32 | #define DBG_FAIL_MACRO //USB.print(__FILE__);USB.println(__LINE__);
33 | //------------------------------------------------------------------------------
34 | /** SdFat version YYYYMMDD */
35 | #define SD_FAT_VERSION 20130621
36 | //------------------------------------------------------------------------------
37 |
38 |
39 | //------------------------------------------------------------------------------
40 | #include "SdFile.h"
41 | #include "SdStream.h"
42 | #include "pins_waspmote.h"
43 | //------------------------------------------------------------------------------
44 | /**
45 | * \class SdFat
46 | * \brief Integration class for the %SdFat library.
47 | */
48 | class SdFat {
49 | public:
50 | SdFat() {}
51 | /** \return a pointer to the Sd2Card object. */
52 | Sd2Card* card() {return &m_card;}
53 | bool chdir(bool set_cwd = false);
54 | bool chdir(const char* path, bool set_cwd = false);
55 | void chvol();
56 | void errorHalt();
57 | void errorHalt(char const *msg);
58 | void errorPrint();
59 | void errorPrint(char const *msg);
60 | bool exists(const char* name);
61 | bool begin(uint8_t chipSelectPin = SD_SS,
62 | uint8_t sckDivisor = SPI_FULL_SPEED);
63 | void initErrorHalt();
64 | void initErrorHalt(char const *msg);
65 | void initErrorPrint();
66 | void initErrorPrint(char const *msg);
67 | void ls(uint8_t flags = 0);
68 | //~ void ls(Print* pr, uint8_t flags = 0);
69 | bool mkdir(const char* path, bool pFlag = true);
70 | bool remove(const char* path);
71 | bool rename(const char *oldPath, const char *newPath);
72 | bool rmdir(const char* path);
73 | bool truncate(const char* path, uint32_t length);
74 | /** \return a pointer to the SdVolume object. */
75 | SdVolume* vol() {return &m_vol;}
76 | /** \return a pointer to the volume working directory. */
77 | SdBaseFile* vwd() {return &m_vwd;}
78 | //----------------------------------------------------------------------------
79 | void errorHalt_P(PGM_P msg);
80 | void errorPrint_P(PGM_P msg);
81 | void initErrorHalt_P(PGM_P msg);
82 | void initErrorPrint_P(PGM_P msg);
83 | //----------------------------------------------------------------------------
84 |
85 | private:
86 | Sd2Card m_card;
87 | SdVolume m_vol;
88 | SdBaseFile m_vwd;
89 | };
90 |
91 |
92 | extern SdVolume volume;
93 |
94 | // 'root' is used for SD card's Root directory file
95 | extern SdFile root;
96 |
97 | #endif // SdFat_h
98 |
--------------------------------------------------------------------------------
/waspmote-api/sd_utilities/SdFile.cpp:
--------------------------------------------------------------------------------
1 | /* Arduino SdFat Library
2 | * Copyright (C) 2012 by William Greiman
3 | * Modified for Waspmote by Libelium, 2016
4 | *
5 | * This file is part of the Arduino SdFat Library
6 | *
7 | * This Library is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This Library is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with the Arduino SdFat Library. If not, see
19 | * .
20 | *
21 | * Version: 3.0
22 | *
23 | */
24 | #include "SdFile.h"
25 | /** Create a file object and open it in the current working directory.
26 | *
27 | * \param[in] path A path with a valid 8.3 DOS name for a file to be opened.
28 | *
29 | * \param[in] oflag Values for \a oflag are constructed by a bitwise-inclusive
30 | * OR of open flags. see SdBaseFile::open(SdBaseFile*, const char*, uint8_t).
31 | */
32 | SdFile::SdFile(const char* path, uint8_t oflag) : SdBaseFile(path, oflag) {
33 | }
34 | //------------------------------------------------------------------------------
35 | /** Write data to an open file.
36 | *
37 | * \note Data is moved to the cache but may not be written to the
38 | * storage device until sync() is called.
39 | *
40 | * \param[in] buf Pointer to the location of the data to be written.
41 | *
42 | * \param[in] nbyte Number of bytes to write.
43 | *
44 | * \return For success write() returns the number of bytes written, always
45 | * \a nbyte. If an error occurs, write() returns -1. Possible errors
46 | * include write() is called before a file has been opened, write is called
47 | * for a read-only file, device is full, a corrupt file system or an I/O error.
48 | *
49 | */
50 | int SdFile::write(const void* buf, size_t nbyte) {
51 | return SdBaseFile::write(buf, nbyte);
52 | }
53 | //------------------------------------------------------------------------------
54 | /** Write a byte to a file. Required by the Arduino Print class.
55 | * \param[in] b the byte to be written.
56 | * Use getWriteError to check for errors.
57 | * \return 1 for success and 0 for failure.
58 | */
59 | size_t SdFile::write(uint8_t b) {
60 | return SdBaseFile::write(&b, 1) == 1 ? 1 : 0;
61 | }
62 | //------------------------------------------------------------------------------
63 | /** Write a string to a file. Used by the Arduino Print class.
64 | * \param[in] str Pointer to the string.
65 | * Use getWriteError to check for errors.
66 | * \return count of characters written for success or -1 for failure.
67 | */
68 | int SdFile::write(const char* str) {
69 | return SdBaseFile::write(str, strlen(str));
70 | }
71 | //------------------------------------------------------------------------------
72 | /** Write a PROGMEM string to a file.
73 | * \param[in] str Pointer to the PROGMEM string.
74 | * Use getWriteError to check for errors.
75 | */
76 | void SdFile::write_P(PGM_P str) {
77 | for (uint8_t c; (c = pgm_read_byte(str)); str++) write(c);
78 | }
79 | //------------------------------------------------------------------------------
80 | /** Write a PROGMEM string followed by CR/LF to a file.
81 | * \param[in] str Pointer to the PROGMEM string.
82 | * Use getWriteError to check for errors.
83 | */
84 | void SdFile::writeln_P(PGM_P str) {
85 | write_P(str);
86 | write_P(PSTR("\r\n"));
87 | }
88 |
--------------------------------------------------------------------------------
/waspmote-api/sd_utilities/SdFile.h:
--------------------------------------------------------------------------------
1 | /* Arduino SdFat Library
2 | * Copyright (C) 2012 by William Greiman
3 | * Modified for Waspmote by Libelium, 2016
4 | *
5 | * This file is part of the Arduino SdFat Library
6 | *
7 | * This Library is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This Library is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with the Arduino SdFat Library. If not, see
19 | * .
20 | *
21 | * Version: 3.0
22 | *
23 | */
24 | /**
25 | * \file
26 | * \brief SdFile class
27 | */
28 | #include "SdBaseFile.h"
29 | #ifndef SdFile_h
30 | #define SdFile_h
31 | //------------------------------------------------------------------------------
32 | /**
33 | * \class SdFile
34 | * \brief SdBaseFile with Print.
35 | */
36 | class SdFile : public SdBaseFile {
37 | public:
38 | SdFile() {}
39 | SdFile(const char* name, uint8_t oflag);
40 | #if DESTRUCTOR_CLOSES_FILE
41 | ~SdFile() {}
42 | #endif // DESTRUCTOR_CLOSES_FILE
43 | /** \return value of writeError */
44 | bool getWriteError() {return SdBaseFile::getWriteError();}
45 | /** Set writeError to zero */
46 | void clearWriteError() {SdBaseFile::clearWriteError();}
47 | size_t write(uint8_t b);
48 | int write(const char* str);
49 | int write(const void* buf, size_t nbyte);
50 | void write_P(PGM_P str);
51 | void writeln_P(PGM_P str);
52 | };
53 |
54 |
55 | #endif // SdFile_h
56 |
--------------------------------------------------------------------------------
/waspmote-api/sd_utilities/bufstream.h:
--------------------------------------------------------------------------------
1 | /* Arduino SdFat Library
2 | * Copyright (C) 2012 by William Greiman
3 | * Modified for Waspmote by Libelium, 2016
4 | *
5 | * This file is part of the Arduino SdFat Library
6 | *
7 | * This Library is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This Library is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with the Arduino SdFat Library. If not, see
19 | * .
20 | *
21 | * Version: 3.0
22 | *
23 | */
24 | #ifndef bufstream_h
25 | #define bufstream_h
26 | /**
27 | * \file
28 | * \brief \ref ibufstream and \ref obufstream classes
29 | */
30 | #include
31 | //==============================================================================
32 | /**
33 | * \class ibufstream
34 | * \brief parse a char string
35 | */
36 | class ibufstream : public istream {
37 | public:
38 | /** Constructor */
39 | ibufstream() : m_buf(0), m_len(0) {}
40 | /** Constructor
41 | * \param[in] str pointer to string to be parsed
42 | * Warning: The string will not be copied so must stay in scope.
43 | */
44 | explicit ibufstream(const char* str) {
45 | init(str);
46 | }
47 | /** Initialize an ibufstream
48 | * \param[in] str pointer to string to be parsed
49 | * Warning: The string will not be copied so must stay in scope.
50 | */
51 | void init(const char* str) {
52 | m_buf = str;
53 | m_len = strlen(m_buf);
54 | m_pos = 0;
55 | clear();
56 | }
57 |
58 | protected:
59 | /// @cond SHOW_PROTECTED
60 | int16_t getch() {
61 | if (m_pos < m_len) return m_buf[m_pos++];
62 | setstate(eofbit);
63 | return -1;
64 | }
65 | void getpos(FatPos_t *pos) {
66 | pos->position = m_pos;
67 | }
68 | bool seekoff(off_type off, seekdir way) {return false;}
69 | bool seekpos(pos_type pos) {
70 | if (pos < m_len) {
71 | m_pos = pos;
72 | return true;
73 | }
74 | return false;
75 | }
76 | void setpos(FatPos_t *pos) {
77 | m_pos = pos->position;
78 | }
79 | pos_type tellpos() {
80 | return m_pos;
81 | }
82 | /// @endcond
83 | private:
84 | const char* m_buf;
85 | size_t m_len;
86 | size_t m_pos;
87 | };
88 | //==============================================================================
89 | /**
90 | * \class obufstream
91 | * \brief format a char string
92 | */
93 | class obufstream : public ostream {
94 | public:
95 | /** constructor */
96 | obufstream() : m_in(0) {}
97 | /** Constructor
98 | * \param[in] buf buffer for formatted string
99 | * \param[in] size buffer size
100 | */
101 | obufstream(char *buf, size_t size) {
102 | init(buf, size);
103 | }
104 | /** Initialize an obufstream
105 | * \param[in] buf buffer for formatted string
106 | * \param[in] size buffer size
107 | */
108 | void init(char *buf, size_t size) {
109 | m_buf = buf;
110 | buf[0] = '\0';
111 | m_size = size;
112 | m_in = 0;
113 | }
114 | /** \return a pointer to the buffer */
115 | char* buf() {return m_buf;}
116 | /** \return the length of the formatted string */
117 | size_t length() {return m_in;}
118 |
119 | protected:
120 | /// @cond SHOW_PROTECTED
121 | void putch(char c) {
122 | if (m_in >= (m_size - 1)) {
123 | setstate(badbit);
124 | return;
125 | }
126 | m_buf[m_in++] = c;
127 | m_buf[m_in]= '\0';
128 | }
129 | void putstr(const char *str) {
130 | while (*str) putch(*str++);
131 | }
132 | bool seekoff(off_type off, seekdir way) {return false;}
133 | bool seekpos(pos_type pos) {
134 | if (pos > m_in) return false;
135 | m_in = pos;
136 | m_buf[m_in] = '\0';
137 | return true;
138 | }
139 | bool sync() {return true;}
140 |
141 | pos_type tellpos() {
142 | return m_in;
143 | }
144 | /// @endcond
145 | private:
146 | char *m_buf;
147 | size_t m_size;
148 | size_t m_in;
149 | };
150 | #endif // bufstream_h
151 |
--------------------------------------------------------------------------------
/waspmote-api/wiring_digital.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005-2006 David A. Mellis
3 | * Modified for Waspmote, 2016.
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 2.1 of the License, or
8 | * (at your option) any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | *
18 | * Version: 3.0
19 | */
20 |
21 |
22 | #include "wiring_private.h"
23 | #include "pins_waspmote.h"
24 |
25 | void pinMode(uint8_t pin, uint8_t mode)
26 | {
27 | uint8_t bit = digitalPinToBitMask(pin);
28 | uint8_t port = digitalPinToPort(pin);
29 | volatile uint8_t *reg;
30 |
31 | if (port == NOT_A_PIN) return;
32 |
33 | // JWS: can I let the optimizer do this?
34 | reg = portModeRegister(port);
35 |
36 | if (mode == INPUT) *reg &= ~bit;
37 | else *reg |= bit;
38 | }
39 |
40 | // Forcing this inline keeps the callers from having to push their own stuff
41 | // on the stack. It is a good performance win and only takes 1 more byte per
42 | // user than calling. (It will take more bytes on the 168.)
43 | //
44 | // But shouldn't this be moved into pinMode? Seems silly to check and do on
45 | // each digitalread or write.
46 | //
47 | static inline void turnOffPWM(uint8_t timer) __attribute__ ((always_inline));
48 | static inline void turnOffPWM(uint8_t timer)
49 | {
50 | if (timer == TIMER1A) cbi(TCCR1A, COM1A1);
51 | if (timer == TIMER1B) cbi(TCCR1A, COM1B1);
52 |
53 | #if defined(__AVR_ATmega168__)
54 | if (timer == TIMER0A) cbi(TCCR0A, COM0A1);
55 | if (timer == TIMER0B) cbi(TCCR0A, COM0B1);
56 | if (timer == TIMER2A) cbi(TCCR2A, COM2A1);
57 | if (timer == TIMER2B) cbi(TCCR2A, COM2B1);
58 | #elif defined(__AVR_ATmega1281__)
59 | if (timer == TIMER0A) cbi(TCCR0A, COM0A1);
60 | if (timer == TIMER0B) cbi(TCCR0A, COM0B1);
61 | if (timer == TIMER2A) cbi(TCCR2A, COM2A1);
62 | if (timer == TIMER2B) cbi(TCCR2A, COM2B1);
63 | #else
64 | if (timer == TIMER2) cbi(TCCR2, COM21);
65 | #endif
66 | }
67 |
68 | void digitalWrite(uint8_t pin, uint8_t val)
69 | {
70 | uint8_t timer = digitalPinToTimer(pin);
71 | uint8_t bit = digitalPinToBitMask(pin);
72 | uint8_t port = digitalPinToPort(pin);
73 | volatile uint8_t *out;
74 |
75 | if (port == NOT_A_PIN) return;
76 |
77 | // If the pin that support PWM output, we need to turn it off
78 | // before doing a digital write.
79 | if (timer != NOT_ON_TIMER) turnOffPWM(timer);
80 |
81 | out = portOutputRegister(port);
82 |
83 | if (val == LOW) *out &= ~bit;
84 | else *out |= bit;
85 | }
86 |
87 | int digitalRead(uint8_t pin)
88 | {
89 | uint8_t timer = digitalPinToTimer(pin);
90 | uint8_t bit = digitalPinToBitMask(pin);
91 | uint8_t port = digitalPinToPort(pin);
92 |
93 | if (port == NOT_A_PIN) return LOW;
94 |
95 | // If the pin that support PWM output, we need to turn it off
96 | // before getting a digital reading.
97 | if (timer != NOT_ON_TIMER) turnOffPWM(timer);
98 |
99 | if (*portInputRegister(port) & bit) return HIGH;
100 | return LOW;
101 | }
102 |
--------------------------------------------------------------------------------
/waspmote-api/wiring_private.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005-2006 David A. Mellis
3 | * Modified for Waspmote by Libelium, 2016
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 2.1 of the License, or
8 | * (at your option) any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | *
18 | * Version: 3.0
19 | *
20 | */
21 |
22 |
23 | #ifndef WiringPrivate_h
24 | #define WiringPrivate_h
25 |
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 |
32 | #include "wiring.h"
33 |
34 | #ifndef __WASPCONSTANTS_H__
35 | #include "WaspConstants.h"
36 | #endif
37 |
38 | #ifdef __cplusplus
39 | extern "C"{
40 | #endif
41 |
42 | #ifndef cbi
43 | #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
44 | #endif
45 | #ifndef sbi
46 | #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
47 | #endif
48 |
49 | #define EXTERNAL_INT_0 0
50 | #define EXTERNAL_INT_1 1
51 | #define EXTERNAL_INT_2 2
52 | #define EXTERNAL_INT_3 3
53 | #define EXTERNAL_INT_4 4
54 | #define EXTERNAL_INT_5 5
55 | #define EXTERNAL_INT_6 6
56 | #define EXTERNAL_INT_7 7
57 |
58 | #define EXTERNAL_NUM_INTERRUPTS 8
59 |
60 | typedef void (*voidFuncPtr)(void);
61 |
62 | #ifdef __cplusplus
63 | } // extern "C"
64 | #endif
65 |
66 | #endif
67 |
--------------------------------------------------------------------------------
/waspmote-api/wiring_pulse.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005-2006 David A. Mellis
3 | * Modified for Waspmote, 2016.
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 2.1 of the License, or
8 | * (at your option) any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | *
18 | * Version: 3.0
19 | */
20 |
21 |
22 | #include "wiring_private.h"
23 | #include "pins_waspmote.h"
24 |
25 | /* Measures the length (in microseconds) of a pulse on the pin; state is HIGH
26 | * or LOW, the type of pulse to measure. Works on pulses from 10 microseconds
27 | * to 3 minutes in length, but must be called at least N microseconds before
28 | * the start of the pulse. */
29 | float pulseIn(uint8_t pin, uint8_t state)
30 | {
31 | // cache the port and bit of the pin in order to speed up the
32 | // pulse width measuring loop and achieve finer resolution. calling
33 | // digitalRead() instead yields much coarser resolution.
34 | uint8_t bit = digitalPinToBitMask(pin);
35 | uint8_t port = digitalPinToPort(pin);
36 | uint8_t stateMask = (state ? bit : 0);
37 | unsigned long width = 0; // keep initialization out of time critical area
38 |
39 | // wait for the pulse to start
40 | while ((*portInputRegister(port) & bit) != stateMask)
41 | ;
42 |
43 | // wait for the pulse to stop
44 | while ((*portInputRegister(port) & bit) == stateMask)
45 | width++;
46 |
47 | // convert the reading to microseconds. The loop has been determined
48 | // to be 10 clock cycles long and have about 12 clocks between the edge
49 | // and the start of the loop. There will be some error introduced by
50 | // the interrupt handlers.
51 | float clockCyclesPerMicrosecond = (float)F_CPU / (float)1000000;
52 | return (width * 10 + 12)/clockCyclesPerMicrosecond;
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/waspmote-api/wiring_shift.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005-2006 David A. Mellis
3 | * Modified for Waspmote by Libelium, 2016
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU Lesser General Public License as published by
7 | * the Free Software Foundation, either version 2.1 of the License, or
8 | * (at your option) any later version.
9 |
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * along with this program. If not, see .
17 | *
18 | * Version: 3.0
19 | */
20 |
21 | #include "wiring_private.h"
22 |
23 | void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, byte val)
24 | {
25 | int i;
26 |
27 | for (i = 0; i < 8; i++) {
28 | if (bitOrder == LSBFIRST)
29 | digitalWrite(dataPin, !!(val & (1 << i)));
30 | else
31 | digitalWrite(dataPin, !!(val & (1 << (7 - i))));
32 |
33 | digitalWrite(clockPin, HIGH);
34 | digitalWrite(clockPin, LOW);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------