Skip to content

Commit

Permalink
Merge pull request #92 from Pi4J/fix_bad_merge
Browse files Browse the repository at this point in the history
Fix bad merge
  • Loading branch information
taartspi authored Feb 14, 2025
2 parents 2b02274 + 708e264 commit 39672b2
Show file tree
Hide file tree
Showing 18 changed files with 128 additions and 2,091 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The following lists the currently supported devices within this project:
* [1602A LCD HD44780U](src/main/java/com/pi4j/devices/hd44780u_lcd1602a/README.md): App uses SN74HC595 to control the LCD
* [1602A LCD MCP23017 I2C Controller](src/main/java/com/pi4j/devices/mcp23017_lcd1602a/README.md): App uses MCP23017 to control the LCD
* [1602A_LCD_PCF8574A I2C Controller](src/main/java/com/pi4j/devices/pcf8574a_lcd1602a/README.md): App uses PCF8574A to control the LCD
* [ADS1255/ADS1256 24bit A-to-D](src/main/java/com/pi4j/devices/ads1256/README.md) (1)
* [ADS1256 24bit A-to-D](src/main/java/com/pi4j/devices/ads1256/README.md) (1)
* [AT24C512 SEEPROM](src/main/java/com/pi4j/devices/at24c512/README.md) (1) (2)
* [BMP280 Temperature and Pressure Sensor](src/main/java/com/pi4j/devices/bmp280/README.md) (1)
* [BME280 Temperature, Pressure and Humidity Sensor (I2C & SPI)](src/main/java/com/pi4j/devices/bme280/README.md) (1)(3)
Expand Down
8 changes: 1 addition & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

<!-- DEPENDENCIES VERSIONS 2.0.3 -SNAPSHOT -->
<slf4j.version>1.7.30</slf4j.version>
<pi4j.version>2.7.1-SNAPSHOT</pi4j.version>
<pi4j.version>2.7.0</pi4j.version>

<!-- BUILD PLUGIN VERSIONS -->
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
Expand Down Expand Up @@ -109,12 +109,6 @@
<groupId>com.pi4j</groupId>
<artifactId>pi4j-plugin-gpiod</artifactId>
<version>${pi4j.version}</version>
</dependency>
<!-- change to use the default slf4 simple -->
<dependency>
<groupId>com.pi4j</groupId>
<artifactId>pi4j-plugin-linuxfs</artifactId>
<version>${pi4j.version}</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
Expand Down
65 changes: 0 additions & 65 deletions src/main/java/com/pi4j/devices/ads1256/ADS1255.java

This file was deleted.

