├── LICENSE ├── README.md ├── hardware ├── AnduinoSubG │ ├── Anduino_v1.1_layout.pdf │ ├── Anduino_v1.1_schematic.pdf │ └── grb │ │ ├── arduino_twix_v1.1 centroid.csv │ │ ├── arduino_twix_v1.1.drd │ │ ├── arduino_twix_v1.1_bottom.grb │ │ ├── arduino_twix_v1.1_dimensions.grb │ │ ├── arduino_twix_v1.1_inner_ly15.grb │ │ ├── arduino_twix_v1.1_inner_ly2.grb │ │ ├── arduino_twix_v1.1_paste_bottom.grb │ │ ├── arduino_twix_v1.1_paste_top.grb │ │ ├── arduino_twix_v1.1_silk_bot.grb │ │ ├── arduino_twix_v1.1_silk_top.grb │ │ ├── arduino_twix_v1.1_sol_mask_bottom.grb │ │ ├── arduino_twix_v1.1_sol_mask_top.grb │ │ └── arduino_twix_v1.1_top.grb ├── AnduinoWiFi │ ├── anduino_wifi_v1.0_sch.pdf │ ├── anduino_wifi_v1.0_top.pdf │ └── grb │ │ ├── centroid.tsv │ │ ├── centroid_th.tsv │ │ ├── copper-bottom.pho │ │ ├── copper-top.pho │ │ ├── doc-bottom.pho │ │ ├── doc-top.pho │ │ ├── drill-dri.dri │ │ ├── drill.drl │ │ ├── mill.pho │ │ ├── outline.pho │ │ ├── silkscreen-bottom.pho │ │ ├── silkscreen-top.pho │ │ ├── solder-mask-bottom.pho │ │ ├── solder-mask-top.pho │ │ ├── stencil-bottom.pho │ │ └── stencil-top.pho └── Readme.md ├── libraries ├── AnduinoEEPROM │ ├── LICENSE.md │ ├── README.md │ ├── examples │ │ ├── loadLogoEEPROM │ │ │ └── loadLogoEEPROM.ino │ │ ├── printEEPROM │ │ │ └── printEEPROM.ino │ │ └── wbyteRbyte │ │ │ └── wbyteRbyte.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── AndiumLogoFullEEPROM.c │ │ ├── AnduinoEEPROM.cpp │ │ ├── AnduinoEEPROM.h │ │ ├── GimpImageFormat.h │ │ └── andiumLogo160*128.png ├── AnduinoLCD │ ├── LICENSE.md │ ├── README.md │ ├── examples │ │ ├── digitalGauge │ │ │ └── digitalGauge.ino │ │ ├── splashScreen │ │ │ └── splashScreen.ino │ │ └── waveform │ │ │ └── waveform.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── Adafruit_GFX.cpp │ │ ├── Adafruit_GFX.h │ │ ├── Adafruit_ST7735.cpp │ │ ├── Adafruit_ST7735.h │ │ ├── AndiumBanner.c │ │ ├── AndiumLogoFull.c │ │ ├── AnduinoErrorCodes.h │ │ ├── AnduinoLCD.cpp │ │ ├── AnduinoLCD.h │ │ ├── GimpImageFormat.h │ │ ├── PImage.h │ │ ├── andiumBanner160*36.png │ │ ├── andiumLogo160*128.png │ │ ├── gfxfont.h │ │ └── glcdfont.c ├── AnduinoNFC │ ├── LICENSE.md │ ├── README.md │ ├── examples │ │ ├── eraseNDEFRecord │ │ │ └── eraseNDEFRecord.ino │ │ ├── formatToNDEF │ │ │ └── formatToNDEF.ino │ │ ├── keycardAccess │ │ │ └── keycardAccess.ino │ │ ├── nfcColorSelect │ │ │ └── nfcColorSelect.ino │ │ ├── readRFIDtag │ │ │ └── readRFIDtag.ino │ │ ├── revertToClassic │ │ │ └── revertToClassic.ino │ │ └── writeNDEFrecord │ │ │ └── writeNDEFrecord.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── AnduinoNFC.cpp │ │ ├── AnduinoNFC.h │ │ ├── Mifare │ │ ├── MifareClassic.cpp │ │ ├── MifareClassic.h │ │ ├── MifareUltralight.cpp │ │ ├── MifareUltralight.h │ │ └── license.txt │ │ ├── NDEF │ │ ├── Due.h │ │ ├── Ndef.cpp │ │ ├── Ndef.h │ │ ├── NdefMessage.cpp │ │ ├── NdefMessage.h │ │ ├── NdefRecord.cpp │ │ ├── NdefRecord.h │ │ └── license.txt │ │ ├── NFC │ │ ├── NfcTag.cpp │ │ ├── NfcTag.h │ │ └── license.txt │ │ └── PN532 │ │ ├── AnduinoInterface.cpp │ │ ├── AnduinoInterface.h │ │ ├── PN532.cpp │ │ ├── PN532.h │ │ ├── PN532Interface.h │ │ ├── PN532_debug.h │ │ └── license.txt ├── AnduinoPins │ ├── AnduinoPins.h │ └── library.properties └── AnduinoWiFi │ ├── LICENSE.md │ ├── README.md │ ├── examples │ ├── AP_SimpleWebServer │ │ └── AP_SimpleWebServer.ino │ ├── CheckWifi101FirmwareVersion │ │ └── CheckWifi101FirmwareVersion.ino │ ├── ConnectNoEncryption │ │ └── ConnectNoEncryption.ino │ ├── ConnectWithWEP │ │ └── ConnectWithWEP.ino │ ├── ConnectWithWPA │ │ └── ConnectWithWPA.ino │ ├── FirmwareUpdater │ │ ├── Endianess.ino │ │ └── FirmwareUpdater.ino │ ├── MDNS_WiFiWebServer │ │ └── MDNS_WiFiWebServer.ino │ ├── Provisioning_WiFiWebServer │ │ └── Provisioning_WiFiWebServer.ino │ ├── ScanNetworks │ │ └── ScanNetworks.ino │ ├── ScanNetworksAdvanced │ │ └── ScanNetworksAdvanced.ino │ ├── SimpleWebServerWiFi │ │ └── SimpleWebServerWiFi.ino │ ├── WiFiChatServer │ │ └── WiFiChatServer.ino │ ├── WiFiPing │ │ └── WiFiPing.ino │ ├── WiFiSSLClient │ │ └── WiFiSSLClient.ino │ ├── WiFiUdpNtpClient │ │ └── WiFiUdpNtpClient.ino │ ├── WiFiUdpSendReceiveString │ │ └── WiFiUdpSendReceiveString.ino │ ├── WiFiWebClient │ │ └── WiFiWebClient.ino │ ├── WiFiWebClientRepeating │ │ └── WiFiWebClientRepeating.ino │ ├── WiFiWebServer │ │ └── WiFiWebServer.ino │ └── connectToWiFi │ │ └── connectToWiFi.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ ├── AnduinoAP.cpp │ ├── AnduinoAP.h │ ├── AnduinoWiFi.h │ ├── CHANGELOG │ ├── WiFi.cpp │ ├── WiFiClient.cpp │ ├── WiFiClient.h │ ├── WiFiMDNSResponder.cpp │ ├── WiFiMDNSResponder.h │ ├── WiFiSSLClient.cpp │ ├── WiFiSSLClient.h │ ├── WiFiServer.cpp │ ├── WiFiServer.h │ ├── WiFiUdp.cpp │ ├── WiFiUdp.h │ ├── bsp │ ├── include │ │ ├── nm_bsp.h │ │ ├── nm_bsp_arduino.h │ │ ├── nm_bsp_avr.h │ │ ├── nm_bsp_internal.h │ │ └── nm_bsp_samd21.h │ └── source │ │ ├── nm_bsp_arduino.c │ │ └── nm_bsp_arduino_avr.c │ ├── bus_wrapper │ ├── include │ │ └── nm_bus_wrapper.h │ └── source │ │ └── nm_bus_wrapper_samd21.cpp │ ├── common │ ├── include │ │ ├── nm_common.h │ │ └── nm_debug.h │ └── source │ │ └── nm_common.c │ ├── driver │ ├── include │ │ ├── m2m_ota.h │ │ ├── m2m_periph.h │ │ ├── m2m_types.h │ │ └── m2m_wifi.h │ └── source │ │ ├── m2m_hif.c │ │ ├── m2m_hif.h │ │ ├── m2m_ota.c │ │ ├── m2m_periph.c │ │ ├── m2m_wifi.c │ │ ├── nmasic.c │ │ ├── nmasic.h │ │ ├── nmbus.c │ │ ├── nmbus.h │ │ ├── nmdrv.c │ │ ├── nmdrv.h │ │ ├── nmi2c.c │ │ ├── nmi2c.h │ │ ├── nmspi.c │ │ ├── nmspi.h │ │ ├── nmuart.c │ │ └── nmuart.h │ ├── socket │ ├── include │ │ ├── m2m_socket_host_if.h │ │ ├── socket.h │ │ └── socket_buffer.h │ └── source │ │ ├── socket.c │ │ ├── socket_buffer.c │ │ └── socket_internal.h │ └── spi_flash │ ├── include │ ├── spi_flash.h │ └── spi_flash_map.h │ └── source │ └── spi_flash.c ├── projects ├── Amazon_Dash_Replenishment │ ├── README.md │ └── nfcReplenisher │ │ └── nfcReplenisher.ino ├── AnduinoWiFi_Getting_Started │ └── README.md ├── Anduino_to_AdafruitIO │ ├── Anduino_to_AdafruitIO │ │ └── Anduino_to_AdafruitIO.ino │ └── README.md ├── Anduino_to_IFTTT │ └── README.md ├── Co2_Levels │ ├── Co2_Levels │ │ └── Co2_Levels.ino │ └── README.md ├── README.md ├── RFID_keycard │ ├── README.md │ └── keycardAccess │ │ └── keycardAccess.ino ├── Soil_Moisture │ ├── README.md │ └── soil_moisture │ │ └── soil_moisture.ino └── WiFi_Registration │ ├── README.md │ ├── connectToWiFi │ └── connectToWiFi.ino │ └── src │ ├── AnduinoWiFi.cpp │ └── AnduinoWiFi.h └── wiki_assets ├── AnduinoEEPROM.png ├── AnduinoLCDlanding.png ├── AnduinoNFC.gif ├── Anduino_v1_1_diagram.jpg ├── anduinoWiFi_transbak.png ├── arduino_open_source.png ├── arduino_os.png ├── banner.png ├── fullscreenLogo.png ├── graphy.gif ├── landingpageAnduino.JPG ├── lcdPrint.png ├── open_source_hardware.png ├── sensorVal.JPG └── splashScreen.gif /README.md: -------------------------------------------------------------------------------- 1 | # Anduino 2 | 3 | ## Andium Open Source for Arduino -- [Buy an Anduino Shield!](https://store.andium.com) 4 | ![](https://github.com/andium/Anduino/blob/master/wiki_assets/arduino_open_source.png) 5 | 6 | This repo supports our Andium 'Anduino' Shield, check out the [wiki](https://github.com/andium/Anduino/wiki) for more info and how to get started! 7 | 8 | ![](https://github.com/andium/Anduino/blob/master/wiki_assets/Anduino_v1_1_diagram.jpg) 9 | 10 | -------------------------------------------------------------------------------- /hardware/AnduinoSubG/Anduino_v1.1_layout.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/hardware/AnduinoSubG/Anduino_v1.1_layout.pdf -------------------------------------------------------------------------------- /hardware/AnduinoSubG/Anduino_v1.1_schematic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/hardware/AnduinoSubG/Anduino_v1.1_schematic.pdf -------------------------------------------------------------------------------- /hardware/AnduinoSubG/grb/arduino_twix_v1.1 centroid.csv: -------------------------------------------------------------------------------- 1 | SMD component position file. 2 | 3 | Measurements are in inches. Comma delimited 4 | Only surface mount components included 5 | 6 | RefDes,Layer,LocationX,LocationY,Rotation 7 | C1,Top,0.931,0.200,90 8 | C2,Top,0.706,0.163,270 9 | C3,Top,1.000,-0.325,90 10 | C4,Top,0.838,-0.325,270 11 | C5,Top,0.938,-0.438,180 12 | C6,Top,0.950,-0.325,90 13 | C7,Top,0.600,0.840,180 14 | C8,Top,0.725,1.035,90 15 | C9,Top,0.588,0.785,180 16 | C10,Top,0.620,0.950,180 17 | C11,Top,0.990,0.910,0 18 | C12,Top,1.000,0.810,0 19 | C13,Top,0.695,0.640,270 20 | C14,Top,0.810,0.655,270 21 | C15,Top,1.020,0.760,0 22 | C16,Top,0.583,-0.033,0 23 | C17,Top,1.062,0.237,90 24 | C18,Top,0.525,0.750,180 25 | C19,Top,0.610,0.890,180 26 | C20,Top,0.765,1.035,90 27 | C21,Top,0.880,0.645,0 28 | C22,Top,1.080,0.990,180 29 | C23,Top,1.160,0.990,0 30 | C24,Top,1.160,0.950,0 31 | C25,Top,0.690,0.985,270 32 | C26,Top,0.560,0.520,180 33 | C27,Top,0.470,0.640,270 34 | C28,Top,0.950,1.300,180 35 | C29,Top,0.990,1.000,0 36 | C30,Top,1.030,1.250,0 37 | C31,Top,0.875,1.060,90 38 | C32,Top,0.805,1.060,90 39 | C33,Top,1.054,1.060,90 40 | C34,Top,0.990,1.120,0 41 | C35,Top,1.113,0.000,180 42 | C36,Top,1.087,0.062,180 43 | C37,Top,1.113,0.113,0 44 | C38,Top,1.050,-0.325,90 45 | C39,Top,1.125,-0.325,90 46 | C40,Top,1.225,-0.188,90 47 | C41,Top,1.225,-0.013,90 48 | C42,Top,1.312,-0.037,0 49 | C43,Top,1.312,-0.163,0 50 | C44,Top,1.400,-0.188,270 51 | C45,Top,1.400,-0.013,270 52 | C46,Top,0.438,-1.075,90 53 | C47,Top,0.275,-0.850,0 54 | C48,Top,1.525,-0.975,180 55 | C49,Top,1.525,-0.550,180 56 | C50,Top,1.538,0.450,270 57 | FB1,Top,1.200,0.212,180 58 | FB2,Top,1.087,-0.450,0 59 | L1,Top,0.980,0.950,0 60 | L2,Top,0.855,1.005,180 61 | L3,Top,1.010,1.060,90 62 | L4,Top,1.010,1.190,90 63 | L5,Top,0.950,1.250,180 64 | L6,Top,0.910,1.060,90 65 | L7,Top,0.840,1.060,90 66 | L8,Top,0.880,1.120,0 67 | L9,Top,1.125,-0.163,180 68 | L10,Top,1.125,-0.075,180 69 | P1,Top,0.610,1.310,180 70 | P2,Top,1.613,-0.087,0 71 | Q1,Top,0.825,0.188,180 72 | Q2,Top,0.555,0.635,270 73 | Q4,Top,1.229,-1.290,90 74 | R1,Top,0.625,0.062,0 75 | R2,Top,0.625,0.113,0 76 | R3,Top,1.000,0.860,0 77 | R4,Top,0.660,0.580,0 78 | R5,Top,1.080,0.950,0 79 | R6,Top,0.830,1.250,0 80 | R7,Top,1.050,0.125,90 81 | R8,Top,1.212,0.100,90 82 | R9,Top,1.462,-0.163,180 83 | R10,Top,1.462,-0.037,180 84 | R11,Top,0.500,-0.013,270 85 | R12,Top,0.723,-0.290,180 86 | R13,Top,1.109,-1.319,270 87 | R14,Top,1.409,-1.296,90 88 | R15,Top,1.725,-0.700,0 89 | R16,Top,1.725,-0.600,0 90 | R17,Top,1.650,0.163,0 91 | R18,Top,0.625,-1.050,270 92 | R19,Top,1.700,0.775,0 93 | R20,Top,1.700,0.637,0 94 | R21,Top,1.700,0.825,180 95 | R22,Top,1.700,0.725,0 96 | U1,Top,0.843,-0.087,180 97 | U2,Top,0.805,0.820,90 98 | U4,Top,1.512,-0.838,90 99 | U5,Top,1.512,-0.412,90 100 | U6,Top,1.650,0.438,0 101 | U7,Top,0.225,-1.075,180 102 | -------------------------------------------------------------------------------- /hardware/AnduinoSubG/grb/arduino_twix_v1.1_paste_bottom.grb: -------------------------------------------------------------------------------- 1 | G75* 2 | G70* 3 | %OFA0B0*% 4 | %FSLAX24Y24*% 5 | %IPPOS*% 6 | %LPD*% 7 | %AMOC8* 8 | 5,1,8,0,0,1.08239X$1,22.5* 9 | % 10 | M02* 11 | -------------------------------------------------------------------------------- /hardware/AnduinoWiFi/anduino_wifi_v1.0_sch.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/hardware/AnduinoWiFi/anduino_wifi_v1.0_sch.pdf -------------------------------------------------------------------------------- /hardware/AnduinoWiFi/anduino_wifi_v1.0_top.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/hardware/AnduinoWiFi/anduino_wifi_v1.0_top.pdf -------------------------------------------------------------------------------- /hardware/AnduinoWiFi/grb/centroid.tsv: -------------------------------------------------------------------------------- 1 | NXP/PN5321A3HN/C106;55 U1 21.399 -2.223 180 2 | AVX/CX3225GB27120P0HPQCC Q1 20.955 4.763 180 3 | MURATA/GRM1555C1H150JA01D C2 17.939 4.128 270 4 | MURATA/GRM1555C1H150JA01D C1 23.654 5.08 90 5 | KS/RK73Z1ETTP R1 15.875 1.588 0 6 | KS/RK73Z1ETTP R2 15.875 2.857 0 7 | KS/RK73Z1ETTP R23 1.19 -7.73 90 8 | MURATA/GRM188R61A106KE69D C17 26.988 6.033 90 9 | MURATA/GRM188R61A106KE69D C39 28.575 -8.255 90 10 | MURATA/GRM188R61A106KE69D C4 20.955 -7.938 270 11 | MURATA/GRM188R61A106KE69D C5 23.336 -10.478 180 12 | MURATA/GRM155R61A104KA01D C49 38.1 -13.811 180 13 | MURATA/GRM155R61A104KA01D C16 14.796 -0.826 0 14 | MURATA/GRM155R61A104KA01D C7 30.385 -15.462 90 15 | MURATA/GRM155R61A104KA01D C6 24.13 -7.938 90 16 | MURATA/GRM155R61A104KA01D C50 39.053 11.43 270 17 | MURATA/GRM155R61A104KA01D C48 38.735 -24.765 180 18 | MURATA/GRM155R61A104KA01D C3 25.4 -7.938 90 19 | MURATA/GRM155R61A104KA01D C35 28.258 0 180 20 | MURATA/GRM155R61A104KA01D C36 27.623 1.588 180 21 | MURATA/GRM155R61A104KA01D C38 26.67 -8.255 90 22 | MURATA/GRM155R61A104KA01D C8 40.799 -16.034 0 23 | YAGEO2/RC0402FR-071KL R7 26.67 3.175 90 24 | MURATA/GRM155R71H152JA01D C37 28.258 2.857 0 25 | YAGEO/RC0402JR-071K6L R8 30.798 2.54 90 26 | YAGEO/RC0402JR-071K6L R14 35.782 -32.925 90 27 | TDK/MLF2012DR56K L10 28.575 -1.905 180 28 | TDK/MLF2012DR56K L9 28.575 -4.128 180 29 | MURATA/GRM1555C1H221JA01D C40 31.115 -4.763 90 30 | MURATA/GRM1555C1H221JA01D C41 31.115 -0.318 90 31 | MURATA/GRM1555C1H220JA01D C42 33.337 -0.953 0 32 | MURATA/GRM1555C1H220JA01D C43 33.337 -4.128 0 33 | MURATA/GRM1555C1H560JA01D C44 35.56 -4.763 270 34 | MURATA/GRM1555C1H560JA01D C45 35.56 -0.318 270 35 | YAGEO/RC0402JR-071R5L R9 37.148 -4.128 180 36 | YAGEO/RC0402JR-071R5L R10 37.148 -0.953 180 37 | TC/1909763-1 P2 40.483 -2.223 0 38 | YAGEO/RC0402JR-0710KL R11 12.7 -0.635 270 39 | TDK/MMZ1608B121C FB1 30.48 5.397 180 40 | TDK/MMZ1608B121C FB2 30.48 -8.731 90 41 | TI/SN74LV4T125PWR U2 25.082 -17.304 270 42 | TI/SN74LV4T125PWR U5 38.418 -10.478 90 43 | TI/SN74LV4T125PWR U4 38.259 -21.431 90 44 | STACKPOLE/RMCF0402FT100K R24 28.841 25.889 270 45 | STACKPOLE/RMCF0402FT100K R12 18.034 -7.366 180 46 | STACKPOLE/RMCF0402FT100K R3 13.079 17.734 270 47 | KS/RK73H1ETTP10R0F R13 28.48 -33.496 270 48 | NXP/BC807-40,215 Q4 31.21 -32.766 90 49 | STMICRO/M24256-BRDW6TP U6 41.91 11.113 0 50 | DIODES/ZLDO1117G33TA U7 5.715 -27.305 180 51 | MURATA/GRM188R61A106KE69D C46 11.113 -27.305 90 52 | MURATA/GRM188R61A106KE69D C47 6.985 -21.59 0 53 | YAGEO2/RC0402FR-0722RL R20 43.18 16.192 0 54 | YAGEO2/RC0402FR-0722RL R19 43.18 19.685 0 55 | YAGEO/RC0402FR-074K7L R21 39.529 16.193 0 56 | YAGEO/RC0402FR-074K7L R22 43.18 18.415 0 57 | ATMEL/ATWINC1500-MR210PA U3 18.704 28 180 58 | LITEON/LTST-C170KGKT LED3 35 35 270 59 | LITEON/LTST-C170KGKT LED1 35 31 270 60 | LITEON/LTST-C170KGKT LED2 35 33 270 61 | SAMSUNG/RC1005F241CS R6 31 35 0 62 | SAMSUNG/RC1005F241CS R4 31 31 0 63 | SAMSUNG/RC1005F241CS R5 31 33 0 64 | TI/SN74LV1T125DCKR U8 43.497 -15.081 180 65 | -------------------------------------------------------------------------------- /hardware/AnduinoWiFi/grb/centroid_th.tsv: -------------------------------------------------------------------------------- 1 | SULLINS/PPTC081LFBN-RC P9 20.32 -16.867 0 2 | DNP P7 -1.27 -34.29 270 3 | DNP P3 -1.27 -16.51 270 4 | DNP P5 46.99 10.414 90 5 | DNP P6 46.99 -13.97 90 6 | DNP P4 -1.27 3.81 270 7 | AI/85 P8 24.13 -24.257 180 8 | DNP GOLD_ORB_SM2 50.127 -44.653 90 9 | -------------------------------------------------------------------------------- /hardware/AnduinoWiFi/grb/doc-bottom.pho: -------------------------------------------------------------------------------- 1 | G75* 2 | %MOIN*% 3 | %OFA0B0*% 4 | %FSLAX24Y24*% 5 | %IPPOS*% 6 | %LPD*% 7 | %AMOC8* 8 | 5,1,8,0,0,1.08239X$1,22.5* 9 | % 10 | M02* 11 | -------------------------------------------------------------------------------- /hardware/AnduinoWiFi/grb/drill-dri.dri: -------------------------------------------------------------------------------- 1 | Date : 12/21/2016 4:29:38 PM 2 | Drills : generated 3 | Device : Excellon drill station 4 | 5 | Parameter settings: 6 | 7 | Tolerance Drill + : 0.00 % 8 | Tolerance Drill - : 0.00 % 9 | Rotate : no 10 | Mirror : no 11 | Optimize : yes 12 | Auto fit : no 13 | OffsetX : 0inch 14 | OffsetY : 0inch 15 | Layers : Drills Holes 16 | 17 | Drill File Info: 18 | 19 | Data Mode : Absolute 20 | Units : 1/10000 Inch 21 | 22 | Drills used: 23 | 24 | Code Size used 25 | 26 | T01 0.0157inch 148 27 | T02 0.0236inch 2 28 | T03 0.0315inch 14 29 | T04 0.0400inch 56 30 | T05 0.1299inch 4 31 | 32 | Total number of drills: 224 33 | 34 | -------------------------------------------------------------------------------- /hardware/AnduinoWiFi/grb/drill.drl: -------------------------------------------------------------------------------- 1 | % 2 | M48 3 | M72 4 | T01C0.0157 5 | T02C0.0236 6 | T03C0.0315 7 | T04C0.0400 8 | T05C0.1299 9 | % 10 | T01 11 | X3438Y-5938 12 | X3688Y-5250 13 | X4125Y-4625 14 | X3875Y-4000 15 | X3250Y-4313 16 | X4313Y-5812 17 | X5750Y-5750 18 | X6125Y-6063 19 | X6125Y-5125 20 | X6500Y-4625 21 | X6375Y-4000 22 | X6000Y-4313 23 | X6313Y-2125 24 | X6000Y-1813 25 | X5937Y-1375 26 | X5063Y-2125 27 | X4688Y-1813 28 | X4125Y-1375 29 | X5000Y250 30 | X5500Y125 31 | X5625Y1125 32 | X7250Y2250 33 | X7875Y-375 34 | X7875Y-750 35 | X7875Y-1125 36 | X7875Y-1500 37 | X8250Y-1500 38 | X8250Y-1125 39 | X8250Y-750 40 | X8625Y-750 41 | X8625Y-1125 42 | X8625Y-1500 43 | X9000Y-1500 44 | X9000Y-1125 45 | X9000Y-750 46 | X9000Y-375 47 | X8625Y-375 48 | X8250Y-375 49 | X9250Y875 50 | X9750Y1125 51 | X10500Y0 52 | X10250Y-1125 53 | X10250Y-1875 54 | X9875Y-2125 55 | X8875Y-2750 56 | X8375Y-4000 57 | X7688Y-2688 58 | X8188Y-6125 59 | X8188Y-6938 60 | X8250Y-7563 61 | X7750Y-7625 62 | X7375Y-8437 63 | X8500Y-11250 64 | X10000Y-11375 65 | X10375Y-12125 66 | X10750Y-11750 67 | X11375Y-10625 68 | X12250Y-9250 69 | X12250Y-8438 70 | X11938Y-7125 71 | X11500Y-7063 72 | X11500Y-6375 73 | X10313Y-6688 74 | X10250Y-7563 75 | X12313Y-4375 76 | X13000Y-3813 77 | X13375Y-4062 78 | X13000Y-4938 79 | X14125Y-5563 80 | X14000Y-6625 81 | X14813Y-7125 82 | X15250Y-6313 83 | X16000Y-5375 84 | X16438Y-5250 85 | X16938Y-4500 86 | X16938Y-4000 87 | X16875Y-3125 88 | X17500Y-3000 89 | X17313Y-2188 90 | X16938Y-1500 91 | X17125Y-875 92 | X17125Y-125 93 | X17000Y375 94 | X16750Y875 95 | X16500Y375 96 | X16250Y875 97 | X16000Y375 98 | X15750Y875 99 | X15500Y375 100 | X15188Y875 101 | X15000Y375 102 | X14500Y375 103 | X14500Y1000 104 | X14000Y688 105 | X13625Y1250 106 | X13125Y1000 107 | X13250Y500 108 | X12625Y1000 109 | X11750Y375 110 | X11125Y1500 111 | X13125Y-2125 112 | X13562Y-2188 113 | X13250Y-2625 114 | X13000Y-3000 115 | X12750Y-2625 116 | X12625Y-3125 117 | X12250Y-2500 118 | X10875Y-3938 119 | X10063Y-4125 120 | X12875Y-6375 121 | X13125Y-6750 122 | X13312Y-8063 123 | X13312Y-9063 124 | X15375Y-7813 125 | X16313Y-7313 126 | X16688Y-7625 127 | X17625Y-7500 128 | X17500Y-10000 129 | X17125Y-10625 130 | X15937Y-9688 131 | X14625Y-4375 132 | X14500Y-2500 133 | X14500Y-2125 134 | X15000Y-2125 135 | X15125Y-2500 136 | X15500Y-2000 137 | X16000Y-2000 138 | X16438Y-1937 139 | X16313Y-3000 140 | X14000Y-2500 141 | X15375Y3000 142 | X15438Y6750 143 | X16625Y6875 144 | X11500Y7625 145 | X9875Y7625 146 | X8813Y5625 147 | X7875Y5625 148 | X7063Y5625 149 | X7063Y5125 150 | X3250Y1250 151 | X1625Y1250 152 | X375Y1625 153 | X375Y438 154 | X7375Y-13750 155 | X8125Y-13750 156 | X8500Y-14125 157 | X10000Y-14000 158 | X10375Y-13000 159 | T02 160 | X6875Y-12125 161 | X6875Y-10625 162 | T03 163 | X4000Y-9500 164 | X2500Y-12750 165 | X1875Y-12750 166 | X2500Y-14250 167 | X2750Y-3500 168 | X2688Y500 169 | X6125Y188 170 | X7063Y-3500 171 | X6500Y6187 172 | X5938Y7375 173 | X9250Y6188 174 | X10875Y13188 175 | X14813Y13000 176 | X5250Y14938 177 | T04 178 | X-500Y0 179 | X-500Y1000 180 | X-500Y2000 181 | X-500Y3000 182 | X-500Y4000 183 | X-500Y5000 184 | X-500Y-1000 185 | X-500Y-2000 186 | X-500Y-4000 187 | X-500Y-5000 188 | X-500Y-6000 189 | X-500Y-7000 190 | X-500Y-8000 191 | X-500Y-9000 192 | X-500Y-11000 193 | X-500Y-12000 194 | X-500Y-13000 195 | X-500Y-14000 196 | X-500Y-15000 197 | X-500Y-16000 198 | X4500Y-16975 199 | X5500Y-16975 200 | X6500Y-16975 201 | X7500Y-16975 202 | X8500Y-16975 203 | X9500Y-16975 204 | X10500Y-16975 205 | X11500Y-16975 206 | X10500Y-10050 207 | X10500Y-9050 208 | X9500Y-9050 209 | X9500Y-10050 210 | X8500Y-10050 211 | X8500Y-9050 212 | X8500Y3694 213 | X7500Y3694 214 | X6500Y3694 215 | X9500Y3694 216 | X18500Y3600 217 | X18500Y4600 218 | X18500Y5600 219 | X18500Y6600 220 | X18500Y7600 221 | X18500Y8600 222 | X18500Y2600 223 | X18500Y1600 224 | X18500Y600 225 | X18500Y-400 226 | X18500Y-2000 227 | X18500Y-3000 228 | X18500Y-4000 229 | X18500Y-5000 230 | X18500Y-6000 231 | X18500Y-7000 232 | X18500Y-8000 233 | X18500Y-9000 234 | T05 235 | X13610Y-16794 236 | X2390Y-16794 237 | X2390Y3679 238 | X13610Y3679 239 | M30 240 | -------------------------------------------------------------------------------- /hardware/AnduinoWiFi/grb/mill.pho: -------------------------------------------------------------------------------- 1 | G75* 2 | %MOIN*% 3 | %OFA0B0*% 4 | %FSLAX24Y24*% 5 | %IPPOS*% 6 | %LPD*% 7 | %AMOC8* 8 | 5,1,8,0,0,1.08239X$1,22.5* 9 | % 10 | M02* 11 | -------------------------------------------------------------------------------- /hardware/AnduinoWiFi/grb/silkscreen-bottom.pho: -------------------------------------------------------------------------------- 1 | G75* 2 | %MOIN*% 3 | %OFA0B0*% 4 | %FSLAX24Y24*% 5 | %IPPOS*% 6 | %LPD*% 7 | %AMOC8* 8 | 5,1,8,0,0,1.08239X$1,22.5* 9 | % 10 | M02* 11 | -------------------------------------------------------------------------------- /hardware/AnduinoWiFi/grb/stencil-bottom.pho: -------------------------------------------------------------------------------- 1 | G75* 2 | %MOIN*% 3 | %OFA0B0*% 4 | %FSLAX24Y24*% 5 | %IPPOS*% 6 | %LPD*% 7 | %AMOC8* 8 | 5,1,8,0,0,1.08239X$1,22.5* 9 | % 10 | M02* 11 | -------------------------------------------------------------------------------- /hardware/Readme.md: -------------------------------------------------------------------------------- 1 | ![](https://github.com/andium/Anduino/blob/master/wiki_assets/open_source_hardware.png) 2 | -------------------------------------------------------------------------------- /libraries/AnduinoEEPROM/README.md: -------------------------------------------------------------------------------- 1 | #AnduinoEEPROM 2 | 3 | 4 | Check out the [AnduinoEEPROM wiki](https://github.com/andium/Anduino/wiki/AnduinoEEPROM)! -------------------------------------------------------------------------------- /libraries/AnduinoEEPROM/examples/loadLogoEEPROM/loadLogoEEPROM.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Example sketch utilizing AnduinoEEPROM library to load a GIMP image 3 | into EEPROM and then display the image read directly from EEPROM 4 | pixel by pixel. 5 | 6 | Check out the included Arduino sketch examples and Anduino Wiki to 7 | get started! 8 | https://github.com/andium/Anduino/wiki 9 | 10 | Written by Brian Carbonette Copyright © 2016 Andium 11 | 12 | Licensed under the Apache License, Version 2.0 (the "License"); 13 | you may not use this file except in compliance with the License. 14 | You may obtain a copy of the License at 15 | 16 | http://www.apache.org/licenses/LICENSE-2.0 17 | 18 | Unless required by applicable law or agreed to in writing, software 19 | distributed under the License is distributed on an "AS IS" BASIS, 20 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | See the License for the specific language governing permissions and 22 | limitations under the License. 23 | *******************************************************************/ 24 | 25 | /* Include the AnduinoLCD and AnduinoEEPROM specific libraries */ 26 | #include "AnduinoEEPROM.h" 27 | #include "AnduinoLCD.h" 28 | 29 | AnduinoEEPROM EEPROM = AnduinoEEPROM(); 30 | AnduinoLCD LCD = AnduinoLCD(ST7735_CS_PIN, ST7735_DC_PIN, PERIPH_RST_PIN); 31 | 32 | void setup() { 33 | 34 | Serial.begin(115200); 35 | EEPROM.begin(); 36 | LCD.begin(); 37 | LCD.fillScreen(ST7735_BLACK); //clear the screen 38 | LCD.setBacklight(ON); 39 | 40 | int eeaddress = 0; //address of first byte of GIMP in EEPROM 41 | 42 | //If img hasn't been stored in EEPROM uncomment below 43 | //max GIMP size of 32kb 44 | //EEPROM.storeImg(eeaddress); //use storeImg to save a GIMP style image contiguously in EEPROM 45 | 46 | drawLogofromEEPROM(eeaddress); 47 | 48 | } 49 | 50 | void loop() 51 | { 52 | //Save some write cycles on the EEPROM! We'll just run this example once. 53 | } 54 | 55 | void drawLogofromEEPROM(int eeaddress){ 56 | 57 | uint16_t pixel; 58 | //eeaddress address of first byte in GIMP file stored in EEPROM 59 | 60 | for(int y=0; y<128; y++) //repeat for each row y 61 | { 62 | for(int x=0; x<160; x++) //each column x, 20480px display 63 | { 64 | pixel = EEPROM.read(eeaddress+1); //concatenate 2bytes from EEPROM 65 | pixel |= EEPROM.read(eeaddress) << 8; //into one 16bit pixel 66 | LCD.drawPixel(x, y, pixel); 67 | eeaddress+=2; //inc to the next pixel 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /libraries/AnduinoEEPROM/examples/printEEPROM/printEEPROM.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Example sketch utilizing AnduinoEEPROM Library to read contents of 3 | EEPROM in 64byte pages to terminal display. 4 | 5 | Check out the included Arduino sketch examples and Anduino Wiki to 6 | get started! 7 | https://github.com/andium/Anduino/wiki 8 | 9 | Written by Brian Carbonette Copyright © 2016 Andium 10 | 11 | Licensed under the Apache License, Version 2.0 (the "License"); 12 | you may not use this file except in compliance with the License. 13 | You may obtain a copy of the License at 14 | 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | *******************************************************************/ 23 | 24 | /* Include the AnduinoEEPROM specific library */ 25 | #include "AnduinoEEPROM.h" 26 | 27 | AnduinoEEPROM EEPROM = AnduinoEEPROM(); 28 | 29 | void setup() { 30 | 31 | Serial.begin(115200); 32 | EEPROM.begin(); 33 | 34 | int eeaddress = 0; //eeaddress start address (best to do this in page sized increments, ex: 0, 64, 128...) 35 | int numPages = 3; //(512) * 64byte wide pages in 32Kb EEPROM prints entire contents 36 | byte bufferPage[PAGE_SIZE] = { 0 }; 37 | int next = 0; 38 | 39 | //initialize write buffer with test data 40 | for(int i=0; i0; j--) 48 | { 49 | EEPROM.writePage((eeaddress+next), (uint8_t *)bufferPage, PAGE_SIZE); 50 | next += 64; //increment to the next page 51 | delay(50); 52 | } 53 | 54 | //Print the page/s we just wrote (numPages = 512 to print entire EEPROM contents) 55 | EEPROM.printToTerm(eeaddress, numPages); 56 | 57 | //Erase the page/s we just wrote 58 | EEPROM.eraseContents(eeaddress, numPages); 59 | Serial.println("Erased test data!"); 60 | 61 | //Print the EEPROM again 62 | EEPROM.printToTerm(eeaddress, numPages); 63 | 64 | } 65 | 66 | void loop() 67 | { 68 | //Save some write cycles on the EEPROM! We'll just run this example once. 69 | } 70 | -------------------------------------------------------------------------------- /libraries/AnduinoEEPROM/examples/wbyteRbyte/wbyteRbyte.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Example sketch utilizing AnduinoEEPROM library to write a byte, 3 | read a byte, and display the data on the AnduinoLCD or in terminal. 4 | 5 | Check out the included Arduino sketch examples and Anduino Wiki to 6 | get started! 7 | https://github.com/andium/Anduino/wiki 8 | 9 | Written by Brian Carbonette Copyright © 2016 Andium 10 | 11 | Licensed under the Apache License, Version 2.0 (the "License"); 12 | you may not use this file except in compliance with the License. 13 | You may obtain a copy of the License at 14 | 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | *******************************************************************/ 23 | 24 | /* Include the AnduinoLCD and AnduinoEEPROM specific libraries */ 25 | #include "AnduinoEEPROM.h" 26 | #include "AnduinoLCD.h" 27 | 28 | AnduinoEEPROM EEPROM = AnduinoEEPROM(); 29 | AnduinoLCD LCD = AnduinoLCD(ST7735_CS_PIN, ST7735_DC_PIN, PERIPH_RST_PIN); 30 | 31 | void setup() { 32 | 33 | /*----------------------------------------------------- 34 | Set up the EEPROM, serial comm, and LCD screen 35 | -----------------------------------------------------*/ 36 | Serial.begin(115200); 37 | 38 | EEPROM.begin(); 39 | 40 | LCD.begin(); 41 | LCD.fillScreen(ST7735_BLACK); //clear the screen 42 | LCD.setBacklight(ON); 43 | LCD.splashScreen(); 44 | delay(500); //gaze upon it 45 | LCD.fillScreen(ST7735_BLACK); 46 | LCD.showBanner(); 47 | LCD.setCursor(1, 40); 48 | LCD.setTextSize(1); 49 | LCD.setTextWrap(ON); 50 | 51 | 52 | /*----------------------------------------------------- 53 | Where the magic happens 54 | -----------------------------------------------------*/ 55 | byte eebyte = 0x06; //what to write 56 | int eeaddress = 0; //where to write it 57 | 58 | //Write to eebyte to EEPROM at eeaddress 59 | EEPROM.write(eeaddress, eebyte); 60 | LCD.print("Write:0x"); 61 | LCD.print(eebyte, HEX); 62 | LCD.println(); 63 | 64 | //Read back what we just wrote 65 | Serial.print(EEPROM.read(eeaddress)); //on the serial terminal 66 | LCD.print("EEPROM["); 67 | LCD.print(eeaddress); //also to the LCD 68 | LCD.print("]:0x"); 69 | LCD.print(EEPROM.read(eeaddress), HEX); 70 | 71 | 72 | } 73 | 74 | void loop() 75 | { 76 | //Save some write cycles on the EEPROM! We'll just run this example once. 77 | } 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /libraries/AnduinoEEPROM/keywords.txt: -------------------------------------------------------------------------------- 1 | storeImg KEYWORD2 2 | write KEYWORD2 3 | read KEYWORD2 4 | writePage KEYWORD2 5 | readPage KEYWORD2 6 | printToTerm KEYWORD2 7 | eraseContents KEYWORD2 8 | PAGE_SIZE KEYWORD1 9 | EEPROM_ADDR KEYWORD1 10 | EEPROM_SIZE KEYWORD1 11 | -------------------------------------------------------------------------------- /libraries/AnduinoEEPROM/library.properties: -------------------------------------------------------------------------------- 1 | name=AnduinoEEPROM 2 | version=1.0.3 3 | author=Brian Carbonette 4 | maintainer=Brian Carbonette 5 | sentence=EEPROM library for Anduino Shield. 6 | paragraph=EEPROM library for Anduino Shield. 7 | category=* 8 | url=https://github.com/Andium/anduino 9 | architectures=* 10 | -------------------------------------------------------------------------------- /libraries/AnduinoEEPROM/src/AnduinoEEPROM.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | This library provides basic functionality around the M24256 32Kb 3 | I2C connected EEPROM available in our Anduino shield fo Arduino. 4 | 5 | Check out the included Arduino sketch examples and Anduino Wiki to 6 | get started! 7 | https://github.com/andium/Anduino/wiki 8 | 9 | Written by Brian Carbonette Copyright © 2016 Andium 10 | 11 | Licensed under the Apache License, Version 2.0 (the "License"); 12 | you may not use this file except in compliance with the License. 13 | You may obtain a copy of the License at 14 | 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | *******************************************************************/ 23 | 24 | #ifndef __AnduinoEEPROM_H 25 | #define __AnduinoEEPROM_H 26 | 27 | #include "Arduino.h" 28 | #include "Wire.h" //I2C utilizing 'Wire1' for second interface SDA2 + SCL2 29 | 30 | 31 | #include "GimpImageFormat.h" 32 | #define EEPROM_ADDR 0x50 //slaveAddr on I2C bus sda2/scl2 33 | #define EEPROM_SIZE 32768 //bytes 34 | #define PAGE_SIZE 64 //bytes 35 | 36 | #if defined(__AVR__) || defined(__i386__) || defined(ARDUINO_ARCH_SAMD) || defined(ESP8266) || defined(ARDUINO_ARCH_STM32) 37 | #define WIRE Wire 38 | #else // Arduino Due 39 | #define WIRE Wire1 40 | #endif 41 | 42 | /*In order to utilize a PAGE_SIZE of 64bytes BUFFER_LENGTH in the Wire.h must be edited 43 | to 66 in order to store the buffer and two address bytes 44 | #define BUFFER_LENGTH 66 edited in /wire.h 45 | otherwise a PAGE_SIZE of 32 can safely be used */ 46 | 47 | /*#define DEBUG_AnduinoEEPROM*/ 48 | 49 | 50 | 51 | 52 | class AnduinoEEPROM 53 | { 54 | 55 | public: 56 | /*Constructor*/ 57 | AnduinoEEPROM(); 58 | 59 | void begin(void); 60 | void storeImg(unsigned int eeaddress); 61 | void write(unsigned int eeaddress, byte data); 62 | byte read(unsigned int eeaddress); 63 | int writePage(unsigned int eeaddress, byte* buffer, int pageSize); 64 | void readPage(unsigned int eeaddress, byte buffer[], int pageSize); 65 | void printToTerm(unsigned int eeaddress, int numPages); 66 | void eraseContents(unsigned int eeaddress, int numPages); 67 | 68 | 69 | 70 | 71 | private: 72 | int storeGimpImage(gimpImage* image, unsigned int eeaddress); 73 | 74 | }; 75 | 76 | #endif /*__AnduinoEEPROM_H */ 77 | -------------------------------------------------------------------------------- /libraries/AnduinoEEPROM/src/GimpImageFormat.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Contains typedef for images exported using GIMP 3 | 4 | Check out the included Arduino sketch examples and Anduino Wiki to 5 | get started! 6 | https://github.com/andium/Anduino/wiki 7 | 8 | Written by Dr James Dooley Copyright © 2016 Andium 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *******************************************************************/ 22 | 23 | #ifndef __GIMPIMAGES_H 24 | #define __GIMPIMAGES_H 25 | 26 | #include "stdint.h" 27 | 28 | 29 | /* structure of images exported from GIMP as *.c */ 30 | typedef struct 31 | { 32 | uint8_t width; 33 | uint8_t height; 34 | uint8_t bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */ 35 | char *pixel_data; 36 | } gimpImage; 37 | 38 | 39 | 40 | #endif /* __GIMPIMAGES_H */ -------------------------------------------------------------------------------- /libraries/AnduinoEEPROM/src/andiumLogo160*128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/libraries/AnduinoEEPROM/src/andiumLogo160*128.png -------------------------------------------------------------------------------- /libraries/AnduinoLCD/README.md: -------------------------------------------------------------------------------- 1 | #AnduinoLCD 2 | 3 | 4 | Check out the [AnduinoLCD wiki](https://github.com/andium/Anduino/wiki/AnduinoLCD)! -------------------------------------------------------------------------------- /libraries/AnduinoLCD/examples/digitalGauge/digitalGauge.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Example sketch utilizing AnduinoLCD Library to display a digital 3 | gauge style screen of an analog input. 4 | 5 | Check out the included Arduino sketch examples and Anduino Wiki to 6 | get started! 7 | https://github.com/andium/Anduino/wiki 8 | 9 | Written by Brian Carbonette Copyright © 2017 Andium 10 | 11 | Licensed under the Apache License, Version 2.0 (the "License"); 12 | you may not use this file except in compliance with the License. 13 | You may obtain a copy of the License at 14 | 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | *******************************************************************/ 23 | 24 | /* Include the AnduinoLCD ST7735 specific library */ 25 | #include "AnduinoLCD.h" 26 | 27 | /*Create an instance of the AnduinoLCD */ 28 | AnduinoLCD LCD = AnduinoLCD(ST7735_CS_PIN, ST7735_DC_PIN, PERIPH_RST_PIN); 29 | 30 | void setup() { 31 | 32 | LCD.begin(); 33 | LCD.setBacklight(ON); 34 | LCD.fillScreen(ST7735_BLACK); //clear the screen 35 | 36 | //Setup static text 37 | LCD.showBanner(); //load Andium Banner 38 | LCD.setTextColor(ST7735_WHITE); //white 39 | LCD.setTextSize(2); 40 | LCD.setCursor(0,40); 41 | LCD.print("Sensor Value:"); //positioned just under banner 42 | LCD.println(); 43 | LCD.setTextSize(5); // set the font size larger for the digital reading 44 | 45 | } 46 | 47 | void loop() { 48 | 49 | LCD.digitalGauge(A1); 50 | 51 | } -------------------------------------------------------------------------------- /libraries/AnduinoLCD/examples/splashScreen/splashScreen.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Example sketch utilizing AnduinoLCD Library to display Andium splash 3 | screen. 4 | 5 | Check out the included Arduino sketch examples and Anduino Wiki to 6 | get started! 7 | https://github.com/andium/Anduino/wiki 8 | 9 | Written by Brian Carbonette Copyright © 2017 Andium 10 | 11 | Licensed under the Apache License, Version 2.0 (the "License"); 12 | you may not use this file except in compliance with the License. 13 | You may obtain a copy of the License at 14 | 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | *******************************************************************/ 23 | 24 | /* Include the AnduinoLCD ST7735 specific library */ 25 | #include "AnduinoLCD.h" 26 | 27 | /*Create an instance of the AnduinoLCD */ 28 | AnduinoLCD LCD = AnduinoLCD(ST7735_CS_PIN, ST7735_DC_PIN, PERIPH_RST_PIN); 29 | 30 | void setup() { 31 | 32 | LCD.begin(); 33 | LCD.fillScreen(ST7735_BLACK); //clear the screen 34 | LCD.setBacklight(ON); 35 | 36 | LCD.splashScreen(); //load Andium splash screen 37 | 38 | } 39 | 40 | void loop() { 41 | 42 | //nothing to do! 43 | } -------------------------------------------------------------------------------- /libraries/AnduinoLCD/examples/waveform/waveform.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Example sketch utilizing AnduinoLCD Library w/ analog input representing 3 | the data as a waveform on the LCD. 4 | 5 | Check out the included Arduino sketch examples and Anduino Wiki to 6 | get started! 7 | https://github.com/andium/Anduino/wiki 8 | 9 | Written by Brian Carbonette Copyright © 2017 Andium 10 | 11 | Licensed under the Apache License, Version 2.0 (the "License"); 12 | you may not use this file except in compliance with the License. 13 | You may obtain a copy of the License at 14 | 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | *******************************************************************/ 23 | 24 | /* Include the AnduinoLCD ST7735 specific library */ 25 | #include "AnduinoLCD.h" 26 | 27 | AnduinoLCD screen = AnduinoLCD(ST7735_CS_PIN, ST7735_DC_PIN, PERIPH_RST_PIN); 28 | 29 | uint8_t pxInc = 0; //pixel counter to drive x-axis draw(ST7735 is 160x128) 30 | uint8_t sensorPin = A1; //analog input 31 | 32 | void setup() { 33 | 34 | // initialize the display 35 | screen.begin(); 36 | screen.setBacklight(ON); 37 | screen.fillScreen(ST7735_BLACK); //clear the screen 38 | screen.showBanner(); //load Andium Banner 39 | 40 | } 41 | 42 | 43 | void loop() { 44 | 45 | //Prints waveform representing Analog Input A0 to LCD 46 | screen.waveform(sensorPin, pxInc); 47 | 48 | //Pixel incrementer for waveform 160 is max right index 49 | //for other display sizes adjust 160 to extreme border pixelcount 50 | if(pxInc == 160){ 51 | pxInc=0; 52 | }else{ 53 | pxInc++; 54 | } 55 | 56 | delay(250); //delay can be used as a pseudo-sample rate adjustment 57 | 58 | 59 | } 60 | 61 | -------------------------------------------------------------------------------- /libraries/AnduinoLCD/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For AnduinoLCD 3 | # which wraps Adafruit_GFX & 4 | # Adafruit_ST7735 5 | ####################################### 6 | 7 | ####################################### 8 | # Datatypes (KEYWORD1) 9 | ####################################### 10 | 11 | Adafruit_GFX KEYWORD1 12 | Adafruit_ST7735 KEYWORD1 13 | PImage KEYWORD1 14 | AnduinoLCD KEYWORD1 15 | 16 | 17 | ####################################### 18 | # Methods and Functions (KEYWORD2) 19 | ####################################### 20 | 21 | drawPixel KEYWORD2 22 | invertDisplay KEYWORD2 23 | drawLine KEYWORD2 24 | drawFastVLine KEYWORD2 25 | drawFastHLine KEYWORD2 26 | drawRect KEYWORD2 27 | fillRect KEYWORD2 28 | fillScreen KEYWORD2 29 | drawCircle KEYWORD2 30 | drawCircleHelper KEYWORD2 31 | fillCircle KEYWORD2 32 | fillCircleHelper KEYWORD2 33 | drawTriangle KEYWORD2 34 | fillTriangle KEYWORD2 35 | drawRoundRect KEYWORD2 36 | fillRoundRect KEYWORD2 37 | drawBitmap KEYWORD2 38 | drawChar KEYWORD2 39 | setCursor KEYWORD2 40 | setTextColor KEYWORD2 41 | setTextSize KEYWORD2 42 | setTextWrap KEYWORD2 43 | height KEYWORD2 44 | width KEYWORD2 45 | setRotation KEYWORD2 46 | getRotation KEYWORD2 47 | 48 | 49 | 50 | newColor KEYWORD2 51 | background KEYWORD2 52 | fill KEYWORD2 53 | noFill KEYWORD2 54 | stroke KEYWORD2 55 | noStroke KEYWORD2 56 | text KEYWORD2 57 | textWrap KEYWORD2 58 | textSize KEYWORD2 59 | circle KEYWORD2 60 | point KEYWORD2 61 | quad KEYWORD2 62 | rect KEYWORD2 63 | triangle KEYWORD2 64 | loadImage KEYWORD2 65 | image KEYWORD2 66 | 67 | draw KEYWORD2 68 | isValid KEYWORD2 69 | 70 | screenPrint KEYWORD2 71 | showFullscreenLogo KEYWORD2 72 | showBanner KEYWORD2 73 | waveform KEYWORD2 74 | digitalGauge KEYWORD2 75 | splashScreen KEYWORD2 76 | setBacklight KEYWORD2 77 | showGimpImage KEYWORD2 78 | 79 | ####################################### 80 | # Constants (LITERAL1) 81 | ####################################### 82 | 83 | -------------------------------------------------------------------------------- /libraries/AnduinoLCD/library.properties: -------------------------------------------------------------------------------- 1 | name=AnduinoLCD 2 | version=1.0.3 3 | author=Brian Carbonette 4 | maintainer=Brian Carbonette 5 | sentence=LCD library for Anduino Shield. 6 | paragraph=LCD library for Anduino Shield. 7 | category=Display 8 | url=https://github.com/Andium/Anduino 9 | architectures=* 10 | -------------------------------------------------------------------------------- /libraries/AnduinoLCD/src/AnduinoErrorCodes.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Common Error Codes used accross the Anduino Library. 3 | 4 | Check out the included Arduino sketch examples and Anduino Wiki to 5 | get started! 6 | https://github.com/andium/Anduino/wiki 7 | 8 | Written by Dr James Dooley Copyright © 2016 Andium 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *******************************************************************/ 22 | 23 | 24 | #ifndef __ANDUINO_ERR_CODES_H 25 | #define __ANDUINO_ERR_CODES_H 26 | 27 | typedef enum Status 28 | { 29 | STATUS_OK, 30 | STATUS_ERROR, 31 | STATUS_ERROR_ALREADY_INITIALISED, 32 | STATUS_IMAGE_FORMAT_NOT_SUPPORTED, 33 | STATUS_CRC_FAIL 34 | } Status; 35 | 36 | 37 | #endif /* __ANDUINO_ERR_CODES_H */ -------------------------------------------------------------------------------- /libraries/AnduinoLCD/src/AnduinoLCD.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | This library extends Adafruit's ST7735 library for the Andium 3 | Anduino Shield. 4 | 5 | Check out the included Arduino sketch examples and Anduino Wiki to 6 | get started! 7 | https://github.com/andium/Anduino/wiki 8 | 9 | Written by Brian Carbonette Copyright © 2017 Andium 10 | 11 | Licensed under the Apache License, Version 2.0 (the "License"); 12 | you may not use this file except in compliance with the License. 13 | You may obtain a copy of the License at 14 | 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | *******************************************************************/ 23 | 24 | #ifndef __AnduinoLCD_H 25 | #define __AnduinoLCD_H 26 | 27 | #include "Arduino.h" 28 | #include "Adafruit_ST7735.h" // Hardware-specific library 29 | #include "Adafruit_GFX.h" // Adafruit Graphics Library 30 | 31 | #include "AnduinoPins.h" 32 | #include "AnduinoErrorCodes.h" 33 | #include "GimpImageFormat.h" 34 | #include 35 | 36 | /*#define DEBUG_AnduinoLCD*/ 37 | 38 | 39 | typedef enum 40 | { 41 | ON, 42 | OFF 43 | } BACKLIGHT_STATE; 44 | 45 | /* 46 | * 47 | */ 48 | class AnduinoLCD : public Adafruit_ST7735 49 | { 50 | public: 51 | 52 | /* Constructor */ 53 | AnduinoLCD(uint8_t cs, uint8_t rs, uint8_t rst); 54 | 55 | void begin(void); 56 | 57 | Status setBacklight(BACKLIGHT_STATE state); 58 | 59 | Status showGimpImage(gimpImage* image); 60 | 61 | void screenPrint(char* message, int x, int y); 62 | void showFullscreenLogo(void); 63 | void showBanner(void); 64 | void waveform(uint8_t analogPin, uint8_t px); 65 | void digitalGauge(uint8_t analogPin); 66 | void splashScreen(void); 67 | 68 | 69 | 70 | private: 71 | bool logoFullscreen = true; 72 | 73 | 74 | }; 75 | 76 | #endif /* __AnduinoLCD_H */ 77 | -------------------------------------------------------------------------------- /libraries/AnduinoLCD/src/GimpImageFormat.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Contains typedef for images exported using GIMP 3 | 4 | Check out the included Arduino sketch examples and Anduino Wiki to 5 | get started! 6 | https://github.com/andium/Anduino/wiki 7 | 8 | Written by Dr James Dooley Copyright © 2016 Andium 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *******************************************************************/ 22 | 23 | #ifndef __GIMPIMAGES_H 24 | #define __GIMPIMAGES_H 25 | 26 | #include "stdint.h" 27 | 28 | 29 | /* structure of images exported from GIMP as *.c */ 30 | typedef struct 31 | { 32 | uint8_t width; 33 | uint8_t height; 34 | uint8_t bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */ 35 | char *pixel_data; 36 | } gimpImage; 37 | 38 | 39 | 40 | #endif /* __GIMPIMAGES_H */ -------------------------------------------------------------------------------- /libraries/AnduinoLCD/src/PImage.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef _PIMAGE_H 4 | #define _PIMAGE_H 5 | 6 | class Adafruit_GFX; 7 | 8 | #if defined(__SD_H__) // Arduino SD library 9 | 10 | 11 | /// This class mimics Processing's PImage, but with fewer 12 | /// capabilities. It allows an image stored in the SD card to be 13 | /// drawn to the display. 14 | /// @author Enrico Gueli 15 | class PImage { 16 | public: 17 | PImage() : 18 | _valid(false), 19 | _bmpWidth(0), 20 | _bmpHeight(0) { } 21 | 22 | void draw(Adafruit_GFX & glcd, int16_t x, int16_t y); 23 | 24 | static PImage loadImage(const char * fileName); 25 | 26 | void close() { _bmpFile.close(); } 27 | 28 | bool isValid() { return _valid; } 29 | 30 | int width() { return _bmpWidth; } 31 | int height() { return _bmpHeight; } 32 | 33 | private: 34 | friend class Adafruit_GFX; 35 | 36 | File _bmpFile; 37 | int _bmpWidth, _bmpHeight; // W+H in pixels 38 | uint8_t _bmpDepth; // Bit depth (currently must be 24) 39 | uint32_t _bmpImageoffset; // Start of image data in file 40 | uint32_t _rowSize; // Not always = bmpWidth; may have padding 41 | bool _flip; 42 | 43 | bool _valid; 44 | 45 | PImage(File & bmpFile, int bmpWidth, int bmpHeight, uint8_t bmpDepth, uint32_t bmpImageoffset, uint32_t rowSize, bool flip) : 46 | _bmpFile(bmpFile), 47 | _bmpWidth(bmpWidth), 48 | _bmpHeight(bmpHeight), 49 | _bmpDepth(bmpDepth), 50 | _bmpImageoffset(bmpImageoffset), 51 | _rowSize(rowSize), 52 | _flip(flip), 53 | _valid(true) // since Adafruit_GFX is friend, we could just let it write the variables and save some CPU cycles 54 | { } 55 | 56 | static uint16_t read16(File f); 57 | static uint32_t read32(File f); 58 | 59 | // TODO close the file in ~PImage and PImage(const PImage&) 60 | 61 | }; 62 | 63 | #endif 64 | 65 | #endif // _PIMAGE_H 66 | -------------------------------------------------------------------------------- /libraries/AnduinoLCD/src/andiumBanner160*36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/libraries/AnduinoLCD/src/andiumBanner160*36.png -------------------------------------------------------------------------------- /libraries/AnduinoLCD/src/andiumLogo160*128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/libraries/AnduinoLCD/src/andiumLogo160*128.png -------------------------------------------------------------------------------- /libraries/AnduinoLCD/src/gfxfont.h: -------------------------------------------------------------------------------- 1 | // Font structures for newer Adafruit_GFX (1.1 and later). 2 | // Example fonts are included in 'Fonts' directory. 3 | // To use a font in your Arduino sketch, #include the corresponding .h 4 | // file and pass address of GFXfont struct to setFont(). Pass NULL to 5 | // revert to 'classic' fixed-space bitmap font. 6 | 7 | #ifndef _GFXFONT_H_ 8 | #define _GFXFONT_H_ 9 | 10 | typedef struct { // Data stored PER GLYPH 11 | uint16_t bitmapOffset; // Pointer into GFXfont->bitmap 12 | uint8_t width, height; // Bitmap dimensions in pixels 13 | uint8_t xAdvance; // Distance to advance cursor (x axis) 14 | int8_t xOffset, yOffset; // Dist from cursor pos to UL corner 15 | } GFXglyph; 16 | 17 | typedef struct { // Data stored for FONT AS A WHOLE: 18 | uint8_t *bitmap; // Glyph bitmaps, concatenated 19 | GFXglyph *glyph; // Glyph array 20 | uint8_t first, last; // ASCII extents 21 | uint8_t yAdvance; // Newline distance (y axis) 22 | } GFXfont; 23 | 24 | #endif // _GFXFONT_H_ 25 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/README.md: -------------------------------------------------------------------------------- 1 | #AnduinoNFC 2 | 3 | 4 | Check out the [AnduinoNFC wiki](https://github.com/andium/Anduino/wiki/AnduinoNFC)! -------------------------------------------------------------------------------- /libraries/AnduinoNFC/examples/eraseNDEFRecord/eraseNDEFRecord.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Example sketch utilizing AnduinoNFC to clear an NDEF formatted 3 | tag by overwritting the contents with an empty record. 4 | 5 | Check out the included Arduino sketch examples and Anduino Wiki to 6 | get started! 7 | https://github.com/andium/Anduino/wiki 8 | 9 | Written by Brian Carbonette Copyright © 2017 Andium 10 | 11 | Licensed under the Apache License, Version 2.0 (the "License"); 12 | you may not use this file except in compliance with the License. 13 | You may obtain a copy of the License at 14 | 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | *******************************************************************/ 23 | 24 | /* Include the AnduinoNFC library */ 25 | #include 26 | 27 | AnduinoNFC NFC = AnduinoNFC(); 28 | 29 | void setup(void) { 30 | Serial.begin(115200); 31 | Serial.println("NDEF Eraser"); 32 | 33 | NFC.begin(); 34 | 35 | Serial.println("\nPlace an NDEF formatted tag on the NFC reader to erase."); 36 | 37 | } 38 | 39 | void loop(void) { 40 | 41 | if (NFC.packetReady()) { 42 | 43 | bool success = NFC.erase(); //essentially message.addEmptyRecord() 44 | 45 | if (success) 46 | { 47 | Serial.println("Success! Tag erased!"); 48 | NfcTag tag = NFC.read(); 49 | tag.print(); //print the contents to confirm the tag is erased 50 | } 51 | else 52 | { 53 | Serial.println("Erase failed."); 54 | } 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/examples/formatToNDEF/formatToNDEF.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Example sketch utilizing AnduinoNFC to format a Mifare Classic 3 | tag as an NDEF tag. The revertToClassic sketch will reverse this 4 | process. Mifare Ultralight tags may also be formatted via this 5 | sketch but can not be reverted! 6 | 7 | Check out the included Arduino sketch examples and Anduino Wiki to 8 | get started! 9 | https://github.com/andium/Anduino/wiki 10 | 11 | Written by Brian Carbonette Copyright © 2017 Andium 12 | 13 | Licensed under the Apache License, Version 2.0 (the "License"); 14 | you may not use this file except in compliance with the License. 15 | You may obtain a copy of the License at 16 | 17 | http://www.apache.org/licenses/LICENSE-2.0 18 | 19 | Unless required by applicable law or agreed to in writing, software 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | *******************************************************************/ 25 | 26 | /* Include the AnduinoNFC library */ 27 | #include 28 | 29 | AnduinoNFC NFC = AnduinoNFC(); 30 | 31 | void setup(void) { 32 | Serial.begin(115200); 33 | Serial.println("Mifare Classic/Ultralight --> NDEF"); 34 | 35 | NFC.begin(); 36 | 37 | Serial.println("\nPlace an unformatted Mifare Classic tag on the reader."); 38 | 39 | } 40 | 41 | void loop(void) { 42 | 43 | /* If(there is an RFID card in range and we haven't just read from it) 44 | * This utilizes the IRQ pin on the PN532 which is tied to a hardware 45 | * interrupt on the Anduino shield. 46 | */ 47 | if (NFC.packetReady()) { 48 | 49 | bool success = NFC.format(); //formats a Mifare Classic card to support NDEF 50 | 51 | if (success) 52 | { 53 | Serial.println("\nSuccess, tag formatted for NDEF."); 54 | } 55 | else 56 | { 57 | Serial.println("\nFormat failed."); 58 | } 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/examples/readRFIDtag/readRFIDtag.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Example sketch utilizing AnduinoNFC Library to read a passive 3 | RFID tag. 4 | 5 | Check out the included Arduino sketch examples and Anduino Wiki to 6 | get started! 7 | https://github.com/andium/Anduino/wiki 8 | 9 | Written by Brian Carbonette Copyright © 2017 Andium 10 | 11 | Licensed under the Apache License, Version 2.0 (the "License"); 12 | you may not use this file except in compliance with the License. 13 | You may obtain a copy of the License at 14 | 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | *******************************************************************/ 23 | 24 | /* Include the AnduinoNFC PN532 specific library */ 25 | #include 26 | 27 | AnduinoNFC NFC = AnduinoNFC(); 28 | 29 | 30 | void setup() { 31 | Serial.begin(115200); 32 | Serial.println("RFID Tag Reader"); 33 | 34 | NFC.begin(); 35 | 36 | Serial.println("\nScan an NFC tag\n"); 37 | 38 | } 39 | 40 | void loop() { 41 | 42 | /* If(there is an RFID card in range and we haven't just read from it) 43 | * This utilizes the IRQ pin on the PN532 which is tied to a hardware 44 | * interrupt on the Anduino shield. 45 | */ 46 | if (NFC.packetReady()) 47 | { 48 | /* NfcTag's contain highlevel properties like UID and tag type, 49 | * check out the keycardAcess sketch to see UIDs in action. 50 | */ 51 | NfcTag tag = NFC.read(); //attempt to read the RFID tag 52 | tag.print(); //and print the results to the terminal 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/examples/revertToClassic/revertToClassic.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Example sketch utilizing AnduinoNFC to revert an NDEF formatted 3 | Mifare Classic RFID tag back to its original configuration. Mifare 4 | Ultralight cards will remain NDEF and be cleared not reformatted. 5 | 6 | Check out the included Arduino sketch examples and Anduino Wiki to 7 | get started! 8 | https://github.com/andium/Anduino/wiki 9 | 10 | Written by Brian Carbonette Copyright © 2017 Andium 11 | 12 | Licensed under the Apache License, Version 2.0 (the "License"); 13 | you may not use this file except in compliance with the License. 14 | You may obtain a copy of the License at 15 | 16 | http://www.apache.org/licenses/LICENSE-2.0 17 | 18 | Unless required by applicable law or agreed to in writing, software 19 | distributed under the License is distributed on an "AS IS" BASIS, 20 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | See the License for the specific language governing permissions and 22 | limitations under the License. 23 | *******************************************************************/ 24 | 25 | /* Include the AnduinoNFC library */ 26 | #include 27 | 28 | AnduinoNFC NFC = AnduinoNFC(); 29 | 30 | void setup(void) { 31 | Serial.begin(115200); 32 | Serial.println("NDEF --> Mifare Classic"); 33 | 34 | NFC.begin(); 35 | 36 | Serial.println("\nPlace an NDEF formatted tag on the NFC reader to revert back to Mifare Classic."); 37 | 38 | } 39 | 40 | void loop(void) { 41 | 42 | /* If(there is an RFID card in range and we haven't just read from it) 43 | * This utilizes the IRQ pin on the PN532 which is tied to a hardware 44 | * interrupt on the Anduino shield. 45 | */ 46 | if (NFC.packetReady()) { 47 | 48 | bool success = NFC.clean(); //reformat the RFID tag 49 | 50 | if (success) 51 | { 52 | Serial.println("\nSuccess, tag restored to factory state."); 53 | } 54 | else 55 | { 56 | Serial.println("\nError, unable to clean tag."); 57 | } 58 | 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/examples/writeNDEFrecord/writeNDEFrecord.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Example sketch utilizing AnduinoNFC Library to write an NDEF 3 | formatted message onto a passive RFID tag. 4 | 5 | Check out the included Arduino sketch examples and Anduino Wiki to 6 | get started! 7 | https://github.com/andium/Anduino/wiki 8 | 9 | Written by Brian Carbonette Copyright © 2017 Andium 10 | 11 | Licensed under the Apache License, Version 2.0 (the "License"); 12 | you may not use this file except in compliance with the License. 13 | You may obtain a copy of the License at 14 | 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | *******************************************************************/ 23 | 24 | /* Include the AnduinoNFC PN532 specific library */ 25 | #include 26 | 27 | AnduinoNFC NFC = AnduinoNFC(); 28 | 29 | void setup() { 30 | Serial.begin(115200); 31 | Serial.println("NDEF Writer"); 32 | 33 | NFC.begin(); 34 | 35 | Serial.println("\nPlace an NDEF formatted Mifare Classic or Ultralight NFC tag on the reader."); 36 | } 37 | 38 | void loop() { 39 | 40 | /* If(there is an RFID card in range and we haven't just read from it) 41 | * This utilizes the IRQ pin on the PN532 which is tied to a hardware 42 | * interrupt on the Anduino shield. 43 | */ 44 | if (NFC.packetReady()) { 45 | 46 | /* Create an NDEF message 47 | */ 48 | NdefMessage message = NdefMessage(); 49 | /* In this instance we'll add a uri, uncomment a message type 50 | * below to give a different type a try, keep in mind space 51 | * is usually pretty limited on RFID tags so we probably 52 | * can't fit all 5 records. 53 | */ 54 | message.addUriRecord("https://github.com/andium/Anduino/wiki"); 55 | 56 | //message.addMimeMediaRecord("text/html", "
  • anotha one
  • "); 57 | //message.addTextRecord("I'm a generic text record in english"); 58 | //message.addTextRecord("Ciao mondo", "it"); //include an encoding 59 | //message.addEmptyRecord(); //boring, but use this to erase! or NFC.erase(); 60 | 61 | bool success = NFC.write(message); //write this to our tag 62 | 63 | if (success) 64 | { 65 | Serial.println("Success! Tag written!"); 66 | NfcTag tag = NFC.read(); 67 | tag.print(); //print what we've just written. 68 | } 69 | else 70 | { 71 | Serial.println("Write failed."); 72 | } 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/keywords.txt: -------------------------------------------------------------------------------- 1 | AnduinoNFC KEYWORD2 2 | tagPresent KEYWORD2 3 | read KEYWORD2 4 | write KEYWORD2 5 | erase KEYWORD2 6 | format KEYWORD2 7 | clean KEYWORD2 8 | packetReady KEYWORD2 9 | getEncodedSize KEYWORD2 10 | encode KEYWORD2 11 | addRecord KEYWORD2 12 | addMimeMediaRecord KEYWORD2 13 | addTextRecord KEYWORD2 14 | addUriRecord KEYWORD2 15 | addEmptyRecord KEYWORD2 16 | getRecordCount KEYWORD2 17 | getRecord KEYWORD2 18 | printPayload KEYWORD2 19 | getPayloadLength KEYWORD2 20 | getIdLength KEYWORD2 21 | getTypeLength KEYWORD2 22 | getTnf KEYWORD2 23 | getType KEYWORD2 24 | getPayload KEYWORD2 25 | getId KEYWORD2 26 | getType KEYWORD2 27 | setTnf KEYWORD2 28 | setType KEYWORD2 29 | setPayload KEYWORD2 30 | setId KEYWORD2 31 | printHex KEYWORD2 32 | dumpHex KEYWORD2 33 | getUid KEYWORD2 34 | getUidString KEYWORD2 35 | getTagType KEYWORD2 36 | hasNdefMessage KEYWORD2 37 | getNdefMessage KEYWORD2 -------------------------------------------------------------------------------- /libraries/AnduinoNFC/library.properties: -------------------------------------------------------------------------------- 1 | name=AnduinoNFC 2 | version=1.0.3 3 | author=Brian Carbonette 4 | maintainer=Brian Carbonette 5 | sentence=NFC library for Anduino Shield. 6 | paragraph=NFC library for Anduino Shield. 7 | category=Communication 8 | url=https://github.com/andium/Anduino 9 | architectures=* 10 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/src/AnduinoNFC.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Check out the included Arduino sketch examples and Anduino Wiki to 3 | get started! 4 | https://github.com/andium/Anduino/wiki 5 | 6 | This is a modified version of Don Coleman's NfcAdapter to include 7 | hardware interrupt support for the PN532 as well as a hardcoded 8 | SPI interface for the Andium Anduino shield. 9 | 10 | Modified by Brian Carbonette Copyright © 2016 Andium 11 | Original source contributed by Don Coleman https://github.com/don/NDEF 12 | 13 | Licensed under the Apache License, Version 2.0 (the "License"); 14 | you may not use this file except in compliance with the License. 15 | You may obtain a copy of the License at 16 | 17 | http://www.apache.org/licenses/LICENSE-2.0 18 | 19 | Unless required by applicable law or agreed to in writing, software 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | *******************************************************************/ 25 | 26 | #ifndef AnduinoNFC_h 27 | #define AnduinoNFC_h 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | // Drivers 36 | #include 37 | #include 38 | #include 39 | 40 | 41 | #define TAG_TYPE_MIFARE_CLASSIC (0) 42 | #define TAG_TYPE_1 (1) 43 | #define TAG_TYPE_2 (2) 44 | #define TAG_TYPE_3 (3) 45 | #define TAG_TYPE_4 (4) 46 | #define TAG_TYPE_UNKNOWN (99) 47 | 48 | #define SPI_HAS_TRANSACTION 1 49 | 50 | 51 | class AnduinoNFC { 52 | public: 53 | AnduinoNFC(); 54 | 55 | // bool isIsrTaken(void); 56 | bool packetReady(void); 57 | 58 | ~AnduinoNFC(void); 59 | void begin(boolean verbose=true); 60 | boolean tagPresent(unsigned long timeout=0); // tagAvailable 61 | NfcTag read(); 62 | boolean write(NdefMessage& ndefMessage); 63 | // erase tag by writing an empty NDEF record 64 | boolean erase(); 65 | // format a tag as NDEF 66 | boolean format(); 67 | // reset tag back to factory state 68 | boolean clean(); 69 | private: 70 | PN532* shield; 71 | byte uid[7]; // Buffer to store the returned UID 72 | unsigned int uidLength; // Length of the UID (4 or 7 bytes depending on ISO14443A card type) 73 | unsigned int guessTagType(); 74 | 75 | 76 | }; 77 | 78 | #endif /*AnduinoNFC_h*/ 79 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/src/Mifare/MifareClassic.h: -------------------------------------------------------------------------------- 1 | #ifndef MifareClassic_h 2 | #define MifareClassic_h 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class MifareClassic 10 | { 11 | public: 12 | MifareClassic(PN532& nfcShield); 13 | ~MifareClassic(); 14 | NfcTag read(byte *uid, unsigned int uidLength); 15 | boolean write(NdefMessage& ndefMessage, byte *uid, unsigned int uidLength); 16 | boolean formatNDEF(byte * uid, unsigned int uidLength); 17 | boolean formatMifare(byte * uid, unsigned int uidLength); 18 | private: 19 | PN532* _nfcShield; 20 | int getBufferSize(int messageLength); 21 | int getNdefStartIndex(byte *data); 22 | bool decodeTlv(byte *data, int &messageLength, int &messageStartIndex); 23 | }; 24 | 25 | #endif -------------------------------------------------------------------------------- /libraries/AnduinoNFC/src/Mifare/MifareUltralight.h: -------------------------------------------------------------------------------- 1 | #ifndef MifareUltralight_h 2 | #define MifareUltralight_h 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class MifareUltralight 9 | { 10 | public: 11 | MifareUltralight(PN532& nfcShield); 12 | ~MifareUltralight(); 13 | NfcTag read(byte *uid, unsigned int uidLength); 14 | boolean write(NdefMessage& ndefMessage, byte *uid, unsigned int uidLength); 15 | boolean clean(); 16 | private: 17 | PN532* nfc; 18 | unsigned int tagCapacity; 19 | unsigned int messageLength; 20 | unsigned int bufferSize; 21 | unsigned int ndefStartIndex; 22 | boolean isUnformatted(); 23 | void readCapabilityContainer(); 24 | void findNdefMessage(); 25 | void calculateBufferSize(); 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/src/Mifare/license.txt: -------------------------------------------------------------------------------- 1 | Software License Agreement (BSD License) 2 | 3 | Copyright (c) 2013-2014, Don Coleman 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holders nor the 17 | names of its contributors may be used to endorse or promote products 18 | derived from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 21 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 24 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/src/NDEF/Due.h: -------------------------------------------------------------------------------- 1 | // redefine some stuff so code works on Due 2 | // http://arduino.cc/forum/index.php?&topic=153761.0 3 | 4 | #ifndef Due_h 5 | #define Due_h 6 | 7 | #if defined(__SAM3X8E__) 8 | #define PROGMEM 9 | #define pgm_read_byte(x) (*((char *)x)) 10 | // #define pgm_read_word(x) (*((short *)(x & 0xfffffffe))) 11 | #define pgm_read_word(x) ( ((*((unsigned char *)x + 1)) << 8) + (*((unsigned char *)x))) 12 | #define pgm_read_byte_near(x) (*((char *)x)) 13 | #define pgm_read_byte_far(x) (*((char *)x)) 14 | // #define pgm_read_word_near(x) (*((short *)(x & 0xfffffffe)) 15 | // #define pgm_read_word_far(x) (*((short *)(x & 0xfffffffe))) 16 | #define pgm_read_word_near(x) ( ((*((unsigned char *)x + 1)) << 8) + (*((unsigned char *)x))) 17 | #define pgm_read_word_far(x) ( ((*((unsigned char *)x + 1)) << 8) + (*((unsigned char *)x)))) 18 | #define PSTR(x) x 19 | #if defined F 20 | #undef F 21 | #endif 22 | #define F(X) (X) 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/src/NDEF/Ndef.cpp: -------------------------------------------------------------------------------- 1 | #include "NDEF/Ndef.h" 2 | 3 | // Borrowed from Adafruit_NFCShield_I2C 4 | void PrintHex(const byte * data, const long numBytes) 5 | { 6 | uint32_t szPos; 7 | for (szPos=0; szPos < numBytes; szPos++) 8 | { 9 | Serial.print("0x"); 10 | // Append leading 0 for small values 11 | if (data[szPos] <= 0xF) 12 | Serial.print("0"); 13 | Serial.print(data[szPos]&0xff, HEX); 14 | if ((numBytes > 1) && (szPos != numBytes - 1)) 15 | { 16 | Serial.print(" "); 17 | } 18 | } 19 | Serial.println(""); 20 | } 21 | 22 | // Borrowed from Adafruit_NFCShield_I2C 23 | void PrintHexChar(const byte * data, const long numBytes) 24 | { 25 | uint32_t szPos; 26 | for (szPos=0; szPos < numBytes; szPos++) 27 | { 28 | // Append leading 0 for small values 29 | if (data[szPos] <= 0xF) 30 | Serial.print("0"); 31 | Serial.print(data[szPos], HEX); 32 | if ((numBytes > 1) && (szPos != numBytes - 1)) 33 | { 34 | Serial.print(" "); 35 | } 36 | } 37 | Serial.print(" "); 38 | for (szPos=0; szPos < numBytes; szPos++) 39 | { 40 | if (data[szPos] <= 0x1F) 41 | Serial.print("."); 42 | else 43 | Serial.print((char)data[szPos]); 44 | } 45 | Serial.println(""); 46 | } 47 | 48 | // Note if buffer % blockSize != 0, last block will not be written 49 | void DumpHex(const byte * data, const long numBytes, const unsigned int blockSize) 50 | { 51 | int i; 52 | for (i = 0; i < (numBytes / blockSize); i++) 53 | { 54 | PrintHexChar(data, blockSize); 55 | data += blockSize; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/src/NDEF/Ndef.h: -------------------------------------------------------------------------------- 1 | #ifndef Ndef_h 2 | #define Ndef_h 3 | 4 | /* NOTE: To use the Ndef library in your code, don't include Ndef.h 5 | See README.md for details on which files to include in your sketch. 6 | */ 7 | 8 | #include 9 | 10 | #ifndef NULL 11 | #define NULL (void *)0 12 | #endif 13 | 14 | void PrintHex(const byte *data, const long numBytes); 15 | void PrintHexChar(const byte *data, const long numBytes); 16 | void DumpHex(const byte *data, const long numBytes, const int blockSize); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/src/NDEF/NdefMessage.h: -------------------------------------------------------------------------------- 1 | #ifndef NdefMessage_h 2 | #define NdefMessage_h 3 | 4 | #include 5 | #include 6 | 7 | #define MAX_NDEF_RECORDS 4 8 | 9 | class NdefMessage 10 | { 11 | public: 12 | NdefMessage(void); 13 | NdefMessage(const byte *data, const int numBytes); 14 | NdefMessage(const NdefMessage& rhs); 15 | ~NdefMessage(); 16 | NdefMessage& operator=(const NdefMessage& rhs); 17 | 18 | int getEncodedSize(); // need so we can pass array to encode 19 | void encode(byte *data); 20 | 21 | boolean addRecord(NdefRecord& record); 22 | void addMimeMediaRecord(String mimeType, String payload); 23 | void addMimeMediaRecord(String mimeType, byte *payload, int payloadLength); 24 | void addTextRecord(String text); 25 | void addTextRecord(String text, String encoding); 26 | void addUriRecord(String uri); 27 | void addEmptyRecord(); 28 | 29 | 30 | unsigned int getRecordCount(); 31 | NdefRecord getRecord(int index); 32 | NdefRecord operator[](int index); 33 | 34 | 35 | void print(); 36 | void printPayload(uint8_t recordNum); 37 | 38 | private: 39 | NdefRecord _records[MAX_NDEF_RECORDS]; 40 | unsigned int _recordCount; 41 | }; 42 | 43 | #endif -------------------------------------------------------------------------------- /libraries/AnduinoNFC/src/NDEF/NdefRecord.h: -------------------------------------------------------------------------------- 1 | #ifndef NdefRecord_h 2 | #define NdefRecord_h 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #define TNF_EMPTY 0x0 9 | #define TNF_WELL_KNOWN 0x01 10 | #define TNF_MIME_MEDIA 0x02 11 | #define TNF_ABSOLUTE_URI 0x03 12 | #define TNF_EXTERNAL_TYPE 0x04 13 | #define TNF_UNKNOWN 0x05 14 | #define TNF_UNCHANGED 0x06 15 | #define TNF_RESERVED 0x07 16 | 17 | class NdefRecord 18 | { 19 | public: 20 | NdefRecord(); 21 | NdefRecord(const NdefRecord& rhs); 22 | ~NdefRecord(); 23 | NdefRecord& operator=(const NdefRecord& rhs); 24 | 25 | int getEncodedSize(); 26 | void encode(byte *data, bool firstRecord, bool lastRecord); 27 | 28 | unsigned int getTypeLength(); 29 | int getPayloadLength(); 30 | unsigned int getIdLength(); 31 | 32 | byte getTnf(); 33 | void getType(byte *type); 34 | void getPayload(byte *payload); 35 | void getId(byte *id); 36 | 37 | // convenience methods 38 | String getType(); 39 | String getId(); 40 | 41 | void setTnf(byte tnf); 42 | void setType(const byte *type, const unsigned int numBytes); 43 | void setPayload(const byte *payload, const int numBytes); 44 | void setId(const byte *id, const unsigned int numBytes); 45 | 46 | void print(); 47 | private: 48 | byte getTnfByte(bool firstRecord, bool lastRecord); 49 | byte _tnf; // 3 bit 50 | unsigned int _typeLength; 51 | int _payloadLength; 52 | unsigned int _idLength; 53 | byte *_type; 54 | byte *_payload; 55 | byte *_id; 56 | }; 57 | 58 | #endif -------------------------------------------------------------------------------- /libraries/AnduinoNFC/src/NDEF/license.txt: -------------------------------------------------------------------------------- 1 | Software License Agreement (BSD License) 2 | 3 | Copyright (c) 2013-2014, Don Coleman 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holders nor the 17 | names of its contributors may be used to endorse or promote products 18 | derived from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 21 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 24 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/src/NFC/NfcTag.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | NfcTag::NfcTag() 4 | { 5 | _uid = 0; 6 | _uidLength = 0; 7 | _tagType = "Unknown"; 8 | _ndefMessage = (NdefMessage*)NULL; 9 | } 10 | 11 | NfcTag::NfcTag(byte *uid, unsigned int uidLength) 12 | { 13 | _uid = uid; 14 | _uidLength = uidLength; 15 | _tagType = "Unknown"; 16 | _ndefMessage = (NdefMessage*)NULL; 17 | } 18 | 19 | NfcTag::NfcTag(byte *uid, unsigned int uidLength, String tagType) 20 | { 21 | _uid = uid; 22 | _uidLength = uidLength; 23 | _tagType = tagType; 24 | _ndefMessage = (NdefMessage*)NULL; 25 | } 26 | 27 | NfcTag::NfcTag(byte *uid, unsigned int uidLength, String tagType, NdefMessage& ndefMessage) 28 | { 29 | _uid = uid; 30 | _uidLength = uidLength; 31 | _tagType = tagType; 32 | _ndefMessage = new NdefMessage(ndefMessage); 33 | } 34 | 35 | // I don't like this version, but it will use less memory 36 | NfcTag::NfcTag(byte *uid, unsigned int uidLength, String tagType, const byte *ndefData, const int ndefDataLength) 37 | { 38 | _uid = uid; 39 | _uidLength = uidLength; 40 | _tagType = tagType; 41 | _ndefMessage = new NdefMessage(ndefData, ndefDataLength); 42 | } 43 | 44 | NfcTag::~NfcTag() 45 | { 46 | delete _ndefMessage; 47 | } 48 | 49 | NfcTag& NfcTag::operator=(const NfcTag& rhs) 50 | { 51 | if (this != &rhs) 52 | { 53 | delete _ndefMessage; 54 | _uid = rhs._uid; 55 | _uidLength = rhs._uidLength; 56 | _tagType = rhs._tagType; 57 | // TODO do I need a copy here? 58 | _ndefMessage = rhs._ndefMessage; 59 | } 60 | return *this; 61 | } 62 | 63 | uint8_t NfcTag::getUidLength() 64 | { 65 | return _uidLength; 66 | } 67 | 68 | void NfcTag::getUid(byte *uid, unsigned int uidLength) 69 | { 70 | memcpy(uid, _uid, _uidLength < uidLength ? _uidLength : uidLength); 71 | } 72 | 73 | String NfcTag::getUidString() 74 | { 75 | String uidString = ""; 76 | for (int i = 0; i < _uidLength; i++) 77 | { 78 | if (i > 0) 79 | { 80 | uidString += " "; 81 | } 82 | 83 | if (_uid[i] < 0xF) 84 | { 85 | uidString += "0"; 86 | } 87 | 88 | uidString += String((unsigned int)_uid[i], (unsigned char)HEX); 89 | } 90 | uidString.toUpperCase(); 91 | return uidString; 92 | } 93 | 94 | String NfcTag::getTagType() 95 | { 96 | return _tagType; 97 | } 98 | 99 | boolean NfcTag::hasNdefMessage() 100 | { 101 | return (_ndefMessage != NULL); 102 | } 103 | 104 | NdefMessage NfcTag::getNdefMessage() 105 | { 106 | return *_ndefMessage; 107 | } 108 | 109 | void NfcTag::print() 110 | { 111 | Serial.print(F("NFC Tag - "));Serial.println(_tagType); 112 | Serial.print(F("UID "));Serial.println(getUidString()); 113 | if (_ndefMessage == NULL) 114 | { 115 | Serial.println(F("\nNo NDEF Message")); 116 | } 117 | else 118 | { 119 | _ndefMessage->print(); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/src/NFC/NfcTag.h: -------------------------------------------------------------------------------- 1 | #ifndef NfcTag_h 2 | #define NfcTag_h 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class NfcTag 9 | { 10 | public: 11 | NfcTag(); 12 | NfcTag(byte *uid, unsigned int uidLength); 13 | NfcTag(byte *uid, unsigned int uidLength, String tagType); 14 | NfcTag(byte *uid, unsigned int uidLength, String tagType, NdefMessage& ndefMessage); 15 | NfcTag(byte *uid, unsigned int uidLength, String tagType, const byte *ndefData, const int ndefDataLength); 16 | ~NfcTag(void); 17 | NfcTag& operator=(const NfcTag& rhs); 18 | uint8_t getUidLength(); 19 | void getUid(byte *uid, unsigned int uidLength); 20 | String getUidString(); 21 | String getTagType(); 22 | boolean hasNdefMessage(); 23 | NdefMessage getNdefMessage(); 24 | void print(); 25 | private: 26 | byte *_uid; 27 | unsigned int _uidLength; 28 | String _tagType; // Mifare Classic, NFC Forum Type {1,2,3,4}, Unknown 29 | NdefMessage* _ndefMessage; 30 | // TODO capacity 31 | // TODO isFormatted 32 | }; 33 | 34 | #endif -------------------------------------------------------------------------------- /libraries/AnduinoNFC/src/NFC/license.txt: -------------------------------------------------------------------------------- 1 | Software License Agreement (BSD License) 2 | 3 | Copyright (c) 2013-2014, Don Coleman 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holders nor the 17 | names of its contributors may be used to endorse or promote products 18 | derived from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 21 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 24 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/src/PN532/AnduinoInterface.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Check out the included Arduino sketch examples and Anduino Wiki to 3 | get started! 4 | https://github.com/andium/Anduino/wiki 5 | 6 | This is a modified version of PN532_SPI only renamed to reinforce 7 | that the PN532_SPI interface has been hardcoded for the Andium 8 | Anduino shield. 9 | 10 | Modified by Brian Carbonette Copyright © 2016 Andium 11 | Original source contributed by xiongyihui as well as SeedStudio 12 | and Adafruit can be found here https://github.com/Seeed-Studio/PN532 13 | 14 | Licensed under the Apache License, Version 2.0 (the "License"); 15 | you may not use this file except in compliance with the License. 16 | You may obtain a copy of the License at 17 | 18 | http://www.apache.org/licenses/LICENSE-2.0 19 | 20 | Unless required by applicable law or agreed to in writing, software 21 | distributed under the License is distributed on an "AS IS" BASIS, 22 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | See the License for the specific language governing permissions and 24 | limitations under the License. 25 | *******************************************************************/ 26 | /*Anduino PN532_SPI*/ 27 | 28 | #ifndef __AnduinoInterface_H 29 | #define __AnduinoInterface_H 30 | 31 | #include "Arduino.h" 32 | #include "AnduinoPins.h" 33 | 34 | #include "PN532/PN532.h" 35 | #include "AnduinoNFC.h" 36 | 37 | #include 38 | #include "PN532/PN532Interface.h" 39 | 40 | 41 | class AnduinoInterface : public PN532Interface { 42 | public: 43 | AnduinoInterface(SPIClass &spi, uint8_t ss); 44 | void begin(); 45 | void wakeup(); 46 | int8_t writeCommand(const uint8_t *header, uint8_t hlen, const uint8_t *body = 0, uint8_t blen = 0); 47 | int16_t readResponse(uint8_t buf[], uint8_t len, uint16_t timeout); 48 | 49 | private: 50 | SPIClass* _spi; 51 | uint8_t _ss; 52 | uint8_t command; 53 | 54 | boolean isReady(); 55 | void writeFrame(const uint8_t *header, uint8_t hlen, const uint8_t *body = 0, uint8_t blen = 0); 56 | int8_t readAckFrame(); 57 | 58 | inline void write(uint8_t data) { 59 | 60 | _spi->transfer(data); 61 | 62 | }; 63 | 64 | inline uint8_t read() { 65 | 66 | int8_t x; 67 | x = 0; 68 | x = _spi->transfer(0); 69 | 70 | return x; 71 | 72 | }; 73 | 74 | 75 | }; 76 | 77 | #endif /* __AnduinoInterface_H */ 78 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/src/PN532/PN532Interface.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef __PN532_INTERFACE_H__ 4 | #define __PN532_INTERFACE_H__ 5 | 6 | #include 7 | 8 | #define PN532_PREAMBLE (0x00) 9 | #define PN532_STARTCODE1 (0x00) 10 | #define PN532_STARTCODE2 (0xFF) 11 | #define PN532_POSTAMBLE (0x00) 12 | 13 | #define PN532_HOSTTOPN532 (0xD4) 14 | #define PN532_PN532TOHOST (0xD5) 15 | 16 | #define PN532_ACK_WAIT_TIME (10) // ms, timeout of waiting for ACK 17 | 18 | #define PN532_INVALID_ACK (-1) 19 | #define PN532_TIMEOUT (-2) 20 | #define PN532_INVALID_FRAME (-3) 21 | #define PN532_NO_SPACE (-4) 22 | 23 | #define REVERSE_BITS_ORDER(b) b = (b & 0xF0) >> 4 | (b & 0x0F) << 4; \ 24 | b = (b & 0xCC) >> 2 | (b & 0x33) << 2; \ 25 | b = (b & 0xAA) >> 1 | (b & 0x55) << 1 26 | 27 | class PN532Interface 28 | { 29 | public: 30 | virtual void begin() = 0; 31 | virtual void wakeup() = 0; 32 | 33 | /** 34 | * @brief write a command and check ack 35 | * @param header packet header 36 | * @param hlen length of header 37 | * @param body packet body 38 | * @param blen length of body 39 | * @return 0 success 40 | * not 0 failed 41 | */ 42 | virtual int8_t writeCommand(const uint8_t *header, uint8_t hlen, const uint8_t *body = 0, uint8_t blen = 0) = 0; 43 | 44 | /** 45 | * @brief read the response of a command, strip prefix and suffix 46 | * @param buf to contain the response data 47 | * @param len lenght to read 48 | * @param timeout max time to wait, 0 means no timeout 49 | * @return >=0 length of response without prefix and suffix 50 | * <0 failed to read response 51 | */ 52 | virtual int16_t readResponse(uint8_t buf[], uint8_t len, uint16_t timeout = 1000) = 0; 53 | }; 54 | 55 | #endif 56 | 57 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/src/PN532/PN532_debug.h: -------------------------------------------------------------------------------- 1 | #ifndef __DEBUG_H__ 2 | #define __DEBUG_H__ 3 | 4 | //#define DEBUG 5 | 6 | #include "Arduino.h" 7 | 8 | #ifdef DEBUG 9 | #define DMSG(args...) Serial.print(args) 10 | #define DMSG_STR(str) Serial.println(str) 11 | #define DMSG_HEX(num) Serial.print(' '); Serial.print(num, HEX) 12 | #define DMSG_INT(num) Serial.print(' '); Serial.print(num) 13 | #else 14 | #define DMSG(args...) 15 | #define DMSG_STR(str) 16 | #define DMSG_HEX(num) 17 | #define DMSG_INT(num) 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /libraries/AnduinoNFC/src/PN532/license.txt: -------------------------------------------------------------------------------- 1 | Software License Agreement (BSD License) 2 | 3 | Copyright (c) 2012, Adafruit Industries 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. Neither the name of the copyright holders nor the 14 | names of its contributors may be used to endorse or promote products 15 | derived from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 18 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /libraries/AnduinoPins/AnduinoPins.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Pin assignments for CC1200 Radio (SPI), PN532 NFC (SPI), 3 | ST7735 TFT (SPI), ATWINC1500 Radio (SPI) and EEPROM (I2C) on 4 | Anduino shield. 5 | 6 | Check out the included Arduino sketch examples and Anduino Wiki to 7 | get started! 8 | https://github.com/andium/Anduino/wiki 9 | 10 | Written by Brian Carbonette Copyright © 2017 Andium 11 | 12 | Licensed under the Apache License, Version 2.0 (the "License"); 13 | you may not use this file except in compliance with the License. 14 | You may obtain a copy of the License at 15 | 16 | http://www.apache.org/licenses/LICENSE-2.0 17 | 18 | Unless required by applicable law or agreed to in writing, software 19 | distributed under the License is distributed on an "AS IS" BASIS, 20 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | See the License for the specific language governing permissions and 22 | limitations under the License. 23 | *******************************************************************/ 24 | 25 | #define AnduinoWiFi 26 | //#define AnduinoSubG 27 | 28 | #ifdef AnduinoWiFi 29 | /* Anduino pin definitions */ 30 | #define ARDUINO_RST_PIN A0 /* Reset for Arduino itself */ 31 | #define PERIPH_RST_PIN 5 /* Reset signal for CC1200 radio, PN532 NFC */ 32 | 33 | #define ST7735_RST_PIN 13 /* ST7735 Reset Pin */ 34 | #define ST7735_CS_PIN 9 /* ST7735 chip select pin */ 35 | #define ST7735_DC_PIN 8 /* ST7735 DC (data / command) pin */ 36 | #define ST7735_BKLIT_PIN 4 /* ST7735 backlight pin */ 37 | 38 | #define PN532_CS_PIN 6 /* PN532 chip select pin */ 39 | #define PN532_IRQ_PIN 2 /* PN532 IRQ pin */ 40 | 41 | #elif defined AnduinoSubG 42 | 43 | /* Anduino pin definitions */ 44 | #define ARDUINO_RST_PIN A0 /* Reset for Arduino itself */ 45 | #define PERIPH_RST_PIN 14 /* Reset signal for CC1200 radio, PN532 NFC and ST7735 TFT */ 46 | 47 | #define CC1200_CS_PIN 9 /* CC1200 chip select pin */ 48 | #define CC1200_IRQ1_PIN 3 /* CC1200 IRQ pin (GPIO2) */ 49 | #define CC1200_IRQ2_PIN 10 /* CC1200 IRQ pin (GPIO3) */ 50 | 51 | #define ST7735_CS_PIN 7 /* ST7735 chip select pin */ 52 | #define ST7735_DC_PIN 8 /* ST7735 DC (data / command) pin */ 53 | #define ST7735_BKLIT_PIN 5 /* ST7735 backlight pin */ 54 | 55 | #define PN532_CS_PIN 6 /* PN532 chip select pin */ 56 | #define PN532_IRQ_PIN 2 /* PN532 IRQ pin */ 57 | 58 | #endif 59 | 60 | 61 | -------------------------------------------------------------------------------- /libraries/AnduinoPins/library.properties: -------------------------------------------------------------------------------- 1 | name=AnduinoPins 2 | version=1.0.3 3 | author=Brian Carbonette 4 | maintainer=Brian Carbonette 5 | sentence=Pin definitions for Anduino Shield. 6 | paragraph=Pin definitions for Anduino Shield. 7 | category=* 8 | url=https://github.com/Andium/Anduino 9 | architectures=* 10 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/README.md: -------------------------------------------------------------------------------- 1 | #AnduinoWiFi 2 | 3 | 4 | Check out the [AnduinoWiFi wiki](https://github.com/andium/Anduino/wiki/AnduinoWiFi)! -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/examples/CheckWifi101FirmwareVersion/CheckWifi101FirmwareVersion.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * This example check if the firmware loaded on the WiFi101 3 | * shield is updated. 4 | * 5 | * Circuit: 6 | * - WiFi101 Shield attached 7 | * 8 | * Created 29 July 2015 by Cristian Maglie 9 | * This code is in the public domain. 10 | */ 11 | #include 12 | #include 13 | 14 | void setup() { 15 | // Initialize serial 16 | Serial.begin(9600); 17 | while (!Serial) { 18 | ; // wait for serial port to connect. Needed for native USB port only 19 | } 20 | 21 | // Print a welcome message 22 | Serial.println("WiFi101 firmware check."); 23 | Serial.println(); 24 | 25 | // Check for the presence of the shield 26 | Serial.print("WiFi101 shield: "); 27 | if (WiFi.status() == WL_NO_SHIELD) { 28 | Serial.println("NOT PRESENT"); 29 | return; // don't continue 30 | } 31 | Serial.println("DETECTED"); 32 | 33 | // Print firmware version on the shield 34 | String fv = WiFi.firmwareVersion(); 35 | Serial.print("Firmware version installed: "); 36 | Serial.println(fv); 37 | 38 | // Print required firmware version 39 | Serial.print("Firmware version required : "); 40 | Serial.println(WIFI_FIRMWARE_REQUIRED); 41 | 42 | // Check if the required version is installed 43 | Serial.println(); 44 | if (fv == WIFI_FIRMWARE_REQUIRED) { 45 | Serial.println("Check result: PASSED"); 46 | } else { 47 | Serial.println("Check result: NOT PASSED"); 48 | Serial.println(" - The firmware version on the shield do not match the"); 49 | Serial.println(" version required by the library, you may experience"); 50 | Serial.println(" issues or failures."); 51 | } 52 | } 53 | 54 | void loop() { 55 | // do nothing 56 | } 57 | 58 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/examples/ConnectNoEncryption/ConnectNoEncryption.ino: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This example connects to an unencrypted WiFi network. 4 | Then it prints the MAC address of the WiFi shield, 5 | the IP address obtained, and other network details. 6 | 7 | Circuit: 8 | * WiFi shield attached 9 | 10 | created 13 July 2010 11 | by dlf (Metodo2 srl) 12 | modified 31 May 2012 13 | by Tom Igoe 14 | */ 15 | #include 16 | #include 17 | 18 | char ssid[] = "yourNetwork"; // the name of your network 19 | int status = WL_IDLE_STATUS; // the WiFi radio's status 20 | 21 | void setup() { 22 | //Initialize serial and wait for port to open: 23 | Serial.begin(9600); 24 | while (!Serial) { 25 | ; // wait for serial port to connect. Needed for native USB port only 26 | } 27 | 28 | // check for the presence of the shield: 29 | if (WiFi.status() == WL_NO_SHIELD) { 30 | Serial.println("WiFi shield not present"); 31 | // don't continue: 32 | while (true); 33 | } 34 | 35 | // attempt to connect to WiFi network: 36 | while ( status != WL_CONNECTED) { 37 | Serial.print("Attempting to connect to open SSID: "); 38 | Serial.println(ssid); 39 | status = WiFi.begin(ssid); 40 | 41 | // wait 10 seconds for connection: 42 | delay(10000); 43 | } 44 | 45 | // you're connected now, so print out the data: 46 | Serial.print("You're connected to the network"); 47 | printCurrentNet(); 48 | printWiFiData(); 49 | } 50 | 51 | void loop() { 52 | // check the network connection once every 10 seconds: 53 | delay(10000); 54 | printCurrentNet(); 55 | } 56 | 57 | void printWiFiData() { 58 | // print your WiFi shield's IP address: 59 | IPAddress ip = WiFi.localIP(); 60 | Serial.print("IP Address: "); 61 | Serial.println(ip); 62 | Serial.println(ip); 63 | 64 | // print your MAC address: 65 | byte mac[6]; 66 | WiFi.macAddress(mac); 67 | Serial.print("MAC address: "); 68 | Serial.print(mac[5], HEX); 69 | Serial.print(":"); 70 | Serial.print(mac[4], HEX); 71 | Serial.print(":"); 72 | Serial.print(mac[3], HEX); 73 | Serial.print(":"); 74 | Serial.print(mac[2], HEX); 75 | Serial.print(":"); 76 | Serial.print(mac[1], HEX); 77 | Serial.print(":"); 78 | Serial.println(mac[0], HEX); 79 | 80 | // print your subnet mask: 81 | IPAddress subnet = WiFi.subnetMask(); 82 | Serial.print("NetMask: "); 83 | Serial.println(subnet); 84 | 85 | // print your gateway address: 86 | IPAddress gateway = WiFi.gatewayIP(); 87 | Serial.print("Gateway: "); 88 | Serial.println(gateway); 89 | } 90 | 91 | void printCurrentNet() { 92 | // print the SSID of the network you're attached to: 93 | Serial.print("SSID: "); 94 | Serial.println(WiFi.SSID()); 95 | 96 | // print the MAC address of the router you're attached to: 97 | byte bssid[6]; 98 | WiFi.BSSID(bssid); 99 | Serial.print("BSSID: "); 100 | Serial.print(bssid[5], HEX); 101 | Serial.print(":"); 102 | Serial.print(bssid[4], HEX); 103 | Serial.print(":"); 104 | Serial.print(bssid[3], HEX); 105 | Serial.print(":"); 106 | Serial.print(bssid[2], HEX); 107 | Serial.print(":"); 108 | Serial.print(bssid[1], HEX); 109 | Serial.print(":"); 110 | Serial.println(bssid[0], HEX); 111 | 112 | // print the received signal strength: 113 | long rssi = WiFi.RSSI(); 114 | Serial.print("signal strength (RSSI):"); 115 | Serial.println(rssi); 116 | 117 | // print the encryption type: 118 | byte encryption = WiFi.encryptionType(); 119 | Serial.print("Encryption Type:"); 120 | Serial.println(encryption, HEX); 121 | } 122 | 123 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/examples/ConnectWithWEP/ConnectWithWEP.ino: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This example connects to a WEP-encrypted WiFi network. 4 | Then it prints the MAC address of the WiFi shield, 5 | the IP address obtained, and other network details. 6 | 7 | If you use 40-bit WEP, you need a key that is 10 characters long, 8 | and the characters must be hexadecimal (0-9 or A-F). 9 | e.g. for 40-bit, ABBADEAF01 will work, but ABBADEAF won't work 10 | (too short) and ABBAISDEAF won't work (I and S are not 11 | hexadecimal characters). 12 | 13 | For 128-bit, you need a string that is 26 characters long. 14 | D0D0DEADF00DABBADEAFBEADED will work because it's 26 characters, 15 | all in the 0-9, A-F range. 16 | 17 | Circuit: 18 | * WiFi shield attached 19 | 20 | created 13 July 2010 21 | by dlf (Metodo2 srl) 22 | modified 31 May 2012 23 | by Tom Igoe 24 | */ 25 | #include 26 | #include 27 | 28 | char ssid[] = "yourNetwork"; // your network SSID (name) 29 | char key[] = "D0D0DEADF00DABBADEAFBEADED"; // your network key 30 | int keyIndex = 0; // your network key Index number 31 | int status = WL_IDLE_STATUS; // the WiFi radio's status 32 | 33 | void setup() { 34 | //Initialize serial and wait for port to open: 35 | Serial.begin(9600); 36 | while (!Serial) { 37 | ; // wait for serial port to connect. Needed for native USB port only 38 | } 39 | 40 | // check for the presence of the shield: 41 | if (WiFi.status() == WL_NO_SHIELD) { 42 | Serial.println("WiFi shield not present"); 43 | // don't continue: 44 | while (true); 45 | } 46 | 47 | // attempt to connect to WiFi network: 48 | while ( status != WL_CONNECTED) { 49 | Serial.print("Attempting to connect to WEP network, SSID: "); 50 | Serial.println(ssid); 51 | status = WiFi.begin(ssid, keyIndex, key); 52 | 53 | // wait 10 seconds for connection: 54 | delay(10000); 55 | } 56 | 57 | // once you are connected : 58 | Serial.print("You're connected to the network"); 59 | printCurrentNet(); 60 | printWiFiData(); 61 | } 62 | 63 | void loop() { 64 | // check the network connection once every 10 seconds: 65 | delay(10000); 66 | printCurrentNet(); 67 | } 68 | 69 | void printWiFiData() { 70 | // print your WiFi shield's IP address: 71 | IPAddress ip = WiFi.localIP(); 72 | Serial.print("IP Address: "); 73 | Serial.println(ip); 74 | Serial.println(ip); 75 | 76 | // print your MAC address: 77 | byte mac[6]; 78 | WiFi.macAddress(mac); 79 | Serial.print("MAC address: "); 80 | Serial.print(mac[5], HEX); 81 | Serial.print(":"); 82 | Serial.print(mac[4], HEX); 83 | Serial.print(":"); 84 | Serial.print(mac[3], HEX); 85 | Serial.print(":"); 86 | Serial.print(mac[2], HEX); 87 | Serial.print(":"); 88 | Serial.print(mac[1], HEX); 89 | Serial.print(":"); 90 | Serial.println(mac[0], HEX); 91 | } 92 | 93 | void printCurrentNet() { 94 | // print the SSID of the network you're attached to: 95 | Serial.print("SSID: "); 96 | Serial.println(WiFi.SSID()); 97 | 98 | // print the MAC address of the router you're attached to: 99 | byte bssid[6]; 100 | WiFi.BSSID(bssid); 101 | Serial.print("BSSID: "); 102 | Serial.print(bssid[5], HEX); 103 | Serial.print(":"); 104 | Serial.print(bssid[4], HEX); 105 | Serial.print(":"); 106 | Serial.print(bssid[3], HEX); 107 | Serial.print(":"); 108 | Serial.print(bssid[2], HEX); 109 | Serial.print(":"); 110 | Serial.print(bssid[1], HEX); 111 | Serial.print(":"); 112 | Serial.println(bssid[0], HEX); 113 | 114 | // print the received signal strength: 115 | long rssi = WiFi.RSSI(); 116 | Serial.print("signal strength (RSSI):"); 117 | Serial.println(rssi); 118 | 119 | // print the encryption type: 120 | byte encryption = WiFi.encryptionType(); 121 | Serial.print("Encryption Type:"); 122 | Serial.println(encryption, HEX); 123 | Serial.println(); 124 | } 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/examples/ConnectWithWPA/ConnectWithWPA.ino: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This example connects to an unencrypted WiFi network. 4 | Then it prints the MAC address of the WiFi shield, 5 | the IP address obtained, and other network details. 6 | 7 | Circuit: 8 | * WiFi shield attached 9 | 10 | created 13 July 2010 11 | by dlf (Metodo2 srl) 12 | modified 31 May 2012 13 | by Tom Igoe 14 | */ 15 | #include 16 | #include 17 | 18 | char ssid[] = "yourNetwork"; // your network SSID (name) 19 | char pass[] = "secretPassword"; // your network password 20 | int status = WL_IDLE_STATUS; // the WiFi radio's status 21 | 22 | void setup() { 23 | //Initialize serial and wait for port to open: 24 | Serial.begin(9600); 25 | while (!Serial) { 26 | ; // wait for serial port to connect. Needed for native USB port only 27 | } 28 | 29 | // check for the presence of the shield: 30 | if (WiFi.status() == WL_NO_SHIELD) { 31 | Serial.println("WiFi shield not present"); 32 | // don't continue: 33 | while (true); 34 | } 35 | 36 | // attempt to connect to WiFi network: 37 | while ( status != WL_CONNECTED) { 38 | Serial.print("Attempting to connect to WPA SSID: "); 39 | Serial.println(ssid); 40 | // Connect to WPA/WPA2 network: 41 | status = WiFi.begin(ssid, pass); 42 | 43 | // wait 10 seconds for connection: 44 | delay(10000); 45 | } 46 | 47 | // you're connected now, so print out the data: 48 | Serial.print("You're connected to the network"); 49 | printCurrentNet(); 50 | printWiFiData(); 51 | 52 | } 53 | 54 | void loop() { 55 | // check the network connection once every 10 seconds: 56 | delay(10000); 57 | printCurrentNet(); 58 | } 59 | 60 | void printWiFiData() { 61 | // print your WiFi shield's IP address: 62 | IPAddress ip = WiFi.localIP(); 63 | Serial.print("IP Address: "); 64 | Serial.println(ip); 65 | Serial.println(ip); 66 | 67 | // print your MAC address: 68 | byte mac[6]; 69 | WiFi.macAddress(mac); 70 | Serial.print("MAC address: "); 71 | Serial.print(mac[5], HEX); 72 | Serial.print(":"); 73 | Serial.print(mac[4], HEX); 74 | Serial.print(":"); 75 | Serial.print(mac[3], HEX); 76 | Serial.print(":"); 77 | Serial.print(mac[2], HEX); 78 | Serial.print(":"); 79 | Serial.print(mac[1], HEX); 80 | Serial.print(":"); 81 | Serial.println(mac[0], HEX); 82 | 83 | } 84 | 85 | void printCurrentNet() { 86 | // print the SSID of the network you're attached to: 87 | Serial.print("SSID: "); 88 | Serial.println(WiFi.SSID()); 89 | 90 | // print the MAC address of the router you're attached to: 91 | byte bssid[6]; 92 | WiFi.BSSID(bssid); 93 | Serial.print("BSSID: "); 94 | Serial.print(bssid[5], HEX); 95 | Serial.print(":"); 96 | Serial.print(bssid[4], HEX); 97 | Serial.print(":"); 98 | Serial.print(bssid[3], HEX); 99 | Serial.print(":"); 100 | Serial.print(bssid[2], HEX); 101 | Serial.print(":"); 102 | Serial.print(bssid[1], HEX); 103 | Serial.print(":"); 104 | Serial.println(bssid[0], HEX); 105 | 106 | // print the received signal strength: 107 | long rssi = WiFi.RSSI(); 108 | Serial.print("signal strength (RSSI):"); 109 | Serial.println(rssi); 110 | 111 | // print the encryption type: 112 | byte encryption = WiFi.encryptionType(); 113 | Serial.print("Encryption Type:"); 114 | Serial.println(encryption, HEX); 115 | Serial.println(); 116 | } 117 | 118 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/examples/FirmwareUpdater/Endianess.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Endianess.ino - Network byte order conversion functions. 3 | Copyright (c) 2015 Arduino LLC. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | 21 | bool isBigEndian() { 22 | uint32_t test = 0x11223344; 23 | uint8_t *pTest = reinterpret_cast(&test); 24 | return pTest[0] == 0x11; 25 | } 26 | 27 | uint32_t fromNetwork32(uint32_t from) { 28 | static const bool be = isBigEndian(); 29 | if (be) { 30 | return from; 31 | } else { 32 | uint8_t *pFrom = reinterpret_cast(&from); 33 | uint32_t to; 34 | to = pFrom[0]; to <<= 8; 35 | to |= pFrom[1]; to <<= 8; 36 | to |= pFrom[2]; to <<= 8; 37 | to |= pFrom[3]; 38 | return to; 39 | } 40 | } 41 | 42 | uint16_t fromNetwork16(uint16_t from) { 43 | static bool be = isBigEndian(); 44 | if (be) { 45 | return from; 46 | } else { 47 | uint8_t *pFrom = reinterpret_cast(&from); 48 | uint16_t to; 49 | to = pFrom[0]; to <<= 8; 50 | to |= pFrom[1]; 51 | return to; 52 | } 53 | } 54 | 55 | uint32_t toNetwork32(uint32_t to) { 56 | return fromNetwork32(to); 57 | } 58 | 59 | uint16_t toNetwork16(uint16_t to) { 60 | return fromNetwork16(to); 61 | } 62 | 63 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/examples/FirmwareUpdater/FirmwareUpdater.ino: -------------------------------------------------------------------------------- 1 | /* 2 | FirmwareUpdate.h - Firmware Updater for WiFi101 / WINC1500. 3 | Copyright (c) 2015 Arduino LLC. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | typedef struct __attribute__((__packed__)) { 24 | uint8_t command; 25 | uint32_t address; 26 | uint32_t arg1; 27 | uint16_t payloadLength; 28 | 29 | // payloadLenght bytes of data follows... 30 | } UartPacket; 31 | 32 | static const int MAX_PAYLOAD_SIZE = 1024; 33 | 34 | #define CMD_READ_FLASH 0x01 35 | #define CMD_WRITE_FLASH 0x02 36 | #define CMD_ERASE_FLASH 0x03 37 | #define CMD_MAX_PAYLOAD_SIZE 0x50 38 | #define CMD_HELLO 0x99 39 | 40 | void setup() { 41 | Serial.begin(115200); 42 | 43 | nm_bsp_init(); 44 | if (m2m_wifi_download_mode() != M2M_SUCCESS) { 45 | Serial.println(F("Failed to put the WiFi module in download mode")); 46 | while (true) 47 | ; 48 | } 49 | } 50 | 51 | void receivePacket(UartPacket *pkt, uint8_t *payload) { 52 | // Read command 53 | uint8_t *p = reinterpret_cast(pkt); 54 | uint16_t l = sizeof(UartPacket); 55 | while (l > 0) { 56 | int c = Serial.read(); 57 | if (c == -1) 58 | continue; 59 | *p++ = c; 60 | l--; 61 | } 62 | 63 | // Convert parameters from network byte order to cpu byte order 64 | pkt->address = fromNetwork32(pkt->address); 65 | pkt->arg1 = fromNetwork32(pkt->arg1); 66 | pkt->payloadLength = fromNetwork16(pkt->payloadLength); 67 | 68 | // Read payload 69 | l = pkt->payloadLength; 70 | while (l > 0) { 71 | int c = Serial.read(); 72 | if (c == -1) 73 | continue; 74 | *payload++ = c; 75 | l--; 76 | } 77 | } 78 | 79 | // Allocated statically so the compiler can tell us 80 | // about the amount of used RAM 81 | static UartPacket pkt; 82 | static uint8_t payload[MAX_PAYLOAD_SIZE]; 83 | 84 | void loop() { 85 | receivePacket(&pkt, payload); 86 | 87 | if (pkt.command == CMD_HELLO) { 88 | if (pkt.address == 0x11223344 && pkt.arg1 == 0x55667788) 89 | Serial.print("v10000"); 90 | } 91 | 92 | if (pkt.command == CMD_MAX_PAYLOAD_SIZE) { 93 | uint16_t res = toNetwork16(MAX_PAYLOAD_SIZE); 94 | Serial.write(reinterpret_cast(&res), sizeof(res)); 95 | } 96 | 97 | if (pkt.command == CMD_READ_FLASH) { 98 | uint32_t address = pkt.address; 99 | uint32_t len = pkt.arg1; 100 | if (spi_flash_read(payload, address, len) != M2M_SUCCESS) { 101 | Serial.println("ER"); 102 | } else { 103 | Serial.write(payload, len); 104 | Serial.print("OK"); 105 | } 106 | } 107 | 108 | if (pkt.command == CMD_WRITE_FLASH) { 109 | uint32_t address = pkt.address; 110 | uint32_t len = pkt.payloadLength; 111 | if (spi_flash_write(payload, address, len) != M2M_SUCCESS) { 112 | Serial.print("ER"); 113 | } else { 114 | Serial.print("OK"); 115 | } 116 | } 117 | 118 | if (pkt.command == CMD_ERASE_FLASH) { 119 | uint32_t address = pkt.address; 120 | uint32_t len = pkt.arg1; 121 | if (spi_flash_erase(address, len) != M2M_SUCCESS) { 122 | Serial.print("ER"); 123 | } else { 124 | Serial.print("OK"); 125 | } 126 | } 127 | } 128 | 129 | 130 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/examples/ScanNetworks/ScanNetworks.ino: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This example prints the WiFi shield's MAC address, and 4 | scans for available WiFi networks using the WiFi shield. 5 | Every ten seconds, it scans again. It doesn't actually 6 | connect to any network, so no encryption scheme is specified. 7 | 8 | Circuit: 9 | * WiFi shield attached 10 | 11 | created 13 July 2010 12 | by dlf (Metodo2 srl) 13 | modified 21 Junn 2012 14 | by Tom Igoe and Jaymes Dec 15 | */ 16 | 17 | 18 | #include 19 | #include 20 | 21 | void setup() { 22 | //Initialize serial and wait for port to open: 23 | Serial.begin(9600); 24 | while (!Serial) { 25 | ; // wait for serial port to connect. Needed for native USB port only 26 | } 27 | 28 | // check for the presence of the shield: 29 | if (WiFi.status() == WL_NO_SHIELD) { 30 | Serial.println("WiFi shield not present"); 31 | // don't continue: 32 | while (true); 33 | } 34 | 35 | // Print WiFi MAC address: 36 | printMacAddress(); 37 | 38 | // scan for existing networks: 39 | Serial.println("Scanning available networks..."); 40 | listNetworks(); 41 | } 42 | 43 | void loop() { 44 | delay(10000); 45 | // scan for existing networks: 46 | Serial.println("Scanning available networks..."); 47 | listNetworks(); 48 | } 49 | 50 | void printMacAddress() { 51 | // the MAC address of your WiFi shield 52 | byte mac[6]; 53 | 54 | // print your MAC address: 55 | WiFi.macAddress(mac); 56 | Serial.print("MAC: "); 57 | Serial.print(mac[5], HEX); 58 | Serial.print(":"); 59 | Serial.print(mac[4], HEX); 60 | Serial.print(":"); 61 | Serial.print(mac[3], HEX); 62 | Serial.print(":"); 63 | Serial.print(mac[2], HEX); 64 | Serial.print(":"); 65 | Serial.print(mac[1], HEX); 66 | Serial.print(":"); 67 | Serial.println(mac[0], HEX); 68 | } 69 | 70 | void listNetworks() { 71 | // scan for nearby networks: 72 | Serial.println("** Scan Networks **"); 73 | int numSsid = WiFi.scanNetworks(); 74 | if (numSsid == -1) 75 | { 76 | Serial.println("Couldn't get a wifi connection"); 77 | while (true); 78 | } 79 | 80 | // print the list of networks seen: 81 | Serial.print("number of available networks:"); 82 | Serial.println(numSsid); 83 | 84 | // print the network number and name for each network found: 85 | for (int thisNet = 0; thisNet < numSsid; thisNet++) { 86 | Serial.print(thisNet); 87 | Serial.print(") "); 88 | Serial.print(WiFi.SSID(thisNet)); 89 | Serial.print("\tSignal: "); 90 | Serial.print(WiFi.RSSI(thisNet)); 91 | Serial.print(" dBm"); 92 | Serial.print("\tEncryption: "); 93 | printEncryptionType(WiFi.encryptionType(thisNet)); 94 | Serial.flush(); 95 | } 96 | } 97 | 98 | void printEncryptionType(int thisType) { 99 | // read the encryption type and print out the name: 100 | switch (thisType) { 101 | case ENC_TYPE_WEP: 102 | Serial.println("WEP"); 103 | break; 104 | case ENC_TYPE_TKIP: 105 | Serial.println("WPA"); 106 | break; 107 | case ENC_TYPE_CCMP: 108 | Serial.println("WPA2"); 109 | break; 110 | case ENC_TYPE_NONE: 111 | Serial.println("None"); 112 | break; 113 | case ENC_TYPE_AUTO: 114 | Serial.println("Auto"); 115 | break; 116 | } 117 | } 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/examples/ScanNetworksAdvanced/ScanNetworksAdvanced.ino: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This example prints the WiFi 101 shield or MKR1000 MAC address, and 4 | scans for available WiFi networks using the WiFi 101 shield or MKR1000 board. 5 | Every ten seconds, it scans again. It doesn't actually 6 | connect to any network, so no encryption scheme is specified. 7 | BSSID and WiFi channel are printed 8 | 9 | Circuit: 10 | WiFi 101 shield attached or MKR1000 board 11 | 12 | This example is based on ScanNetworks 13 | 14 | created 1 Mar 2017 15 | by Arturo Guadalupi 16 | */ 17 | 18 | 19 | #include 20 | #include 21 | 22 | void setup() { 23 | //Initialize serial and wait for port to open: 24 | Serial.begin(9600); 25 | while (!Serial) { 26 | ; // wait for serial port to connect. Needed for native USB port only 27 | } 28 | 29 | // check for the presence of the shield: 30 | if (WiFi.status() == WL_NO_SHIELD) { 31 | Serial.println("WiFi shield not present"); 32 | // don't continue: 33 | while (true); 34 | } 35 | 36 | // Print WiFi MAC address: 37 | printMacAddress(); 38 | 39 | // scan for existing networks: 40 | Serial.println(); 41 | Serial.println("Scanning available networks..."); 42 | listNetworks(); 43 | } 44 | 45 | void loop() { 46 | delay(10000); 47 | // scan for existing networks: 48 | Serial.println("Scanning available networks..."); 49 | listNetworks(); 50 | } 51 | 52 | void printMacAddress() { 53 | // the MAC address of your WiFi shield 54 | byte mac[6]; 55 | 56 | // print your MAC address: 57 | WiFi.macAddress(mac); 58 | Serial.print("MAC: "); 59 | print2Digits(mac[5]); 60 | Serial.print(":"); 61 | print2Digits(mac[4]); 62 | Serial.print(":"); 63 | print2Digits(mac[3]); 64 | Serial.print(":"); 65 | print2Digits(mac[2]); 66 | Serial.print(":"); 67 | print2Digits(mac[1]); 68 | Serial.print(":"); 69 | print2Digits(mac[0]); 70 | } 71 | 72 | void listNetworks() { 73 | // scan for nearby networks: 74 | Serial.println("** Scan Networks **"); 75 | int numSsid = WiFi.scanNetworks(); 76 | if (numSsid == -1) 77 | { 78 | Serial.println("Couldn't get a WiFi connection"); 79 | while (true); 80 | } 81 | 82 | // print the list of networks seen: 83 | Serial.print("number of available networks: "); 84 | Serial.println(numSsid); 85 | 86 | // print the network number and name for each network found: 87 | for (int thisNet = 0; thisNet < numSsid; thisNet++) { 88 | Serial.print(thisNet + 1); 89 | Serial.print(") "); 90 | Serial.print("Signal: "); 91 | Serial.print(WiFi.RSSI(thisNet)); 92 | Serial.print(" dBm"); 93 | Serial.print("\tChannel: "); 94 | Serial.print(WiFi.channel(thisNet)); 95 | byte bssid[6]; 96 | Serial.print("\t\tBSSID: "); 97 | printBSSID(WiFi.BSSID(thisNet, bssid)); 98 | Serial.print("\tEncryption: "); 99 | printEncryptionType(WiFi.encryptionType(thisNet)); 100 | Serial.print("\t\tSSID: "); 101 | Serial.println(WiFi.SSID(thisNet)); 102 | Serial.flush(); 103 | } 104 | Serial.println(); 105 | } 106 | 107 | void printBSSID(byte bssid[]) { 108 | print2Digits(bssid[5]); 109 | Serial.print(":"); 110 | print2Digits(bssid[4]); 111 | Serial.print(":"); 112 | print2Digits(bssid[3]); 113 | Serial.print(":"); 114 | print2Digits(bssid[2]); 115 | Serial.print(":"); 116 | print2Digits(bssid[1]); 117 | Serial.print(":"); 118 | print2Digits(bssid[0]); 119 | } 120 | 121 | void printEncryptionType(int thisType) { 122 | // read the encryption type and print out the name: 123 | switch (thisType) { 124 | case ENC_TYPE_WEP: 125 | Serial.print("WEP"); 126 | break; 127 | case ENC_TYPE_TKIP: 128 | Serial.print("WPA"); 129 | break; 130 | case ENC_TYPE_CCMP: 131 | Serial.print("WPA2"); 132 | break; 133 | case ENC_TYPE_NONE: 134 | Serial.print("None"); 135 | break; 136 | case ENC_TYPE_AUTO: 137 | Serial.print("Auto"); 138 | break; 139 | } 140 | } 141 | 142 | void print2Digits(byte thisByte) { 143 | if (thisByte < 0xF) { 144 | Serial.print("0"); 145 | } 146 | Serial.print(thisByte, HEX); 147 | } 148 | 149 | 150 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/examples/WiFiChatServer/WiFiChatServer.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Chat Server 3 | 4 | A simple server that distributes any incoming messages to all 5 | connected clients. To use telnet to your device's IP address and type. 6 | You can see the client's input in the serial monitor as well. 7 | 8 | This example is written for a network using WPA encryption. For 9 | WEP or WPA, change the WiFi.begin() call accordingly. 10 | 11 | 12 | Circuit: 13 | * WiFi shield attached 14 | 15 | created 18 Dec 2009 16 | by David A. Mellis 17 | modified 31 May 2012 18 | by Tom Igoe 19 | 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | char ssid[] = "yourNetwork"; // your network SSID (name) 26 | char pass[] = "secretPassword"; // your network password (use for WPA, or use as key for WEP) 27 | 28 | int keyIndex = 0; // your network key Index number (needed only for WEP) 29 | 30 | int status = WL_IDLE_STATUS; 31 | 32 | WiFiServer server(23); 33 | 34 | boolean alreadyConnected = false; // whether or not the client was connected previously 35 | 36 | void setup() { 37 | //Initialize serial and wait for port to open: 38 | Serial.begin(9600); 39 | while (!Serial) { 40 | ; // wait for serial port to connect. Needed for native USB port only 41 | } 42 | 43 | // check for the presence of the shield: 44 | if (WiFi.status() == WL_NO_SHIELD) { 45 | Serial.println("WiFi shield not present"); 46 | // don't continue: 47 | while (true); 48 | } 49 | 50 | // attempt to connect to WiFi network: 51 | while ( status != WL_CONNECTED) { 52 | Serial.print("Attempting to connect to SSID: "); 53 | Serial.println(ssid); 54 | // Connect to WPA/WPA2 network. Change this line if using open or WEP network: 55 | status = WiFi.begin(ssid, pass); 56 | 57 | // wait 10 seconds for connection: 58 | delay(10000); 59 | } 60 | 61 | // start the server: 62 | server.begin(); 63 | // you're connected now, so print out the status: 64 | printWiFiStatus(); 65 | } 66 | 67 | 68 | void loop() { 69 | // wait for a new client: 70 | WiFiClient client = server.available(); 71 | 72 | 73 | // when the client sends the first byte, say hello: 74 | if (client) { 75 | if (!alreadyConnected) { 76 | // clead out the input buffer: 77 | client.flush(); 78 | Serial.println("We have a new client"); 79 | client.println("Hello, client!"); 80 | alreadyConnected = true; 81 | } 82 | 83 | if (client.available() > 0) { 84 | // read the bytes incoming from the client: 85 | char thisChar = client.read(); 86 | // echo the bytes back to the client: 87 | server.write(thisChar); 88 | // echo the bytes to the server as well: 89 | Serial.write(thisChar); 90 | } 91 | } 92 | } 93 | 94 | 95 | void printWiFiStatus() { 96 | // print the SSID of the network you're attached to: 97 | Serial.print("SSID: "); 98 | Serial.println(WiFi.SSID()); 99 | 100 | // print your WiFi shield's IP address: 101 | IPAddress ip = WiFi.localIP(); 102 | Serial.print("IP Address: "); 103 | Serial.println(ip); 104 | 105 | // print the received signal strength: 106 | long rssi = WiFi.RSSI(); 107 | Serial.print("signal strength (RSSI):"); 108 | Serial.print(rssi); 109 | Serial.println(" dBm"); 110 | } 111 | 112 | 113 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/examples/WiFiPing/WiFiPing.ino: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This example connects to a encrypted WiFi network (WPA/WPA2). 4 | Then it prints the MAC address of the WiFi shield, 5 | the IP address obtained, and other network details. 6 | Then it continuously pings given host specified by IP Address or name. 7 | 8 | Circuit: 9 | WiFi shield attached / MKR1000 10 | 11 | created 13 July 2010 12 | by dlf (Metodo2 srl) 13 | modified 09 June 2016 14 | by Petar Georgiev 15 | */ 16 | #include 17 | #include 18 | 19 | char ssid[] = "yourNetwork"; // your network SSID (name) 20 | char pass[] = "secretPassword"; // your network password 21 | int status = WL_IDLE_STATUS; // the WiFi radio's status 22 | 23 | // Specify IP address or hostname 24 | String hostName = "www.google.com"; 25 | int pingResult; 26 | 27 | void setup() { 28 | // Initialize serial and wait for port to open: 29 | Serial.begin(9600); 30 | while (!Serial) { 31 | ; // wait for serial port to connect. Needed for native USB port only 32 | } 33 | 34 | // check for the presence of the shield: 35 | if (WiFi.status() == WL_NO_SHIELD) { 36 | Serial.println("WiFi shield not present"); 37 | // don't continue: 38 | while (true); 39 | } 40 | 41 | // attempt to connect to WiFi network: 42 | while ( status != WL_CONNECTED) { 43 | Serial.print("Attempting to connect to WPA SSID: "); 44 | Serial.println(ssid); 45 | // Connect to WPA/WPA2 network: 46 | status = WiFi.begin(ssid, pass); 47 | 48 | // wait 5 seconds for connection: 49 | delay(5000); 50 | } 51 | 52 | // you're connected now, so print out the data: 53 | Serial.println("You're connected to the network"); 54 | printCurrentNet(); 55 | printWiFiData(); 56 | } 57 | 58 | void loop() { 59 | Serial.print("Pinging "); 60 | Serial.print(hostName); 61 | Serial.print(": "); 62 | 63 | pingResult = WiFi.ping(hostName); 64 | 65 | if (pingResult >= 0) { 66 | Serial.print("SUCCESS! RTT = "); 67 | Serial.print(pingResult); 68 | Serial.println(" ms"); 69 | } else { 70 | Serial.print("FAILED! Error code: "); 71 | Serial.println(pingResult); 72 | } 73 | 74 | delay(5000); 75 | } 76 | 77 | void printWiFiData() { 78 | // print your WiFi shield's IP address: 79 | IPAddress ip = WiFi.localIP(); 80 | Serial.print("IP address : "); 81 | Serial.println(ip); 82 | 83 | Serial.print("Subnet mask: "); 84 | Serial.println((IPAddress)WiFi.subnetMask()); 85 | 86 | Serial.print("Gateway IP : "); 87 | Serial.println((IPAddress)WiFi.gatewayIP()); 88 | 89 | // print your MAC address: 90 | byte mac[6]; 91 | WiFi.macAddress(mac); 92 | Serial.print("MAC address: "); 93 | Serial.print(mac[5], HEX); 94 | Serial.print(":"); 95 | Serial.print(mac[4], HEX); 96 | Serial.print(":"); 97 | Serial.print(mac[3], HEX); 98 | Serial.print(":"); 99 | Serial.print(mac[2], HEX); 100 | Serial.print(":"); 101 | Serial.print(mac[1], HEX); 102 | Serial.print(":"); 103 | Serial.println(mac[0], HEX); 104 | Serial.println(); 105 | } 106 | 107 | void printCurrentNet() { 108 | // print the SSID of the network you're attached to: 109 | Serial.print("SSID: "); 110 | Serial.println(WiFi.SSID()); 111 | 112 | // print the MAC address of the router you're attached to: 113 | byte bssid[6]; 114 | WiFi.BSSID(bssid); 115 | Serial.print("BSSID: "); 116 | Serial.print(bssid[5], HEX); 117 | Serial.print(":"); 118 | Serial.print(bssid[4], HEX); 119 | Serial.print(":"); 120 | Serial.print(bssid[3], HEX); 121 | Serial.print(":"); 122 | Serial.print(bssid[2], HEX); 123 | Serial.print(":"); 124 | Serial.print(bssid[1], HEX); 125 | Serial.print(":"); 126 | Serial.println(bssid[0], HEX); 127 | 128 | // print the received signal strength: 129 | long rssi = WiFi.RSSI(); 130 | Serial.print("signal strength (RSSI): "); 131 | Serial.println(rssi); 132 | 133 | // print the encryption type: 134 | byte encryption = WiFi.encryptionType(); 135 | Serial.print("Encryption Type: "); 136 | Serial.println(encryption, HEX); 137 | Serial.println(); 138 | } 139 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/examples/WiFiSSLClient/WiFiSSLClient.ino: -------------------------------------------------------------------------------- 1 | /* 2 | This example creates a client object that connects and transfers 3 | data using always SSL. 4 | 5 | It is compatible with the methods normally related to plain 6 | connections, like client.connect(host, port). 7 | 8 | Written by Arturo Guadalupi 9 | last revision November 2015 10 | 11 | */ 12 | 13 | #include 14 | #include 15 | 16 | char ssid[] = "yourNetwork"; // your network SSID (name) 17 | char pass[] = "secretPassword"; // your network password (use for WPA, or use as key for WEP) 18 | int keyIndex = 0; // your network key Index number (needed only for WEP) 19 | 20 | int status = WL_IDLE_STATUS; 21 | // if you don't want to use DNS (and reduce your sketch size) 22 | // use the numeric IP instead of the name for the server: 23 | //IPAddress server(74,125,232,128); // numeric IP for Google (no DNS) 24 | char server[] = "www.google.com"; // name address for Google (using DNS) 25 | 26 | // Initialize the Ethernet client library 27 | // with the IP address and port of the server 28 | // that you want to connect to (port 80 is default for HTTP): 29 | WiFiSSLClient client; 30 | 31 | void setup() { 32 | //Initialize serial and wait for port to open: 33 | Serial.begin(9600); 34 | while (!Serial) { 35 | ; // wait for serial port to connect. Needed for native USB port only 36 | } 37 | 38 | // check for the presence of the shield: 39 | if (WiFi.status() == WL_NO_SHIELD) { 40 | Serial.println("WiFi shield not present"); 41 | // don't continue: 42 | while (true); 43 | } 44 | 45 | // attempt to connect to WiFi network: 46 | while (status != WL_CONNECTED) { 47 | Serial.print("Attempting to connect to SSID: "); 48 | Serial.println(ssid); 49 | // Connect to WPA/WPA2 network. Change this line if using open or WEP network: 50 | status = WiFi.begin(ssid, pass); 51 | 52 | // wait 10 seconds for connection: 53 | delay(10000); 54 | } 55 | Serial.println("Connected to wifi"); 56 | printWiFiStatus(); 57 | 58 | Serial.println("\nStarting connection to server..."); 59 | // if you get a connection, report back via serial: 60 | if (client.connect(server, 443)) { 61 | Serial.println("connected to server"); 62 | // Make a HTTP request: 63 | client.println("GET /search?q=arduino HTTP/1.1"); 64 | client.println("Host: www.google.com"); 65 | client.println("Connection: close"); 66 | client.println(); 67 | } 68 | } 69 | 70 | void loop() { 71 | // if there are incoming bytes available 72 | // from the server, read them and print them: 73 | while (client.available()) { 74 | char c = client.read(); 75 | Serial.write(c); 76 | } 77 | 78 | // if the server's disconnected, stop the client: 79 | if (!client.connected()) { 80 | Serial.println(); 81 | Serial.println("disconnecting from server."); 82 | client.stop(); 83 | 84 | // do nothing forevermore: 85 | while (true); 86 | } 87 | } 88 | 89 | 90 | void printWiFiStatus() { 91 | // print the SSID of the network you're attached to: 92 | Serial.print("SSID: "); 93 | Serial.println(WiFi.SSID()); 94 | 95 | // print your WiFi shield's IP address: 96 | IPAddress ip = WiFi.localIP(); 97 | Serial.print("IP Address: "); 98 | Serial.println(ip); 99 | 100 | // print the received signal strength: 101 | long rssi = WiFi.RSSI(); 102 | Serial.print("signal strength (RSSI):"); 103 | Serial.print(rssi); 104 | Serial.println(" dBm"); 105 | } 106 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/examples/WiFiUdpSendReceiveString/WiFiUdpSendReceiveString.ino: -------------------------------------------------------------------------------- 1 | /* 2 | WiFi UDP Send and Receive String 3 | 4 | This sketch wait an UDP packet on localPort using a WiFi shield. 5 | When a packet is received an Acknowledge packet is sent to the client on port remotePort 6 | 7 | Circuit: 8 | * WiFi shield attached 9 | 10 | created 30 December 2012 11 | by dlf (Metodo2 srl) 12 | 13 | */ 14 | 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | int status = WL_IDLE_STATUS; 21 | char ssid[] = "yourNetwork"; // your network SSID (name) 22 | char pass[] = "secretPassword"; // your network password (use for WPA, or use as key for WEP) 23 | int keyIndex = 0; // your network key Index number (needed only for WEP) 24 | 25 | unsigned int localPort = 2390; // local port to listen on 26 | 27 | char packetBuffer[255]; //buffer to hold incoming packet 28 | char ReplyBuffer[] = "acknowledged"; // a string to send back 29 | 30 | WiFiUDP Udp; 31 | 32 | void setup() { 33 | //Initialize serial and wait for port to open: 34 | Serial.begin(9600); 35 | while (!Serial) { 36 | ; // wait for serial port to connect. Needed for native USB port only 37 | } 38 | 39 | // check for the presence of the shield: 40 | if (WiFi.status() == WL_NO_SHIELD) { 41 | Serial.println("WiFi shield not present"); 42 | // don't continue: 43 | while (true); 44 | } 45 | 46 | // attempt to connect to WiFi network: 47 | while ( status != WL_CONNECTED) { 48 | Serial.print("Attempting to connect to SSID: "); 49 | Serial.println(ssid); 50 | // Connect to WPA/WPA2 network. Change this line if using open or WEP network: 51 | status = WiFi.begin(ssid, pass); 52 | 53 | // wait 10 seconds for connection: 54 | delay(10000); 55 | } 56 | Serial.println("Connected to wifi"); 57 | printWiFiStatus(); 58 | 59 | Serial.println("\nStarting connection to server..."); 60 | // if you get a connection, report back via serial: 61 | Udp.begin(localPort); 62 | } 63 | 64 | void loop() { 65 | 66 | // if there's data available, read a packet 67 | int packetSize = Udp.parsePacket(); 68 | if (packetSize) 69 | { 70 | Serial.print("Received packet of size "); 71 | Serial.println(packetSize); 72 | Serial.print("From "); 73 | IPAddress remoteIp = Udp.remoteIP(); 74 | Serial.print(remoteIp); 75 | Serial.print(", port "); 76 | Serial.println(Udp.remotePort()); 77 | 78 | // read the packet into packetBufffer 79 | int len = Udp.read(packetBuffer, 255); 80 | if (len > 0) packetBuffer[len] = 0; 81 | Serial.println("Contents:"); 82 | Serial.println(packetBuffer); 83 | 84 | // send a reply, to the IP address and port that sent us the packet we received 85 | Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); 86 | Udp.write(ReplyBuffer); 87 | Udp.endPacket(); 88 | } 89 | } 90 | 91 | 92 | void printWiFiStatus() { 93 | // print the SSID of the network you're attached to: 94 | Serial.print("SSID: "); 95 | Serial.println(WiFi.SSID()); 96 | 97 | // print your WiFi shield's IP address: 98 | IPAddress ip = WiFi.localIP(); 99 | Serial.print("IP Address: "); 100 | Serial.println(ip); 101 | 102 | // print the received signal strength: 103 | long rssi = WiFi.RSSI(); 104 | Serial.print("signal strength (RSSI):"); 105 | Serial.print(rssi); 106 | Serial.println(" dBm"); 107 | } 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/examples/WiFiWebClient/WiFiWebClient.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Web client 3 | 4 | This sketch connects to a website (http://www.google.com) 5 | using a WiFi shield. 6 | 7 | This example is written for a network using WPA encryption. For 8 | WEP or WPA, change the WiFi.begin() call accordingly. 9 | 10 | This example is written for a network using WPA encryption. For 11 | WEP or WPA, change the WiFi.begin() call accordingly. 12 | 13 | Circuit: 14 | * WiFi shield attached 15 | 16 | created 13 July 2010 17 | by dlf (Metodo2 srl) 18 | modified 31 May 2012 19 | by Tom Igoe 20 | */ 21 | 22 | 23 | #include 24 | #include 25 | 26 | char ssid[] = "yourNetwork"; // your network SSID (name) 27 | char pass[] = "secretPassword"; // your network password (use for WPA, or use as key for WEP) 28 | int keyIndex = 0; // your network key Index number (needed only for WEP) 29 | 30 | int status = WL_IDLE_STATUS; 31 | // if you don't want to use DNS (and reduce your sketch size) 32 | // use the numeric IP instead of the name for the server: 33 | //IPAddress server(74,125,232,128); // numeric IP for Google (no DNS) 34 | char server[] = "www.google.com"; // name address for Google (using DNS) 35 | 36 | // Initialize the Ethernet client library 37 | // with the IP address and port of the server 38 | // that you want to connect to (port 80 is default for HTTP): 39 | WiFiClient client; 40 | 41 | void setup() { 42 | //Initialize serial and wait for port to open: 43 | Serial.begin(9600); 44 | while (!Serial) { 45 | ; // wait for serial port to connect. Needed for native USB port only 46 | } 47 | 48 | // check for the presence of the shield: 49 | if (WiFi.status() == WL_NO_SHIELD) { 50 | Serial.println("WiFi shield not present"); 51 | // don't continue: 52 | while (true); 53 | } 54 | 55 | // attempt to connect to WiFi network: 56 | while (status != WL_CONNECTED) { 57 | Serial.print("Attempting to connect to SSID: "); 58 | Serial.println(ssid); 59 | // Connect to WPA/WPA2 network. Change this line if using open or WEP network: 60 | status = WiFi.begin(ssid, pass); 61 | 62 | // wait 10 seconds for connection: 63 | delay(10000); 64 | } 65 | Serial.println("Connected to wifi"); 66 | printWiFiStatus(); 67 | 68 | Serial.println("\nStarting connection to server..."); 69 | // if you get a connection, report back via serial: 70 | if (client.connect(server, 80)) { 71 | Serial.println("connected to server"); 72 | // Make a HTTP request: 73 | client.println("GET /search?q=arduino HTTP/1.1"); 74 | client.println("Host: www.google.com"); 75 | client.println("Connection: close"); 76 | client.println(); 77 | } 78 | } 79 | 80 | void loop() { 81 | // if there are incoming bytes available 82 | // from the server, read them and print them: 83 | while (client.available()) { 84 | char c = client.read(); 85 | Serial.write(c); 86 | } 87 | 88 | // if the server's disconnected, stop the client: 89 | if (!client.connected()) { 90 | Serial.println(); 91 | Serial.println("disconnecting from server."); 92 | client.stop(); 93 | 94 | // do nothing forevermore: 95 | while (true); 96 | } 97 | } 98 | 99 | 100 | void printWiFiStatus() { 101 | // print the SSID of the network you're attached to: 102 | Serial.print("SSID: "); 103 | Serial.println(WiFi.SSID()); 104 | 105 | // print your WiFi shield's IP address: 106 | IPAddress ip = WiFi.localIP(); 107 | Serial.print("IP Address: "); 108 | Serial.println(ip); 109 | 110 | // print the received signal strength: 111 | long rssi = WiFi.RSSI(); 112 | Serial.print("signal strength (RSSI):"); 113 | Serial.print(rssi); 114 | Serial.println(" dBm"); 115 | } 116 | 117 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/examples/WiFiWebClientRepeating/WiFiWebClientRepeating.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Repeating WiFi Web Client 3 | 4 | This sketch connects to a a web server and makes a request 5 | using an Arduino WiFi shield. 6 | 7 | Circuit: 8 | * WiFi shield attached to pins SPI pins and pin 7 9 | 10 | created 23 April 2012 11 | modified 31 May 2012 12 | by Tom Igoe 13 | modified 13 Jan 2014 14 | by Federico Vanzati 15 | 16 | http://arduino.cc/en/Tutorial/WiFiWebClientRepeating 17 | This code is in the public domain. 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | char ssid[] = "yourNetwork"; // your network SSID (name) 24 | char pass[] = "secretPassword"; // your network password 25 | int keyIndex = 0; // your network key Index number (needed only for WEP) 26 | 27 | int status = WL_IDLE_STATUS; 28 | 29 | // Initialize the WiFi client library 30 | WiFiClient client; 31 | 32 | // server address: 33 | char server[] = "www.arduino.cc"; 34 | //IPAddress server(64,131,82,241); 35 | 36 | unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds 37 | const unsigned long postingInterval = 10L * 1000L; // delay between updates, in milliseconds 38 | 39 | void setup() { 40 | //Initialize serial and wait for port to open: 41 | Serial.begin(9600); 42 | while (!Serial) { 43 | ; // wait for serial port to connect. Needed for native USB port only 44 | } 45 | 46 | // check for the presence of the shield: 47 | if (WiFi.status() == WL_NO_SHIELD) { 48 | Serial.println("WiFi shield not present"); 49 | // don't continue: 50 | while (true); 51 | } 52 | 53 | // attempt to connect to WiFi network: 54 | while ( status != WL_CONNECTED) { 55 | Serial.print("Attempting to connect to SSID: "); 56 | Serial.println(ssid); 57 | // Connect to WPA/WPA2 network. Change this line if using open or WEP network: 58 | status = WiFi.begin(ssid, pass); 59 | 60 | // wait 10 seconds for connection: 61 | delay(10000); 62 | } 63 | // you're connected now, so print out the status: 64 | printWiFiStatus(); 65 | } 66 | 67 | void loop() { 68 | // if there's incoming data from the net connection. 69 | // send it out the serial port. This is for debugging 70 | // purposes only: 71 | while (client.available()) { 72 | char c = client.read(); 73 | Serial.write(c); 74 | } 75 | 76 | // if ten seconds have passed since your last connection, 77 | // then connect again and send data: 78 | if (millis() - lastConnectionTime > postingInterval) { 79 | httpRequest(); 80 | } 81 | 82 | } 83 | 84 | // this method makes a HTTP connection to the server: 85 | void httpRequest() { 86 | // close any connection before send a new request. 87 | // This will free the socket on the WiFi shield 88 | client.stop(); 89 | 90 | // if there's a successful connection: 91 | if (client.connect(server, 80)) { 92 | Serial.println("connecting..."); 93 | // send the HTTP PUT request: 94 | client.println("GET /latest.txt HTTP/1.1"); 95 | client.println("Host: www.arduino.cc"); 96 | client.println("User-Agent: ArduinoWiFi/1.1"); 97 | client.println("Connection: close"); 98 | client.println(); 99 | 100 | // note the time that the connection was made: 101 | lastConnectionTime = millis(); 102 | } 103 | else { 104 | // if you couldn't make a connection: 105 | Serial.println("connection failed"); 106 | } 107 | } 108 | 109 | 110 | void printWiFiStatus() { 111 | // print the SSID of the network you're attached to: 112 | Serial.print("SSID: "); 113 | Serial.println(WiFi.SSID()); 114 | 115 | // print your WiFi shield's IP address: 116 | IPAddress ip = WiFi.localIP(); 117 | Serial.print("IP Address: "); 118 | Serial.println(ip); 119 | 120 | // print the received signal strength: 121 | long rssi = WiFi.RSSI(); 122 | Serial.print("signal strength (RSSI):"); 123 | Serial.print(rssi); 124 | Serial.println(" dBm"); 125 | } 126 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/examples/WiFiWebServer/WiFiWebServer.ino: -------------------------------------------------------------------------------- 1 | /* 2 | WiFi Web Server 3 | 4 | A simple web server that shows the value of the analog input pins. 5 | using a WiFi shield. 6 | 7 | This example is written for a network using WPA encryption. For 8 | WEP or WPA, change the WiFi.begin() call accordingly. 9 | 10 | Circuit: 11 | * WiFi shield attached 12 | * Analog inputs attached to pins A0 through A5 (optional) 13 | 14 | created 13 July 2010 15 | by dlf (Metodo2 srl) 16 | modified 31 May 2012 17 | by Tom Igoe 18 | 19 | */ 20 | 21 | #include 22 | #include 23 | 24 | 25 | char ssid[] = "yourNetwork"; // your network SSID (name) 26 | char pass[] = "secretPassword"; // your network password 27 | int keyIndex = 0; // your network key Index number (needed only for WEP) 28 | 29 | int status = WL_IDLE_STATUS; 30 | 31 | WiFiServer server(80); 32 | 33 | void setup() { 34 | //Initialize serial and wait for port to open: 35 | Serial.begin(9600); 36 | while (!Serial) { 37 | ; // wait for serial port to connect. Needed for native USB port only 38 | } 39 | 40 | // check for the presence of the shield: 41 | if (WiFi.status() == WL_NO_SHIELD) { 42 | Serial.println("WiFi shield not present"); 43 | // don't continue: 44 | while (true); 45 | } 46 | 47 | // attempt to connect to WiFi network: 48 | while ( status != WL_CONNECTED) { 49 | Serial.print("Attempting to connect to SSID: "); 50 | Serial.println(ssid); 51 | // Connect to WPA/WPA2 network. Change this line if using open or WEP network: 52 | status = WiFi.begin(ssid, pass); 53 | 54 | // wait 10 seconds for connection: 55 | delay(10000); 56 | } 57 | server.begin(); 58 | // you're connected now, so print out the status: 59 | printWiFiStatus(); 60 | } 61 | 62 | 63 | void loop() { 64 | // listen for incoming clients 65 | WiFiClient client = server.available(); 66 | if (client) { 67 | Serial.println("new client"); 68 | // an http request ends with a blank line 69 | boolean currentLineIsBlank = true; 70 | while (client.connected()) { 71 | if (client.available()) { 72 | char c = client.read(); 73 | Serial.write(c); 74 | // if you've gotten to the end of the line (received a newline 75 | // character) and the line is blank, the http request has ended, 76 | // so you can send a reply 77 | if (c == '\n' && currentLineIsBlank) { 78 | // send a standard http response header 79 | client.println("HTTP/1.1 200 OK"); 80 | client.println("Content-Type: text/html"); 81 | client.println("Connection: close"); // the connection will be closed after completion of the response 82 | client.println("Refresh: 5"); // refresh the page automatically every 5 sec 83 | client.println(); 84 | client.println(""); 85 | client.println(""); 86 | // output the value of each analog input pin 87 | for (int analogChannel = 0; analogChannel < 6; analogChannel++) { 88 | int sensorReading = analogRead(analogChannel); 89 | client.print("analog input "); 90 | client.print(analogChannel); 91 | client.print(" is "); 92 | client.print(sensorReading); 93 | client.println("
    "); 94 | } 95 | client.println(""); 96 | break; 97 | } 98 | if (c == '\n') { 99 | // you're starting a new line 100 | currentLineIsBlank = true; 101 | } 102 | else if (c != '\r') { 103 | // you've gotten a character on the current line 104 | currentLineIsBlank = false; 105 | } 106 | } 107 | } 108 | // give the web browser time to receive the data 109 | delay(1); 110 | 111 | // close the connection: 112 | client.stop(); 113 | Serial.println("client disonnected"); 114 | } 115 | } 116 | 117 | 118 | void printWiFiStatus() { 119 | // print the SSID of the network you're attached to: 120 | Serial.print("SSID: "); 121 | Serial.println(WiFi.SSID()); 122 | 123 | // print your WiFi shield's IP address: 124 | IPAddress ip = WiFi.localIP(); 125 | Serial.print("IP Address: "); 126 | Serial.println(ip); 127 | 128 | // print the received signal strength: 129 | long rssi = WiFi.RSSI(); 130 | Serial.print("signal strength (RSSI):"); 131 | Serial.print(rssi); 132 | Serial.println(" dBm"); 133 | } 134 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/examples/connectToWiFi/connectToWiFi.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | Example sketch utilizing AnduinoWiFi library to create an end user 3 | WiFi registration process. This sketch creates a local SSID, serves 4 | a webpage to recieve WiFi credentials, and then connects the Anduino 5 | to the specified WiFi. 6 | 7 | Check out the included Arduino sketch examples and Anduino Wiki to 8 | get started! 9 | https://github.com/andium/Anduino/wiki 10 | 11 | Written by Brian Carbonette Copyright © 2017 Andium 12 | 13 | Licensed under the Apache License, Version 2.0 (the "License"); 14 | you may not use this file except in compliance with the License. 15 | You may obtain a copy of the License at 16 | 17 | http://www.apache.org/licenses/LICENSE-2.0 18 | 19 | Unless required by applicable law or agreed to in writing, software 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | *******************************************************************/ 25 | 26 | #include "AnduinoWiFi.h" 27 | 28 | AnduinoWiFi newWifi = AnduinoWiFi();//create an AnduinoWiFi instance 29 | char testSite[] = "andium.com"; //we'll connect and GET / to test our WiFi connection 30 | 31 | WiFiClient webCli; //used for connecting to testSite 32 | 33 | 34 | void setup() { 35 | //open serial comm for debugging-------------- 36 | Serial.begin(115200); 37 | delay(3000); 38 | //-------------------------------------------- 39 | 40 | //-------------------------------------------- 41 | //create temp network Andium Demo for WiFi Reg 42 | newWifi.begin("Anduino WiFi"); 43 | WiFiClient regClient; 44 | 45 | //While we're in AP mode serve-------------- 46 | //reg webpage and parse POST response------- 47 | while(newWifi.isAPmode()) 48 | { 49 | regClient = newWifi.getClient(); 50 | 51 | //if we receive a client request to the server 52 | if(regClient) 53 | { 54 | newWifi.parseRequest(regClient); 55 | } 56 | 57 | } 58 | //-------------------------------------------- 59 | 60 | //WiFi Connected------------------------------ 61 | Serial.println("WiFi connected"); 62 | //-------------------------------------------- 63 | 64 | //Test Wifi by connecting to www.andium.com--- 65 | //-------------------------------------------- 66 | Serial.println("\nStarting connection to server..."); 67 | 68 | if (webCli.connect(testSite, 80)) { 69 | Serial.println("connected to server"); 70 | // Make an HTTP request: 71 | webCli.println("GET / HTTP/1.1"); 72 | webCli.println("Host: andium.com"); 73 | webCli.println("Connection: close"); 74 | webCli.println(); 75 | } 76 | 77 | 78 | } 79 | 80 | void loop() 81 | { 82 | // if there are incoming bytes available 83 | // from the server, read them and print them: 84 | while (webCli.available()) { 85 | char c = webCli.read(); 86 | Serial.write(c); 87 | } 88 | 89 | //when the server has disconnected, stop the client: 90 | if (!webCli.connected()) { 91 | Serial.println(); 92 | Serial.println("disconnecting from server."); 93 | webCli.stop(); 94 | 95 | //we're done! 96 | while (true); 97 | } 98 | 99 | } 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/keywords.txt: -------------------------------------------------------------------------------- 1 | AnduinoWiFi KEYWORD2 2 | printDetails KEYWORD2 3 | disconnectAP KEYWORD2 4 | isAPmode KEYWORD2 5 | getSSID KEYWORD2 6 | getPassword KEYWORD2 7 | parseRequest KEYWORD2 8 | getClient KEYWORD1 9 | setPins KEYWORD2 10 | status KEYWORD2 11 | connect KEYWORD2 12 | connectSSL KEYWORD2 13 | write KEYWORD2 14 | available KEYWORD2 15 | read KEYWORD2 16 | flush KEYWORD2 17 | stop KEYWORD2 18 | connected KEYWORD2 19 | begin KEYWORD2 20 | beginProvision KEYWORD2 21 | beginOrProvision KEYWORD2 22 | beginMulticast KEYWORD2 23 | disconnect KEYWORD2 24 | macAddress KEYWORD2 25 | localIP KEYWORD2 26 | subnetMask KEYWORD2 27 | gatewayIP KEYWORD2 28 | SSID KEYWORD2 29 | BSSID KEYWORD2 30 | APClientMacAddress KEYWORD2 31 | RSSI KEYWORD2 32 | encryptionType KEYWORD2 33 | channel KEYWORD2 34 | provisioned KEYWORD2 35 | getResult KEYWORD2 36 | getSocket KEYWORD2 37 | poll KEYWORD2 38 | getTime KEYWORD2 39 | WiFiClient KEYWORD2 40 | WiFiServer KEYWORD2 41 | WiFiSSLClient KEYWORD2 42 | WiFiMDNSResponder KEYWORD2 43 | 44 | lowPowerMode KEYWORD2 45 | maxLowPowerMode KEYWORD2 46 | noLowPowerMode KEYWORD2 47 | WiFi KEYWORD1 48 | WiFi101 KEYWORD1 49 | Client KEYWORD1 50 | Server KEYWORD1 -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/library.properties: -------------------------------------------------------------------------------- 1 | name=AnduinoWiFi 2 | version=1.0.3 3 | author=Brian Carbonette 4 | maintainer=Brian Carbonette 5 | sentence=Anduino library utilizing WiFi101 v13.0. 6 | paragraph=Anduino library utilizing WiFi101 v13.0. 7 | category=Communication 8 | url=https://github.com/Anduino 9 | architectures=* 10 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/AnduinoAP.h: -------------------------------------------------------------------------------- 1 | #ifndef __AnduinoAP_H 2 | #define __AnduinoAP_H 3 | 4 | #include "Arduino.h" 5 | #include 6 | 7 | /*#define DEBUG_WIFIREG*/ 8 | 9 | 10 | class AnduinoAP 11 | { 12 | 13 | public: 14 | AnduinoAP(); 15 | int begin(char ssid[]); 16 | void printDetails(); 17 | bool disconnectAP(); 18 | bool isAPmode(); 19 | String getSSID(); 20 | String getPassword(); 21 | void parseRequest(WiFiClient client); 22 | WiFiClient getClient(); 23 | 24 | 25 | 26 | private: 27 | void getRegistrationPage(WiFiClient client); 28 | void postRegistrationPage(WiFiClient client); 29 | uint8_t connectToWiFi(char* newSsid, char* newPass); 30 | uint8_t recursiveBodyParser(String reqBody); 31 | String decodeUri(String buff); 32 | void printAPStatus(); 33 | void printWiFiStatus(); 34 | 35 | }; 36 | 37 | #endif /*__AnduinoAP_H */ 38 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/CHANGELOG: -------------------------------------------------------------------------------- 1 | WiFi101 ?.?.? - ????.??.?? 2 | 3 | WiFi101 0.13.0 - 2017.03.01 4 | * Added WiFi.channel() and WiFi.BSSID() 5 | 6 | WiFi101 0.12.1 - 2017.01.19 7 | 8 | * Fixed tomorrow day issue in WiFi.getTime() 9 | 10 | WiFi101 0.12.0 - 2017.01.05 11 | 12 | * Made provisioning mode easier and added example sketch 13 | * Fixed WiFi.getTime() not returning 0, if time has not been synced via NTP 14 | * Fixed crashing when connecting after scanning 15 | * Fixed WiFiServer::available() returning valid client on outbound client connection 16 | * Added WiFiUdp::beginMulticast(port) function for compatiblity with EthernetUdp, as beginMulti was inconsistent 17 | 18 | WiFi101 0.11.2 - 2016.12.15 19 | 20 | * Fixed value of WiFi.getTime() being off by one day 21 | * Fixed calling WiFi.RSSI() causing lockups 22 | 23 | WiFi101 0.11.1 - 2016.11.29 24 | 25 | * Fixed regression for non-AVR boards that resulted in corrupt with data over than 1400 bytes was received 26 | 27 | WiFi101 0.11.0 - 2016.11.14 28 | 29 | * Changed WiFi.ping(...) to return round trip time on success, negative value on error. Thanks @PKGeorgiev 30 | * WiFi.end() now powers down the WiFi module 31 | * WiFi.config(ip) can now be used to set a static IP for WiFi.begin(...) 32 | * Fixed WiFi.BSSID(bssid) returning reversed MAC address 33 | * Added WiFi.APClientMacAddress() API to get MAC address of AP client in AP mode 34 | * Added WiFi.getTime() API to get epoch from NTP 35 | 36 | WiFi101 0.10.0 - 2016.09.08 37 | 38 | * Added WiFi.end() to disconnect from the AP or end AP mode 39 | * Added new WiFi.ping(...) functionality. Thanks @PKGeorgiev 40 | * Added WiFi.setPins(...) to customize the CS, INTN, RESET and CHIPEN pins 41 | * Add new WL_AP_LISTENING, WL_AP_CONNECTED, and WL_AP_FAILED status types for AP mode 42 | * Fixed return value of WiFiUDP::beginPacket(host, port) when host is successfully resolved 43 | * Added power management methods: WiFi.lowPowerMode(), WiFi.maxLowPowerMode(), WiFi.noLowPowerMode() 44 | * Close TCP sockets when physical link is disconnected 45 | * Fixed WiFi.RSSI() returning 0 when there was pending socket data 46 | 47 | WiFi101 0.9.1 - 2016.04.19 48 | 49 | * Increased compatibility with 3rd party boards and architectures. 50 | * Rename WiFiMdnsResponder.h/cpp to WiFiMDNSResponder.h/cpp 51 | * Fixed buffering of UDP packet 52 | 53 | WiFi101 0.9.0 - 2016.03.21 54 | 55 | * Fixed WiFi.status() hanging when shield is not present 56 | * Fixed MAC address returning 00:00:00:00:00:00 with firmware version 19.3.0 57 | * Fixed SSL write functionality with firmware version 19.3.0 58 | * Fixed previous version of the library not working on the Uno and other boards that used PCINT's 59 | * Added beginAP(...) API's to create access point with WEP passwords 60 | * Fixed beginAP(...) channel off by one error 61 | * Fixed WiFi.status() always returning WL_CONNECTED once connected, even if access point is disconnected later 62 | * Added beginMulti API for Multicast UDP support 63 | * Added WiFiMDNSResponder class and MDNS Web server example 64 | 65 | WiFi101 0.8.0 - 2016.02.15 66 | 67 | * Added example for Access Point web server (thanks @ladyada) 68 | * Fixed MAC Address printed in reverse order 69 | * Allow another library to override PCINT ISR (fix issues when using the WiFi101 70 | library with other libraries like SoftwareSerial) 71 | 72 | WiFi101 0.7.0 - 2015.01.11 73 | 74 | * Added support for WiFi Firmware 19.4.4 75 | * WiFi.hostByName(...) will not try resolve the domain name if it's already a numeric IP 76 | * Fixed manual IP configuration (no DHCP) 77 | * Fixed WiFiServer.available(), now follows API specification 78 | * Fixed WEP key connection 79 | * Fixed WiFiClient copy constructor and assignment operator. This improves stability when 80 | Client objects are assigned or returned from functions. 81 | * Control pins are now configurable through defines from variant. 82 | 83 | WiFi101 0.6.0 - 2015.11.27 84 | 85 | * Fixed bug with AVR boards when Web Server is used 86 | * Fixed UDP read bug on AVR Boards 87 | * Added missing inlcude for SSL Client 88 | * Fixed peek() function 89 | * Fixed some examples 90 | 91 | WiFi101 0.5.1 - 2015.10.06 92 | 93 | * Improved support for AVR Boards (Uno, Mega, Leonardo, etc.) and 94 | ARM based boards (Due and Zero). 95 | 96 | WiFi101 0.5.0 - 2015.10.01 97 | 98 | * Initial release 99 | 100 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/WiFiClient.h: -------------------------------------------------------------------------------- 1 | /* 2 | WiFiClient.cpp - Library for Arduino Wifi shield. 3 | Copyright (c) 2011-2014 Arduino. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef WIFICLIENT_H 21 | #define WIFICLIENT_H 22 | 23 | #include 24 | #include 25 | #include 26 | #include "socket/include/socket_buffer.h" 27 | 28 | class WiFiClient : public Client { 29 | 30 | public: 31 | WiFiClient(); 32 | WiFiClient(uint8_t sock, uint8_t parentsock = 0); 33 | WiFiClient(const WiFiClient& other); 34 | 35 | uint8_t status(); 36 | 37 | int connectSSL(IPAddress ip, uint16_t port); 38 | int connectSSL(const char* host, uint16_t port); 39 | virtual int connect(IPAddress ip, uint16_t port); 40 | virtual int connect(const char* host, uint16_t port); 41 | virtual size_t write(uint8_t); 42 | virtual size_t write(const uint8_t *buf, size_t size); 43 | virtual int available(); 44 | virtual int read(); 45 | virtual int read(uint8_t *buf, size_t size); 46 | virtual int peek(); 47 | virtual void flush(); 48 | virtual void stop(); 49 | virtual uint8_t connected(); 50 | virtual operator bool(); 51 | virtual WiFiClient& operator =(const WiFiClient& other); 52 | 53 | using Print::write; 54 | 55 | uint32_t _flag; 56 | 57 | private: 58 | SOCKET _socket; 59 | uint32_t _head; 60 | uint32_t _tail; 61 | uint8_t _buffer[SOCKET_BUFFER_TCP_SIZE]; 62 | int connect(const char* host, uint16_t port, uint8_t opt); 63 | int connect(IPAddress ip, uint16_t port, uint8_t opt, const uint8_t *hostname); 64 | void copyFrom(const WiFiClient& other); 65 | 66 | }; 67 | 68 | #endif /* WIFICLIENT_H */ 69 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/WiFiMDNSResponder.h: -------------------------------------------------------------------------------- 1 | // Port of CC3000 MDNS Responder to WINC1500. 2 | // Author: Tony DiCola 3 | // 4 | // This MDNSResponder class implements just enough MDNS functionality to respond 5 | // to name requests, for example 'foo.local'. This does not implement any other 6 | // MDNS or Bonjour functionality like services, etc. 7 | // 8 | // Copyright (c) 2016 Adafruit Industries. All right reserved. 9 | // 10 | // This library is free software; you can redistribute it and/or 11 | // modify it under the terms of the GNU Lesser General Public 12 | // License as published by the Free Software Foundation; either 13 | // version 2.1 of the License, or (at your option) any later version. 14 | // 15 | // This library is distributed in the hope that it will be useful, 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | // Lesser General Public License for more details. 19 | // 20 | // You should have received a copy of the GNU Lesser General Public 21 | // License along with this library; if not, write to the Free Software 22 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 23 | 24 | #ifndef WIFIMDNSRESPONDER_H 25 | #define WIFIMDNSRESPONDER_H 26 | 27 | #include "AnduinoWiFi.h" 28 | #include "WiFiUdp.h" 29 | 30 | class WiFiMDNSResponder { 31 | public: 32 | WiFiMDNSResponder(); 33 | ~WiFiMDNSResponder(); 34 | bool begin(const char* _name, uint32_t _ttlSeconds = 3600); 35 | void poll(); 36 | 37 | private: 38 | bool parseRequest(); 39 | void replyToRequest(); 40 | 41 | private: 42 | String name; 43 | uint32_t ttlSeconds; 44 | 45 | int expectedRequestLength; 46 | 47 | // UDP socket for receiving/sending MDNS data. 48 | WiFiUDP udpSocket; 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/WiFiSSLClient.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | WiFiSSLClient.cpp - Library for Arduino Wifi shield. 3 | Copyright (c) 2011-2014 Arduino. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #include "WiFiSSLClient.h" 21 | 22 | WiFiSSLClient::WiFiSSLClient() : 23 | WiFiClient() 24 | { 25 | } 26 | 27 | WiFiSSLClient::WiFiSSLClient(uint8_t sock, uint8_t parentsock) : 28 | WiFiClient(sock, parentsock) 29 | { 30 | } 31 | 32 | WiFiSSLClient::WiFiSSLClient(const WiFiSSLClient& other) : 33 | WiFiClient(other) 34 | { 35 | } 36 | 37 | int WiFiSSLClient::connect(IPAddress ip, uint16_t port) 38 | { 39 | return WiFiClient::connectSSL(ip, port); 40 | } 41 | 42 | int WiFiSSLClient::connect(const char* host, uint16_t port) 43 | { 44 | return WiFiClient::connectSSL(host, port); 45 | } 46 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/WiFiSSLClient.h: -------------------------------------------------------------------------------- 1 | /* 2 | WiFiSSLClient.cpp - Library for Arduino Wifi shield. 3 | Copyright (c) 2011-2014 Arduino. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef WIFISSLCLIENT_H 21 | #define WIFISSLCLIENT_H 22 | 23 | #include "WiFiClient.h" 24 | 25 | class WiFiSSLClient : public WiFiClient { 26 | 27 | public: 28 | WiFiSSLClient(); 29 | WiFiSSLClient(uint8_t sock, uint8_t parentsock = 0); 30 | WiFiSSLClient(const WiFiSSLClient& other); 31 | 32 | virtual int connect(IPAddress ip, uint16_t port); 33 | virtual int connect(const char* host, uint16_t port); 34 | }; 35 | 36 | #endif /* WIFISSLCLIENT_H */ 37 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/WiFiServer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | WiFiClient.cpp - Library for Arduino Wifi shield. 3 | Copyright (c) 2011-2014 Arduino. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | extern "C" { 21 | #include "socket/include/socket.h" 22 | } 23 | 24 | #include "AnduinoWiFi.h" 25 | #include "WiFiClient.h" 26 | #include "WiFiServer.h" 27 | 28 | #define READY (_flag & SOCKET_BUFFER_FLAG_BIND) 29 | 30 | WiFiServer::WiFiServer(uint16_t port) 31 | { 32 | _port = port; 33 | _flag = 0; 34 | } 35 | 36 | void WiFiServer::begin() 37 | { 38 | begin(0); 39 | } 40 | 41 | uint8_t WiFiServer::beginSSL() 42 | { 43 | return begin(SOCKET_FLAGS_SSL); 44 | } 45 | 46 | uint8_t WiFiServer::begin(uint8_t opt) 47 | { 48 | struct sockaddr_in addr; 49 | 50 | _flag = 0; 51 | 52 | // Initialize socket address structure. 53 | addr.sin_family = AF_INET; 54 | addr.sin_port = _htons(_port); 55 | addr.sin_addr.s_addr = 0; 56 | 57 | // Open TCP server socket. 58 | if ((_socket = socket(AF_INET, SOCK_STREAM, opt)) < 0) { 59 | return 0; 60 | } 61 | 62 | // Add socket buffer handler: 63 | socketBufferRegister(_socket, &_flag, 0, 0, 0); 64 | 65 | // Bind socket: 66 | if (bind(_socket, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) < 0) { 67 | close(_socket); 68 | _socket = -1; 69 | return 0; 70 | } 71 | 72 | // Wait for connection or timeout: 73 | unsigned long start = millis(); 74 | while (!READY && millis() - start < 2000) { 75 | m2m_wifi_handle_events(NULL); 76 | } 77 | if (!READY) { 78 | close(_socket); 79 | _socket = -1; 80 | return 0; 81 | } 82 | _flag &= ~SOCKET_BUFFER_FLAG_BIND; 83 | 84 | return 1; 85 | } 86 | 87 | WiFiClient WiFiServer::available(uint8_t* status) 88 | { 89 | uint32_t flag; 90 | 91 | m2m_wifi_handle_events(NULL); 92 | if (_flag & SOCKET_BUFFER_FLAG_SPAWN) { 93 | flag = _flag; 94 | _flag &= ~SOCKET_BUFFER_FLAG_SPAWN_SOCKET_MSK; 95 | _flag &= ~SOCKET_BUFFER_FLAG_SPAWN; 96 | if (status != NULL) { 97 | *status = 0; 98 | } 99 | return WiFiClient(((flag & SOCKET_BUFFER_FLAG_SPAWN_SOCKET_MSK) >> SOCKET_BUFFER_FLAG_SPAWN_SOCKET_POS), _socket + 1); 100 | } else { 101 | WiFiClient *client; 102 | 103 | for (int sock = 0; sock < TCP_SOCK_MAX; sock++) { 104 | client = WiFi._client[sock]; 105 | if (client && client->_flag & SOCKET_BUFFER_FLAG_CONNECTED) { 106 | if (((client->_flag >> SOCKET_BUFFER_FLAG_PARENT_SOCKET_POS) & 0xff) == (uint8)(_socket + 1)) { 107 | return *client; 108 | } 109 | } 110 | } 111 | } 112 | 113 | return WiFiClient(); 114 | } 115 | 116 | uint8_t WiFiServer::status() { 117 | // Deprecated. 118 | return 0; 119 | } 120 | 121 | size_t WiFiServer::write(uint8_t b) 122 | { 123 | return write(&b, 1); 124 | } 125 | 126 | size_t WiFiServer::write(const uint8_t *buffer, size_t size) 127 | { 128 | size_t n = 0; 129 | WiFiClient *client; 130 | 131 | for (int sock = 0; sock < TCP_SOCK_MAX; sock++) { 132 | client = WiFi._client[sock]; 133 | if (client && client->_flag & SOCKET_BUFFER_FLAG_CONNECTED) { 134 | if (((client->_flag >> SOCKET_BUFFER_FLAG_PARENT_SOCKET_POS) & 0xff) == (uint8)_socket) { 135 | n += client->write(buffer, size); 136 | } 137 | } 138 | } 139 | return n; 140 | } 141 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/WiFiServer.h: -------------------------------------------------------------------------------- 1 | /* 2 | WiFiClient.cpp - Library for Arduino Wifi shield. 3 | Copyright (c) 2011-2014 Arduino. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef WIFISERVER_H 21 | #define WIFISERVER_H 22 | 23 | #include 24 | #include 25 | 26 | class WiFiClient; 27 | 28 | class WiFiServer : public Server { 29 | 30 | private: 31 | SOCKET _socket; 32 | uint32_t _flag; 33 | uint16_t _port; 34 | uint8_t begin(uint8_t opt); 35 | 36 | public: 37 | WiFiServer(uint16_t); 38 | WiFiClient available(uint8_t* status = NULL); 39 | void begin(); 40 | uint8_t beginSSL(); 41 | virtual size_t write(uint8_t); 42 | virtual size_t write(const uint8_t *buf, size_t size); 43 | uint8_t status(); 44 | 45 | using Print::write; 46 | 47 | }; 48 | 49 | #endif /* WIFISERVER_H */ 50 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/WiFiUdp.h: -------------------------------------------------------------------------------- 1 | /* 2 | WiFiUdp.h - Library for Arduino Wifi shield. 3 | Copyright (c) 2011-2014 Arduino. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef WIFIUDP_H 21 | #define WIFIUDP_H 22 | 23 | #include 24 | 25 | class WiFiUDP : public UDP { 26 | private: 27 | SOCKET _socket; 28 | uint32_t _flag; 29 | uint32_t _head; 30 | uint32_t _tail; 31 | uint8_t _recvBuffer[SOCKET_BUFFER_UDP_SIZE]; 32 | uint16_t _rcvSize; 33 | uint16_t _rcvPort; 34 | uint32_t _rcvIP; 35 | uint8_t _sndBuffer[SOCKET_BUFFER_UDP_SIZE]; 36 | uint16_t _sndSize; 37 | uint16_t _sndPort; 38 | uint32_t _sndIP; 39 | 40 | public: 41 | WiFiUDP(); // Constructor 42 | virtual uint8_t begin(uint16_t); // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use 43 | virtual uint8_t beginMulticast(IPAddress, uint16_t); // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 if there are no sockets available to use 44 | virtual uint8_t beginMulti(IPAddress ip, uint16_t port) { return beginMulticast(ip, port); } 45 | virtual void stop(); // Finish with the UDP socket 46 | 47 | // Sending UDP packets 48 | 49 | // Start building up a packet to send to the remote host specific in ip and port 50 | // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port 51 | virtual int beginPacket(IPAddress ip, uint16_t port); 52 | // Start building up a packet to send to the remote host specific in host and port 53 | // Returns 1 if successful, 0 if there was a problem resolving the hostname or port 54 | virtual int beginPacket(const char *host, uint16_t port); 55 | // Finish off this packet and send it 56 | // Returns 1 if the packet was sent successfully, 0 if there was an error 57 | virtual int endPacket(); 58 | // Write a single byte into the packet 59 | virtual size_t write(uint8_t); 60 | // Write size bytes from buffer into the packet 61 | virtual size_t write(const uint8_t *buffer, size_t size); 62 | 63 | using Print::write; 64 | 65 | // Start processing the next available incoming packet 66 | // Returns the size of the packet in bytes, or 0 if no packets are available 67 | virtual int parsePacket(); 68 | // Number of bytes remaining in the current packet 69 | virtual int available(); 70 | // Read a single byte from the current packet 71 | virtual int read(); 72 | // Read up to len bytes from the current packet and place them into buffer 73 | // Returns the number of bytes read, or 0 if none are available 74 | virtual int read(unsigned char* buffer, size_t len); 75 | // Read up to len characters from the current packet and place them into buffer 76 | // Returns the number of characters read, or 0 if none are available 77 | virtual int read(char* buffer, size_t len) { return read((unsigned char*)buffer, len); }; 78 | // Return the next byte from the current packet without moving on to the next byte 79 | virtual int peek(); 80 | virtual void flush(); // Finish reading the current packet 81 | 82 | // Return the IP address of the host who sent the current incoming packet 83 | virtual IPAddress remoteIP(); 84 | // Return the port of the host who sent the current incoming packet 85 | virtual uint16_t remotePort(); 86 | 87 | }; 88 | 89 | #endif /* WIFIUDP_H */ 90 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/bsp/include/nm_bsp_arduino.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * \file 4 | * 5 | * \brief This module contains NMC1500 BSP APIs definitions. 6 | * 7 | * Copyright (c) 2015 Atmel Corporation. All rights reserved. 8 | * 9 | * \asf_license_start 10 | * 11 | * \page License 12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 19 | * 2. Redistributions in binary form must reproduce the above copyright notice, 20 | * this list of conditions and the following disclaimer in the documentation 21 | * and/or other materials provided with the distribution. 22 | * 23 | * 3. The name of Atmel may not be used to endorse or promote products derived 24 | * from this software without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | * POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | * \asf_license_stop 39 | * 40 | */ 41 | 42 | #ifndef _NM_BSP_ARDUINO_H_ 43 | #define _NM_BSP_ARDUINO_H_ 44 | 45 | #include 46 | 47 | #include 48 | 49 | /* 50 | * Arduino variants may redefine those pins. 51 | * If no pins are specified the following defaults are used: 52 | * WINC1501_RESET_PIN - pin 5 53 | * WINC1501_INTN_PIN - pin 7 54 | * WINC1501_CHIP_EN_PIN - not connected (tied to VCC) 55 | */ 56 | #if !defined(WINC1501_RESET_PIN) 57 | #define WINC1501_RESET_PIN 5 58 | #endif 59 | #if !defined(WINC1501_INTN_PIN) 60 | #define WINC1501_INTN_PIN 7 61 | #endif 62 | #if !defined(WINC1501_SPI_CS_PIN) 63 | #define WINC1501_SPI_CS_PIN 10 64 | #endif 65 | #if !defined(WINC1501_CHIP_EN_PIN) 66 | #define WINC1501_CHIP_EN_PIN -1 67 | #endif 68 | 69 | extern int8_t gi8Winc1501CsPin; 70 | extern int8_t gi8Winc1501ResetPin; 71 | extern int8_t gi8Winc1501IntnPin; 72 | extern int8_t gi8Winc1501ChipEnPin; 73 | 74 | #endif /* _NM_BSP_ARDUINO_H_ */ 75 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/bsp/include/nm_bsp_avr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * \file 4 | * 5 | * \brief This module contains NMC1500 BSP APIs definitions. 6 | * 7 | * Copyright (c) 2015 Atmel Corporation. All rights reserved. 8 | * 9 | * \asf_license_start 10 | * 11 | * \page License 12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 19 | * 2. Redistributions in binary form must reproduce the above copyright notice, 20 | * this list of conditions and the following disclaimer in the documentation 21 | * and/or other materials provided with the distribution. 22 | * 23 | * 3. The name of Atmel may not be used to endorse or promote products derived 24 | * from this software without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | * POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | * \asf_license_stop 39 | * 40 | */ 41 | 42 | #ifndef _NM_BSP_AVR_H_ 43 | #define _NM_BSP_AVR_H_ 44 | 45 | #pragma once 46 | 47 | #define NM_DEBUG 0 48 | #define NM_BSP_PRINTF 49 | 50 | #define CONF_WINC_USE_SPI 1 51 | 52 | #define NM_EDGE_INTERRUPT 1 53 | 54 | #endif /* _NM_BSP_AVR_H_ */ 55 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/bsp/include/nm_bsp_internal.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * \file 4 | * 5 | * \brief This module contains NMC1500 BSP APIs declarations. 6 | * 7 | * Copyright (c) 2015 Atmel Corporation. All rights reserved. 8 | * 9 | * \asf_license_start 10 | * 11 | * \page License 12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 19 | * 2. Redistributions in binary form must reproduce the above copyright notice, 20 | * this list of conditions and the following disclaimer in the documentation 21 | * and/or other materials provided with the distribution. 22 | * 23 | * 3. The name of Atmel may not be used to endorse or promote products derived 24 | * from this software without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | * POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | * \asf_license_stop 39 | * 40 | */ 41 | /**@defgroup BSPDefine Defines 42 | * @ingroup nm_bsp 43 | * @{ 44 | */ 45 | #ifndef _NM_BSP_INTERNAL_H_ 46 | #define _NM_BSP_INTERNAL_H_ 47 | 48 | #ifdef ARDUINO_ARCH_AVR 49 | #define LIMITED_RAM_DEVICE 50 | #include "bsp/include/nm_bsp_avr.h" 51 | #else 52 | #include "bsp/include/nm_bsp_samd21.h" 53 | #endif 54 | 55 | #endif //_NM_BSP_INTERNAL_H_ -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/bsp/include/nm_bsp_samd21.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * \file 4 | * 5 | * \brief This module contains NMC1500 BSP APIs definitions. 6 | * 7 | * Copyright (c) 2015 Atmel Corporation. All rights reserved. 8 | * 9 | * \asf_license_start 10 | * 11 | * \page License 12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 19 | * 2. Redistributions in binary form must reproduce the above copyright notice, 20 | * this list of conditions and the following disclaimer in the documentation 21 | * and/or other materials provided with the distribution. 22 | * 23 | * 3. The name of Atmel may not be used to endorse or promote products derived 24 | * from this software without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | * POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | * \asf_license_stop 39 | * 40 | */ 41 | 42 | #ifndef _NM_BSP_SAMD21_H_ 43 | #define _NM_BSP_SAMD21_H_ 44 | 45 | #define NM_DEBUG 0 46 | #define NM_BSP_PRINTF 47 | 48 | #define CONF_WINC_USE_SPI 1 49 | 50 | #define NM_EDGE_INTERRUPT 1 51 | 52 | #endif /* _NM_BSP_SAMD21_H_ */ 53 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/common/include/nm_debug.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * \file 4 | * 5 | * \brief This module contains debug APIs declarations. 6 | * 7 | * Copyright (c) 2015 Atmel Corporation. All rights reserved. 8 | * 9 | * \asf_license_start 10 | * 11 | * \page License 12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 19 | * 2. Redistributions in binary form must reproduce the above copyright notice, 20 | * this list of conditions and the following disclaimer in the documentation 21 | * and/or other materials provided with the distribution. 22 | * 23 | * 3. The name of Atmel may not be used to endorse or promote products derived 24 | * from this software without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | * POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | * \asf_license_stop 39 | * 40 | */ 41 | 42 | #ifndef _NM_DEBUG_H_ 43 | #define _NM_DEBUG_H_ 44 | 45 | #include "bsp/include/nm_bsp.h" 46 | #include "bsp/include/nm_bsp_internal.h" 47 | 48 | /**@defgroup DebugDefines DebugDefines 49 | * @ingroup WlanDefines 50 | */ 51 | /**@{*/ 52 | 53 | 54 | #define M2M_LOG_NONE 0 55 | #define M2M_LOG_ERROR 1 56 | #define M2M_LOG_INFO 2 57 | #define M2M_LOG_REQ 3 58 | #define M2M_LOG_DBG 4 59 | 60 | #if (defined __APS3_CORTUS__) 61 | #define M2M_LOG_LEVEL M2M_LOG_ERROR 62 | #else 63 | #define M2M_LOG_LEVEL M2M_LOG_REQ 64 | #endif 65 | 66 | 67 | #define M2M_ERR(...) 68 | #define M2M_INFO(...) 69 | #define M2M_REQ(...) 70 | #define M2M_DBG(...) 71 | #define M2M_PRINT(...) 72 | 73 | #if (CONF_WINC_DEBUG == 1) 74 | #undef M2M_PRINT 75 | #define M2M_PRINT(...) do{CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0) 76 | #if (M2M_LOG_LEVEL >= M2M_LOG_ERROR) 77 | #undef M2M_ERR 78 | #define M2M_ERR(...) do{CONF_WINC_PRINTF("(APP)(ERR)[%s][%d]",__FUNCTION__,__LINE__); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0) 79 | #if (M2M_LOG_LEVEL >= M2M_LOG_INFO) 80 | #undef M2M_INFO 81 | #define M2M_INFO(...) do{CONF_WINC_PRINTF("(APP)(INFO)"); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0) 82 | #if (M2M_LOG_LEVEL >= M2M_LOG_REQ) 83 | #undef M2M_REQ 84 | #define M2M_REQ(...) do{CONF_WINC_PRINTF("(APP)(R)"); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0) 85 | #if (M2M_LOG_LEVEL >= M2M_LOG_DBG) 86 | #undef M2M_DBG 87 | #define M2M_DBG(...) do{CONF_WINC_PRINTF("(APP)(DBG)[%s][%d]",__FUNCTION__,__LINE__); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0) 88 | #endif /*M2M_LOG_DBG*/ 89 | #endif /*M2M_LOG_REQ*/ 90 | #endif /*M2M_LOG_INFO*/ 91 | #endif /*M2M_LOG_ERROR*/ 92 | #endif /*CONF_WINC_DEBUG */ 93 | 94 | /**@}*/ 95 | #endif /* _NM_DEBUG_H_ */ 96 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/common/source/nm_common.c: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * \file 4 | * 5 | * \brief This module contains common APIs declarations. 6 | * 7 | * Copyright (c) 2015 Atmel Corporation. All rights reserved. 8 | * 9 | * \asf_license_start 10 | * 11 | * \page License 12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 19 | * 2. Redistributions in binary form must reproduce the above copyright notice, 20 | * this list of conditions and the following disclaimer in the documentation 21 | * and/or other materials provided with the distribution. 22 | * 23 | * 3. The name of Atmel may not be used to endorse or promote products derived 24 | * from this software without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | * POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | * \asf_license_stop 39 | * 40 | */ 41 | #include "common/include/nm_common.h" 42 | 43 | void m2m_memcpy(uint8* pDst,uint8* pSrc,uint32 sz) 44 | { 45 | if(sz == 0) return; 46 | do 47 | { 48 | *pDst = *pSrc; 49 | pDst++; 50 | pSrc++; 51 | }while(--sz); 52 | } 53 | uint8 m2m_checksum(uint8* buf, int sz) 54 | { 55 | uint8 cs = 0; 56 | while(--sz) 57 | { 58 | cs ^= *buf; 59 | buf++; 60 | } 61 | 62 | return cs; 63 | } 64 | 65 | void m2m_memset(uint8* pBuf,uint8 val,uint32 sz) 66 | { 67 | if(sz == 0) return; 68 | do 69 | { 70 | *pBuf = val; 71 | pBuf++; 72 | }while(--sz); 73 | } 74 | 75 | uint16 m2m_strlen(uint8 * pcStr) 76 | { 77 | uint16 u16StrLen = 0; 78 | while(*pcStr) 79 | { 80 | u16StrLen ++; 81 | pcStr++; 82 | } 83 | return u16StrLen; 84 | } 85 | 86 | uint8 m2m_strncmp(uint8 *pcS1, uint8 *pcS2, uint16 u16Len) 87 | { 88 | for ( ; u16Len > 0; pcS1++, pcS2++, --u16Len) 89 | if (*pcS1 != *pcS2) 90 | return ((*(uint8 *)pcS1 < *(uint8 *)pcS2) ? -1 : +1); 91 | else if (*pcS1 == '\0') 92 | return 0; 93 | return 0; 94 | } 95 | 96 | /* Finds the occurance of pcStr in pcIn. 97 | If pcStr is part of pcIn it returns a valid pointer to the start of pcStr within pcIn. 98 | Otherwise a NULL Pointer is returned. 99 | */ 100 | uint8 * m2m_strstr(uint8 *pcIn, uint8 *pcStr) 101 | { 102 | uint8 u8c; 103 | uint16 u16StrLen; 104 | 105 | u8c = *pcStr++; 106 | if (!u8c) 107 | return (uint8 *) pcIn; // Trivial empty string case 108 | 109 | u16StrLen = m2m_strlen(pcStr); 110 | do { 111 | uint8 u8Sc; 112 | 113 | do { 114 | u8Sc = *pcIn++; 115 | if (!u8Sc) 116 | return (uint8 *) 0; 117 | } while (u8Sc != u8c); 118 | } while (m2m_strncmp(pcIn, pcStr, u16StrLen) != 0); 119 | 120 | return (uint8 *) (pcIn - 1); 121 | } 122 | 123 | sint8 m2m_memcmp(uint8 *pu8Buff1,uint8 *pu8Buff2 ,uint32 u32Size) 124 | { 125 | uint32 i; 126 | sint8 s8Result = 0; 127 | for(i = 0 ; i < u32Size ; i++) 128 | { 129 | if(pu8Buff1[i] != pu8Buff2[i]) 130 | { 131 | s8Result = 1; 132 | break; 133 | } 134 | } 135 | return s8Result; 136 | } 137 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/driver/source/nmi2c.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * \file 4 | * 5 | * \brief This module contains NMC1000 I2C protocol bus APIs implementation. 6 | * 7 | * Copyright (c) 2015 Atmel Corporation. All rights reserved. 8 | * 9 | * \asf_license_start 10 | * 11 | * \page License 12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 19 | * 2. Redistributions in binary form must reproduce the above copyright notice, 20 | * this list of conditions and the following disclaimer in the documentation 21 | * and/or other materials provided with the distribution. 22 | * 23 | * 3. The name of Atmel may not be used to endorse or promote products derived 24 | * from this software without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | * POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | * \asf_license_stop 39 | * 40 | */ 41 | 42 | #ifndef _NMI2C_H_ 43 | #define _NMI2C_H_ 44 | 45 | #include "common/include/nm_common.h" 46 | 47 | /** 48 | * @fn nm_i2c_read_reg 49 | * @brief Read register 50 | * @param [in] u32Addr 51 | * Register address 52 | * @return Register value 53 | */ 54 | uint32 nm_i2c_read_reg(uint32 u32Addr); 55 | 56 | /** 57 | * @fn nm_i2c_read_reg_with_ret 58 | * @brief Read register with error code return 59 | * @param [in] u32Addr 60 | * Register address 61 | * @param [out] pu32RetVal 62 | * Pointer to u32 variable used to return the read value 63 | * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 64 | */ 65 | sint8 nm_i2c_read_reg_with_ret(uint32 u32Addr, uint32* pu32RetVal); 66 | 67 | /** 68 | * @fn nm_i2c_write_reg 69 | * @brief write register 70 | * @param [in] u32Addr 71 | * Register address 72 | * @param [in] u32Val 73 | * Value to be written to the register 74 | * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 75 | */ 76 | sint8 nm_i2c_write_reg(uint32 u32Addr, uint32 u32Val); 77 | 78 | /** 79 | * @fn nm_i2c_read_block 80 | * @brief Read block of data 81 | * @param [in] u32Addr 82 | * Start address 83 | * @param [out] puBuf 84 | * Pointer to a buffer used to return the read data 85 | * @param [in] u16Sz 86 | * Number of bytes to read. The buffer size must be >= u16Sz 87 | * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 88 | */ 89 | sint8 nm_i2c_read_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz); 90 | 91 | /** 92 | * @fn nm_i2c_write_block 93 | * @brief Write block of data 94 | * @param [in] u32Addr 95 | * Start address 96 | * @param [in] puBuf 97 | * Pointer to the buffer holding the data to be written 98 | * @param [in] u16Sz 99 | * Number of bytes to write. The buffer size must be >= u16Sz 100 | * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 101 | */ 102 | sint8 nm_i2c_write_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz); 103 | 104 | #endif /* _NMI2C_H_ */ 105 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/driver/source/nmspi.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * \file 4 | * 5 | * \brief This module contains NMC1000 SPI protocol bus APIs implementation. 6 | * 7 | * Copyright (c) 2015 Atmel Corporation. All rights reserved. 8 | * 9 | * \asf_license_start 10 | * 11 | * \page License 12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 19 | * 2. Redistributions in binary form must reproduce the above copyright notice, 20 | * this list of conditions and the following disclaimer in the documentation 21 | * and/or other materials provided with the distribution. 22 | * 23 | * 3. The name of Atmel may not be used to endorse or promote products derived 24 | * from this software without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | * POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | * \asf_license_stop 39 | * 40 | */ 41 | 42 | #ifndef _NMSPI_H_ 43 | #define _NMSPI_H_ 44 | 45 | #include "common/include/nm_common.h" 46 | 47 | #ifdef __cplusplus 48 | extern "C" { 49 | #endif 50 | 51 | /** 52 | * @fn nm_spi_init 53 | * @brief Initialize the SPI 54 | * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 55 | */ 56 | sint8 nm_spi_init(void); 57 | 58 | /** 59 | * @fn nm_spi_deinit 60 | * @brief DeInitialize the SPI 61 | * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 62 | */ 63 | sint8 nm_spi_deinit(void); 64 | 65 | /** 66 | * @fn nm_spi_read_reg 67 | * @brief Read register 68 | * @param [in] u32Addr 69 | * Register address 70 | * @return Register value 71 | */ 72 | uint32 nm_spi_read_reg(uint32 u32Addr); 73 | 74 | /** 75 | * @fn nm_spi_read_reg_with_ret 76 | * @brief Read register with error code return 77 | * @param [in] u32Addr 78 | * Register address 79 | * @param [out] pu32RetVal 80 | * Pointer to u32 variable used to return the read value 81 | * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 82 | */ 83 | sint8 nm_spi_read_reg_with_ret(uint32 u32Addr, uint32* pu32RetVal); 84 | 85 | /** 86 | * @fn nm_spi_write_reg 87 | * @brief write register 88 | * @param [in] u32Addr 89 | * Register address 90 | * @param [in] u32Val 91 | * Value to be written to the register 92 | * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 93 | */ 94 | sint8 nm_spi_write_reg(uint32 u32Addr, uint32 u32Val); 95 | 96 | /** 97 | * @fn nm_spi_read_block 98 | * @brief Read block of data 99 | * @param [in] u32Addr 100 | * Start address 101 | * @param [out] puBuf 102 | * Pointer to a buffer used to return the read data 103 | * @param [in] u16Sz 104 | * Number of bytes to read. The buffer size must be >= u16Sz 105 | * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 106 | */ 107 | sint8 nm_spi_read_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz); 108 | 109 | /** 110 | * @fn nm_spi_write_block 111 | * @brief Write block of data 112 | * @param [in] u32Addr 113 | * Start address 114 | * @param [in] puBuf 115 | * Pointer to the buffer holding the data to be written 116 | * @param [in] u16Sz 117 | * Number of bytes to write. The buffer size must be >= u16Sz 118 | * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 119 | */ 120 | sint8 nm_spi_write_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz); 121 | 122 | #ifdef __cplusplus 123 | } 124 | #endif 125 | 126 | #endif /* _NMSPI_H_ */ 127 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/driver/source/nmuart.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * \file 4 | * 5 | * \brief This module contains NMC1000 UART protocol bus APIs implementation. 6 | * 7 | * Copyright (c) 2015 Atmel Corporation. All rights reserved. 8 | * 9 | * \asf_license_start 10 | * 11 | * \page License 12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 19 | * 2. Redistributions in binary form must reproduce the above copyright notice, 20 | * this list of conditions and the following disclaimer in the documentation 21 | * and/or other materials provided with the distribution. 22 | * 23 | * 3. The name of Atmel may not be used to endorse or promote products derived 24 | * from this software without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | * POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | * \asf_license_stop 39 | * 40 | */ 41 | 42 | #ifndef _NMUART_H_ 43 | #define _NMUART_H_ 44 | 45 | #include "common/include/nm_common.h" 46 | 47 | /* 48 | * @fn nm_uart_sync_cmd 49 | * @brief Check COM Port 50 | * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 51 | */ 52 | sint8 nm_uart_sync_cmd(void); 53 | /** 54 | * @fn nm_uart_read_reg 55 | * @brief Read register 56 | * @param [in] u32Addr 57 | * Register address 58 | * @return Register value 59 | */ 60 | uint32 nm_uart_read_reg(uint32 u32Addr); 61 | 62 | /** 63 | * @fn nm_uart_read_reg_with_ret 64 | * @brief Read register with error code return 65 | * @param [in] u32Addr 66 | * Register address 67 | * @param [out] pu32RetVal 68 | * Pointer to u32 variable used to return the read value 69 | * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 70 | */ 71 | sint8 nm_uart_read_reg_with_ret(uint32 u32Addr, uint32* pu32RetVal); 72 | 73 | /** 74 | * @fn nm_uart_write_reg 75 | * @brief write register 76 | * @param [in] u32Addr 77 | * Register address 78 | * @param [in] u32Val 79 | * Value to be written to the register 80 | * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 81 | */ 82 | sint8 nm_uart_write_reg(uint32 u32Addr, uint32 u32Val); 83 | 84 | /** 85 | * @fn nm_uart_read_block 86 | * @brief Read block of data 87 | * @param [in] u32Addr 88 | * Start address 89 | * @param [out] puBuf 90 | * Pointer to a buffer used to return the read data 91 | * @param [in] u16Sz 92 | * Number of bytes to read. The buffer size must be >= u16Sz 93 | * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 94 | */ 95 | sint8 nm_uart_read_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz); 96 | 97 | /** 98 | * @fn nm_uart_write_block 99 | * @brief Write block of data 100 | * @param [in] u32Addr 101 | * Start address 102 | * @param [in] puBuf 103 | * Pointer to the buffer holding the data to be written 104 | * @param [in] u16Sz 105 | * Number of bytes to write. The buffer size must be >= u16Sz 106 | * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 107 | */ 108 | sint8 nm_uart_write_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz); 109 | 110 | /** 111 | * @fn nm_uart_reconfigure 112 | * @brief Reconfigures the UART interface 113 | * @param [in] ptr 114 | * Pointer to a DWORD containing baudrate at this moment. 115 | * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 116 | */ 117 | sint8 nm_uart_reconfigure(void *ptr); 118 | #endif /* _NMI2C_H_ */ 119 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/socket/include/socket_buffer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * \file 4 | * 5 | * \brief BSD compatible socket interface. 6 | * 7 | * Copyright (c) 2014 Atmel Corporation. All rights reserved. 8 | * 9 | * \asf_license_start 10 | * 11 | * \page License 12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 19 | * 2. Redistributions in binary form must reproduce the above copyright notice, 20 | * this list of conditions and the following disclaimer in the documentation 21 | * and/or other materials provided with the distribution. 22 | * 23 | * 3. The name of Atmel may not be used to endorse or promote products derived 24 | * from this software without specific prior written permission. 25 | * 26 | * 4. This software may only be redistributed and used in connection with an 27 | * Atmel microcontroller product. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 30 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 31 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 32 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 33 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 34 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 35 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 37 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 38 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 39 | * POSSIBILITY OF SUCH DAMAGE. 40 | * 41 | * \asf_license_stop 42 | * 43 | */ 44 | 45 | #ifndef __SOCKET_BUFFER_H__ 46 | #define __SOCKET_BUFFER_H__ 47 | 48 | #include "socket/include/socket.h" 49 | 50 | #ifdef __cplusplus 51 | extern "C" { 52 | #endif 53 | 54 | #define SOCKET_BUFFER_UDP_HEADER_SIZE (8) 55 | 56 | #if defined LIMITED_RAM_DEVICE 57 | #define SOCKET_BUFFER_MTU (16u) 58 | #define SOCKET_BUFFER_UDP_SIZE (SOCKET_BUFFER_UDP_HEADER_SIZE + 64u) 59 | #define SOCKET_BUFFER_TCP_SIZE (64u) 60 | #else 61 | #define SOCKET_BUFFER_MTU (1446u) 62 | #define SOCKET_BUFFER_UDP_SIZE (SOCKET_BUFFER_MTU) 63 | #define SOCKET_BUFFER_TCP_SIZE (SOCKET_BUFFER_MTU) 64 | #endif 65 | 66 | #define SOCKET_BUFFER_FLAG_CONNECTED (0x1 << 0) 67 | #define SOCKET_BUFFER_FLAG_FULL (0x1 << 1) 68 | #define SOCKET_BUFFER_FLAG_BIND (0x1 << 2) 69 | #define SOCKET_BUFFER_FLAG_SPAWN (0x1 << 3) 70 | #define SOCKET_BUFFER_FLAG_SPAWN_SOCKET_POS (16) 71 | #define SOCKET_BUFFER_FLAG_SPAWN_SOCKET_MSK (((uint32)0xFF) << SOCKET_BUFFER_FLAG_SPAWN_SOCKET_POS) 72 | #define SOCKET_BUFFER_FLAG_PARENT_SOCKET_POS (24) 73 | #define SOCKET_BUFFER_FLAG_PARENT_SOCKET_MSK (((uint32)0xFF) << SOCKET_BUFFER_FLAG_PARENT_SOCKET_POS) 74 | 75 | /* Parent stored as parent+1, as socket 1 ID is 0. */ 76 | 77 | typedef struct{ 78 | uint8 *buffer; 79 | uint32 *flag; 80 | uint32 *head; 81 | uint32 *tail; 82 | }tstrSocketBuffer; 83 | 84 | void socketBufferInit(void); 85 | void socketBufferRegister(SOCKET socket, uint32 *flag, uint32 *head, uint32 *tail, uint8 *buffer); 86 | void socketBufferUnregister(SOCKET socket); 87 | void socketBufferCb(SOCKET sock, uint8 u8Msg, void *pvMsg); 88 | 89 | #ifdef __cplusplus 90 | } 91 | #endif /* __cplusplus */ 92 | 93 | #endif /* __SOCKET_BUFFER_H__ */ 94 | -------------------------------------------------------------------------------- /libraries/AnduinoWiFi/src/socket/source/socket_internal.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * \file 4 | * 5 | * \brief BSD alike socket interface internal types. 6 | * 7 | * Copyright (c) 2015 Atmel Corporation. All rights reserved. 8 | * 9 | * \asf_license_start 10 | * 11 | * \page License 12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 19 | * 2. Redistributions in binary form must reproduce the above copyright notice, 20 | * this list of conditions and the following disclaimer in the documentation 21 | * and/or other materials provided with the distribution. 22 | * 23 | * 3. The name of Atmel may not be used to endorse or promote products derived 24 | * from this software without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | * POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | * \asf_license_stop 39 | * 40 | */ 41 | #ifndef __SOCKET_INTERNAL_H__ 42 | #define __SOCKET_INTERNAL_H__ 43 | 44 | 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* 50 | INCLUDES 51 | *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 52 | 53 | #include "socket/include/socket.h" 54 | #include "socket/include/m2m_socket_host_if.h" 55 | 56 | 57 | /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* 58 | FUNCTION PROTOTYPES 59 | *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 60 | 61 | NMI_API void Socket_ReadSocketData(SOCKET sock, tstrSocketRecvMsg *pstrRecv,uint8 u8SocketMsg, 62 | uint32 u32StartAddress,uint16 u16ReadCount); 63 | NMI_API void Socket_ReadSocketData_Small(void); 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif /* __cplusplus */ 68 | 69 | #endif /* __SOCKET_H__ */ 70 | -------------------------------------------------------------------------------- /projects/Amazon_Dash_Replenishment/README.md: -------------------------------------------------------------------------------- 1 | # Amazon Dash Replenishment 2 | 3 | Use your anduinoWiFi to initiate purchases on Amazon! Check out this example [project write up](https://www.hackster.io/bcarbs/amazondrs-nfc-replenisher-98608c?ref=channel&ref_id=37023_trending___&offset=6) on our Anduino Project Hub where we initiate purchases by scanning RFID tags! Using Arduino create or modify a device to automatically order it's consumables before you run out. 4 | 5 | This project utilizes a library written specifically for arduino to interact with the Amazon Dash Replinishment API, [AmazonDRS](https://github.com/andium/AmazonDRS). 6 | 7 | 8 | -------------------------------------------------------------------------------- /projects/Amazon_Dash_Replenishment/nfcReplenisher/nfcReplenisher.ino: -------------------------------------------------------------------------------- 1 | #include "AmazonDRS.h" 2 | #include "AnduinoNFC.h" 3 | 4 | AmazonDRS DRS = AmazonDRS(); 5 | AnduinoNFC NFC = AnduinoNFC(); 6 | 7 | //WiFi creds ----------------------------------------------------------------- 8 | char ssid[] = ""; // your network SSID (name) 9 | char pass[] = ""; // your network password (use for WPA, or use as key for WEP) 10 | //---------------------------------------------------------------------------- 11 | 12 | void setup() { 13 | Serial.begin(115200); 14 | while (!Serial) { 15 | ; // wait for serial port to connect. Needed for native USB port only 16 | } 17 | 18 | //Setup NFC 19 | NFC.begin(); 20 | 21 | //Start up DRS 22 | DRS.begin(ssid,pass); 23 | 24 | //initialize slots 25 | DRS.retrieveSubscriptionInfo(); //check slot statuses 26 | } 27 | 28 | void loop() { 29 | //scan nfc tag containing slotId 30 | //if scanned id matches a valid slot and the slot is available 31 | //request replenishment for the supplied slot 32 | 33 | if (NFC.packetReady()) 34 | { 35 | NfcTag tag = NFC.read(); //attempt to read the RFID tag 36 | tag.print(); //and print the results to the terminal 37 | 38 | NdefMessage message = tag.getNdefMessage(); 39 | NdefRecord record = message.getRecord(0); //grab the bits that contain the DRS Slot ID 40 | 41 | int payloadLength = record.getPayloadLength(); 42 | byte payloadBytes[payloadLength]; 43 | record.getPayload(payloadBytes); 44 | String payloadString = ""; //store the RFID msg bits in a String for comparison 45 | 46 | for(int i=3; i 6 | 7 | /*#define DEBUG_WIFIREG*/ 8 | 9 | 10 | class AnduinoWiFi 11 | { 12 | 13 | public: 14 | AnduinoWiFi(); 15 | int begin(char ssid[]); 16 | void printDetails(); 17 | bool disconnectAP(); 18 | bool isAPmode(); 19 | String getSSID(); 20 | String getPassword(); 21 | void parseRequest(WiFiClient client); 22 | WiFiClient getClient(); 23 | 24 | 25 | 26 | private: 27 | void getRegistrationPage(WiFiClient client); 28 | void postRegistrationPage(WiFiClient client); 29 | uint8_t connectToWiFi(char* newSsid, char* newPass); 30 | uint8_t recursiveBodyParser(String reqBody); 31 | String decodeUri(String buff); 32 | void printAPStatus(); 33 | void printWiFiStatus(); 34 | 35 | }; 36 | 37 | #endif /*__AnduinoWiFi_H */ 38 | -------------------------------------------------------------------------------- /wiki_assets/AnduinoEEPROM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/wiki_assets/AnduinoEEPROM.png -------------------------------------------------------------------------------- /wiki_assets/AnduinoLCDlanding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/wiki_assets/AnduinoLCDlanding.png -------------------------------------------------------------------------------- /wiki_assets/AnduinoNFC.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/wiki_assets/AnduinoNFC.gif -------------------------------------------------------------------------------- /wiki_assets/Anduino_v1_1_diagram.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/wiki_assets/Anduino_v1_1_diagram.jpg -------------------------------------------------------------------------------- /wiki_assets/anduinoWiFi_transbak.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/wiki_assets/anduinoWiFi_transbak.png -------------------------------------------------------------------------------- /wiki_assets/arduino_open_source.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/wiki_assets/arduino_open_source.png -------------------------------------------------------------------------------- /wiki_assets/arduino_os.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/wiki_assets/arduino_os.png -------------------------------------------------------------------------------- /wiki_assets/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/wiki_assets/banner.png -------------------------------------------------------------------------------- /wiki_assets/fullscreenLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/wiki_assets/fullscreenLogo.png -------------------------------------------------------------------------------- /wiki_assets/graphy.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/wiki_assets/graphy.gif -------------------------------------------------------------------------------- /wiki_assets/landingpageAnduino.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/wiki_assets/landingpageAnduino.JPG -------------------------------------------------------------------------------- /wiki_assets/lcdPrint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/wiki_assets/lcdPrint.png -------------------------------------------------------------------------------- /wiki_assets/open_source_hardware.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/wiki_assets/open_source_hardware.png -------------------------------------------------------------------------------- /wiki_assets/sensorVal.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/wiki_assets/sensorVal.JPG -------------------------------------------------------------------------------- /wiki_assets/splashScreen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andium/Anduino/f6a9f22c609490d7c9409212d18d4640c3514b9f/wiki_assets/splashScreen.gif --------------------------------------------------------------------------------