1 /* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7     http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 #include "tensorflow/lite/micro/system_setup.h"
17 
18 #include "Arduino.h"
19 #include "tensorflow/lite/micro/debug_log.h"
20 
21 // The Arduino DUE uses a different object for the default serial port shown in
22 // the monitor than most other models, so make sure we pick the right one. See
23 // https://github.com/arduino/Arduino/issues/3088#issuecomment-406655244
24 #if defined(__SAM3X8E__)
25 #define DEBUG_SERIAL_OBJECT (SerialUSB)
26 #else
27 #define DEBUG_SERIAL_OBJECT (Serial)
28 #endif
29 
DebugLog(const char * s)30 extern "C" void DebugLog(const char* s) { DEBUG_SERIAL_OBJECT.print(s); }
31 
32 namespace tflite {
33 
InitializeTarget()34 void InitializeTarget() { DEBUG_SERIAL_OBJECT.begin(9600); }
35 
36 }  // namespace tflite
37