Code: Select all
/* SpinCAD Designer - DSP Development Tool for the Spin FV-1
* Copyright (C)2013 - Gary Worsham
* Based on ElmGen by Andrew Kilpatrick
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.holycityaudio.SpinCAD.ControlBlocks;
import java.awt.Color;
import com.holycityaudio.SpinCAD.SpinCADBlock;
public class PotCADBlock extends SpinCADBlock{
/**
*
*/
private static final long serialVersionUID = -6291190763689134131L;
public PotCADBlock(int x, int y) {
super(x, y);
// TODO Auto-generated constructor stub
addControlOutputPin(this); // feedback
setBorderColor(Color.MAGENTA);
}
}
The constructor here gives the block a name.
The generateCode() method associates the Control Output 1 pin with the POT0 register.
Code: Select all
/* SpinCAD Designer - DSP Development Tool for the Spin FV-1
* Copyright (C)2013 - Gary Worsham
* Based on ElmGen by Andrew Kilpatrick
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.holycityaudio.SpinCAD.ControlBlocks;
import com.holycityaudio.SpinCAD.fxblocks.basic.SpinFXBlock;
public class Pot0CADBlock extends PotCADBlock{
/**
*
*/
private static final long serialVersionUID = 3427388550727980484L;
public Pot0CADBlock(int x, int y) {
super(x, y);
// TODO Auto-generated constructor stub
setName("Pot 0");
}
public void generateCode(SpinFXBlock eP) {
System.out.println("Pot 0 codegen!");
this.getPin("Control Output 1").setRegister(POT0);
}
}