@@ -25,6 +25,8 @@ export ARCADA_PLATFORMS='declare -A arcada_platforms=( [pybadge]="adafruit:samd:
25
25
26
26
export IO_PLATFORMS=' declare -A io_platforms=( [zero]="arduino:samd:arduino_zero_native", [m4wifi]="adafruit:samd:adafruit_metro_m4_airliftlite:speed=120", [esp8266]="esp8266:esp8266:huzzah:eesz=4M3M,xtal=80" [esp32]="esp32:esp32:featheresp32:FlashFreq=80" )'
27
27
28
+ export NRF5X_PLATFORMS=' declare -A nrf5x_platforms=( [nrf52840]="adafruit:nrf52:feather52840:softdevice=s140v6,debug=l0")'
29
+
28
30
# make display available for arduino CLI
29
31
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
30
32
sleep 3
@@ -115,6 +117,10 @@ echo -n "ADAFRUIT SAMD: "
115
117
DEPENDENCY_OUTPUT=$( arduino --install-boards adafruit:samd 2>&1 )
116
118
if [ $? -ne 0 ]; then echo -e " \xe2\x9c\x96 OR CACHED" ; else echo -e " " " $GREEN " " \xe2\x9c\x93" ; fi
117
119
120
+ echo -n " ADAFRUIT NRF5X: "
121
+ DEPENDENCY_OUTPUT=$( arduino --install-boards adafruit:nrf52 2>&1 )
122
+ if [ $? -ne 0 ]; then echo -e " \xe2\x9c\x96 OR CACHED" ; else echo -e " " " $GREEN " " \xe2\x9c\x93" ; fi
123
+
118
124
# install random lib so the arduino IDE grabs a new library index
119
125
# see: https://github.com/arduino/Arduino/issues/3535
120
126
echo -n " UPDATE LIBRARY INDEX: "
@@ -146,6 +152,7 @@ function build_platform()
146
152
eval $M4_PLATFORMS
147
153
eval $ARCADA_PLATFORMS
148
154
eval $IO_PLATFORMS
155
+ eval $NRF5X_PLATFORMS
149
156
150
157
# reset platform json var
151
158
PLATFORM_JSON=" "
@@ -193,6 +200,8 @@ function build_platform()
193
200
platform=${arcada_platforms[$platform_key]}
194
201
elif [[ ${io_platforms[$platform_key]} ]]; then
195
202
platform=${io_platforms[$platform_key]}
203
+ elif [[ ${nrf5x_platforms[$platform_key]} ]]; then
204
+ platform=${nrf5x_platforms[$platform_key]}
196
205
else
197
206
echo " NON-STANDARD PLATFORM KEY: $platform_key "
198
207
platform=$platform_key
@@ -698,6 +707,55 @@ function build_arcada_platforms()
698
707
}
699
708
700
709
710
+ function build_nrf5x_platforms()
711
+ {
712
+
713
+ # arrays can't be exported, so we have to eval
714
+ eval $NRF5X_PLATFORMS
715
+
716
+ # track the build status all platforms
717
+ local exit_code=0
718
+
719
+ # var to hold platforms
720
+ local platforms_json=" "
721
+
722
+ # get the last element in the array
723
+ local last=" ${nrf5x_platforms[@]: (-1)} "
724
+
725
+ # loop through platforms in main platforms assoc array
726
+ for p_key in " ${! nrf5x_platforms[@]} " ; do
727
+
728
+ # is this the last platform in the loop
729
+ local last_platform=0
730
+ if [ " $last " == " ${nrf5x_platforms[$p_key]} " ]; then
731
+ last_platform=1
732
+ fi
733
+
734
+ # build all examples for this platform
735
+ build_platform $p_key
736
+
737
+ # check if build failed
738
+ if [ $? -ne 0 ]; then
739
+ platforms_json=" ${platforms_json} $( json_platform $p_key 0 " $PLATFORM_JSON " $last_platform ) "
740
+ exit_code=1
741
+ else
742
+ platforms_json=" ${platforms_json} $( json_platform $p_key 1 " $PLATFORM_JSON " $last_platform ) "
743
+ fi
744
+
745
+ done
746
+
747
+ # exit code is opposite of json build status
748
+ if [ $exit_code -eq 0 ]; then
749
+ json_main_platforms 1 " $platforms_json "
750
+ else
751
+ json_main_platforms 0 " $platforms_json "
752
+ fi
753
+
754
+ return $exit_code
755
+
756
+ }
757
+
758
+
701
759
# generate json string for a sketch
702
760
function json_sketch()
703
761
{
0 commit comments