package SBC.NanoPi;

import SBC.BasicSBCInfo;
import anywheresoftware.b4a.BA;

@BA.ShortName("Nanopi_Duo2_Pin")

/**
 * Nanopi Duo2
 * Source : https://wiki.friendlyelec.com/wiki/index.php/NanoPi_Duo2#Hardware_Spec
 * @author rdkartono
 *
 */
public class Duo2 extends BasicSBCInfo {

	/**
	 * Pin 09, shared with Infrared RX port
	 */
	public final int pin09 = 363;
	
	public final int pin11 = 203;
	
	/**
	 * Pin 02, shared with Debug Port UART 0 RX
	 */
	public final int pin02 = 5;
	
	/**
	 * Pin 04, shared with Debug Port UART 0 TX
	 */
	public final int pin04 = 4;
	
	/**
	 * Pin 08, shared with I2C-0 SCL
	 */
	public final int pin08 = 11;
	
	/**
	 * Pin 10, shared with I2C-0 SDA
	 */
	public final int pin10 = 12;
	
	/**
	 * Pin 12, shared with UART 3 TX , or SPI 1 CS
	 */
	public final int pin12 = 13;
	
	/**
	 * Pin 14, shared with UART 3 RX, or SPI 1 CLK
	 */
	public final int pin14 = 14;
	
	/**
	 * Pin 16, shared with UART 3 CTS, or SPI 1 MISO
	 */
	public final int pin16 = 16;
	
	/**
	 * Pin 18, shared with UART 3 RTS, or SPI 1 MOSI
	 */
	public final int pin18 = 15;
	
	/**
	 * Pin 20, shared with UART 1 RX
	 */
	public final int pin20 = 199;
	
	/**
	 * Pin 22, shared with UART 1 TX
	 */
	public final int pin22 = 198;
	
	/**
	 * I2C 0
	 */
	public final String i2c_0 = "/dev/i2c-0";
	
	/**
	 * Ethernet name
	 */
	public final String eth_name = "eth0";
	
	/**
	 * UART 0 used for Debug Port
	 */
	public final String serial0_name = "/dev/ttyS0";
	
	/**
	 * UART 1 name
	 */
	public final String serial1_name = "/dev/ttyS1";
	
	/**
	 * UART 3 name 
	 */
	public final String serial3_name = "/dev/ttyS3";
	
	/**
	 * GPIO-based Infrared Receiver name
	 */
	public final String GPIO_IR_Receiver_name = "/dev/input/gpio_ir_recv";
	
	public final LibFriendlyArmHardware WiringNP;
	
	public Duo2() {
		super();
		WiringNP = new LibFriendlyArmHardware();
	}
	
	@BA.Hide
	@Override
	public double Get_CPU_CoreVolt() {
		// TODO Auto-generated method stub
		return 0;
	}

	/**
	 * Initialize Nanopi Duo2 
	 * @param callerobject Caller object
	 * @param event Event string
	 */
	public void Initialize(BA bax, Object callerobject,  String event) {
		setup_events(bax, callerobject, event, this);
		
	}
}
