This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
// Usage: | |
// VGONI_DEBUG_LOGS 1 = Print logs, if 0 won't. | |
// LOGD = Debug, LOGI = Info, LOGE = Error, LOGW = Warning, LOGV = Verbose | |
// 1º Include this header in the cpp to use logs | |
// 2º Add in top of the file: #define LOG_TAG "CppNameOrID" | |
// 3º LOGD("Your message: %s in position %d", variable.c_str(), myInt); | |
// | |
// Example In myFile.cpp: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Java package | |
package com.github.vgoni; | |
// Imports | |
import android.util.Log; | |
public final class InterfaceToCJNI | |
{ | |
// Load Native C/C++ Libraries | |
// ========================================================================= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage | |
// | |
// 1º In MainActivity class, onCreate method, add this line: | |
// InterfaceFromCJNI.callbackMainActivity = this; | |
// 2º Add this function, defined as interface in InterfaceFromCJNI class: | |
// @Override | |
// public void msgFromC(String message) | |
// { | |
// // Your own | |
// Log.d(LOG_TAG, "msgFromC is: " + message); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* How configure UART to use printf using avr-libc, reference: http://www.nongnu.org/avr-libc/user-manual/index.html | |
* This code was compiled using arduino-cmake: https://github.com/arduino-cmake/arduino-cmake.git | |
* cmake -DINPUT_BOARD=pro -DINPUT_PORT=/dev/ttyUSB0 -DBOARD_CPU=16MHzatmega328 .. | |
* make | |
* make upload # push reset button before | |
*/ | |
#if ARDUINO >= 100 | |
#include "Arduino.h" |