13 changes: 8 additions & 5 deletions src/main/java/com/pi4j/devices/ads1256/ADS1256.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,10 @@ private void init() throws InterruptedException {
.name("A/D converter")
.bus(this.spiBus)
.chipSelect(this.chipSelect)
.flags(0b0000000000000011100001L) // Ux CE not used, MM mode 1
.baud(976563) //Spi.DEFAULT_BAUD)
.mode(SpiMode.MODE_1)
.provider("linuxfs-spi")
.provider("pigpio-spi")
.build();
this.spi = this.pi4j.create(spiConfig);

Expand Down Expand Up @@ -370,7 +371,7 @@ private byte readRegData(int reg) {
byte rval = 42;
this.csGpio.low();
busyWaitMS(2);
byte[] buf = new byte[4097] ; //{0, 0, 0};
byte[] buf = {0, 0, 0};
buf[0] = (byte) (ADS1256_Declares.RREG | reg);
buf[1] = 0x00;
this.spi.write(buf);
Expand Down Expand Up @@ -579,16 +580,18 @@ private int doRDATA() throws InterruptedException {
this.logger.trace(">>> Enter doRDATA ");

int read = 0;
byte[] buf = {0, 0, 0};
int[] buf = {0, 0, 0};

this.waitForDrdyLow();
busyWaitMS(1);

this.csGpio.low();
busyWaitMS(2);
this.spi.write(ADS1256_Declares.RDATA);
busyWaitMS(4);
this.spi.read(buf);
busyWaitMS(1);
buf[0] = this.spi.readByte();
buf[1] = this.spi.readByte();
buf[2] = this.spi.readByte();
this.csGpio.high();
read = (buf[0] << 16) & 0x00FF0000;
read |= (buf[1] << 8) & 0x0000FF00;
Expand Down
15 changes: 14 additions & 1 deletion src/main/java/com/pi4j/devices/ads1256/ADS1256App.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static void main(String[] args) throws InterruptedException, IOException

int gpiopPin = 42;

console.title("<-- The Pi4J V2 Project Extension -->", "ADS1256App");
console.title("<-- The Pi4J V2 Project Extension -->", "MCP3008App");
String helpString = " parms: -vref decimal reference voltage \n" +
"-rst resetPin -cs chipSelectPin -drdy drdyPin -pdwn syn/pwrdPin \n" +
" -pp -pn AIN0 AIN1 AIN2 AIN3 AIN4 AIN5 AIN6 AIN7 AINCOM -x reset \n" +
Expand Down Expand Up @@ -175,8 +175,21 @@ public static void main(String[] args) throws InterruptedException, IOException
System.exit(45);
}
}
<<<<<<< HEAD


short pinCount = 8;
console.println("----------------------------------------------------------");
console.println("PI4J PROVIDERS");
console.println("----------------------------------------------------------");
pi4j.providers().describe().print(System.out);
System.out.println("----------------------------------------------------------");

ADS1256 spiCls = new ADS1256(pi4j, spiBus, chipSelect, resetChip, drdyPin, csPin, rsrtPin, crtRestart, pdwnPin, crtPdwn, console, traceLevel, vref);
=======
var console = new Console();
Context pi4j = Pi4J.newAutoContext();
>>>>>>> parent of d4775b7 (fix bad merge ADS1256)


double vref = 2.5;
Expand Down
89 changes: 89 additions & 0 deletions src/main/java/com/pi4j/devices/ads1256/ADS1256_Declares.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
*
*
* *
* * -
* * #%L
* * **********************************************************************
* * ORGANIZATION : Pi4J
* * PROJECT : Pi4J :: EXTENSION
* * FILENAME : ADS1256_Declares.java
* *
* * This file is part of the Pi4J project. More information about
* * this project can be found here: https://pi4j.com/
* * **********************************************************************
* * %%
* * * Copyright (C) 2012 - 2022 Pi4J
* * %%
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
* * #L%
* *
*
*
*
*/

package com.pi4j.devices.ads1256;

public class ADS1256_Declares {


protected final static int WAKEUP = 0b00000000; // wakeup/exist standby
protected final static int RDATA = 0b00000001; // read conversion data
protected final static int RDDATC = 0b00000011; // read conv data continuously
protected final static int SDATAC = 0b00001111; // stop read continuously
protected final static int RREG = 0b00010000; // read register(s)
protected final static int WREG = 0b01010000; // write register(s)
protected final static int SELFCAL = 0b11110000; // offset/gain self calibration
protected final static int SELFOCAL = 0b11110001; // offset self calibration
protected final static int SELFGCAL = 0b11110010; // gain self calibration
protected final static int SYSOCAL = 0b11110011; //system offset calibration
protected final static int SYSGCAL = 0b11110100; // system gain calibration
protected final static int SYNC = 0b11111100; // sync A/D converstion
protected final static int STANDBY = 0b11111101; // begin standby
protected final static int RESET = 0b11111110; // reset chip
protected final static int WAKEUPb = 0b11111111; // wakeup/exist standby


protected final static int GPIO_0_IS_IN = 0b00010000; // cfg for input
protected final static int GPIO_1_IS_IN = 0b00100000; // cfg for input
protected final static int GPIO_2_IS_IN = 0b01000000; // cfg for input
protected final static int GPIO_3_IS_IN = 0b10000000; // cfg for input


protected final static int GPIO_0_MASK = 0b00000001; // bit mask
protected final static int GPIO_1_MASK = 0b00000010; // bit mask
protected final static int GPIO_2_MASK = 0b00000100; // bit mask
protected final static int GPIO_3_MASK = 0b00001000; // bit mask


protected final static int STATUS_ACAL = 0b00000100; // enable auto calibrate
protected final static int STATUS_DRDY_MASK = 0b00000001; // Mask off DRDY status bit
protected final static int REG_STATUS = 0x00;
protected final static int REG_MUX = 0x01;
protected final static int REG_ADCON = 0x02;
protected final static int REG_DRATE = 0x03;
protected final static int REG_IO = 0x04;
protected final static int REG_OFC0 = 0x05;
protected final static int REG_OFC1 = 0x06;
protected final static int REG_OFC2 = 0x07;
protected final static int REG_FSC0 = 0x08;
protected final static int REG_FSC1 = 0x09;
protected final static int REG_FSC2 = 0x0A;


protected final static int CHIP_ID = 0x03;


}
Loading

0 comments on commit 39672b2

Please sign in to comment.