Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added kotlin to dev branch, and made alberts commit kotlin. #5

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.gradle
.idea

PhotonCore/build
6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion PhotonCore/.gitignore

This file was deleted.

14 changes: 8 additions & 6 deletions PhotonCore/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
plugins {
id 'com.android.library'
id 'maven-publish'
id 'org.jetbrains.kotlin.android'
}

repositories {
mavenCentral()
}

android {
compileSdkVersion 30
compileSdkVersion 34
buildToolsVersion "30.0.3"

defaultConfig {
minSdkVersion 24
targetSdkVersion 30
targetSdkVersion 34
versionCode 1
versionName "1.0"

Expand Down Expand Up @@ -44,12 +45,13 @@ afterEvaluate {
}

dependencies {
implementation 'androidx.core:core-ktx:1.10.1'
compileOnly 'org.jetbrains:annotations:15.0'
compileOnly "androidx.annotation:annotation:1.4.0"
compileOnly "androidx.annotation:annotation:1.6.0"

compileOnly 'org.firstinspires.ftc:RobotCore:8.1.0'
compileOnly 'org.firstinspires.ftc:Hardware:8.1.0'
compileOnly 'org.firstinspires.ftc:FtcCommon:8.1.0'
compileOnly 'org.firstinspires.ftc:RobotCore:8.1.1'
compileOnly 'org.firstinspires.ftc:Hardware:8.1.1'
compileOnly 'org.firstinspires.ftc:FtcCommon:8.1.1'
compileOnly 'org.reflections:reflections:0.10.2'
compileOnly 'commons-beanutils:commons-beanutils:1.9.4'

Expand Down
Empty file removed PhotonCore/consumer-rules.pro
Empty file.
21 changes: 0 additions & 21 deletions PhotonCore/proguard-rules.pro

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.outoftheboxrobotics.photoncore.HAL

import com.qualcomm.hardware.lynx.LynxModule
import com.qualcomm.hardware.lynx.commands.LynxRespondable
import com.qualcomm.hardware.lynx.commands.core.LynxGetBulkInputDataResponse

interface HAL {
fun write(respondable: LynxRespondable<*>?)
val lynxModule: LynxModule?
val bulkData: LynxGetBulkInputDataResponse?
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.outoftheboxrobotics.photoncore.HAL.I2C.Commands

import com.outoftheboxrobotics.photoncore.HAL.PhotonCommandBase
import com.qualcomm.hardware.lynx.LynxModuleIntf
import com.qualcomm.hardware.lynx.commands.LynxMessage
import com.qualcomm.hardware.lynx.commands.core.LynxI2cReadMultipleBytesCommand
import com.qualcomm.hardware.lynx.commands.standard.LynxAck
import com.qualcomm.hardware.lynx.commands.standard.LynxNack
import com.qualcomm.robotcore.hardware.I2cAddr
import java.util.concurrent.CompletableFuture

class PhotonLynxI2cReadMultipleBytesCommand : LynxI2cReadMultipleBytesCommand, PhotonCommandBase {
private val future: CompletableFuture<LynxMessage> = CompletableFuture();

constructor(module: LynxModuleIntf): super(module)
constructor(module: LynxModuleIntf, busZ: Int, i2cAddr: I2cAddr, cbToRead: Int) : super(module, busZ, i2cAddr, cbToRead)

override fun onResponseReceived(response: LynxMessage) {
super.onResponseReceived(response)
future.complete(response)
}

override fun onAckReceived(ack: LynxAck) {
super.onAckReceived(ack)
future.complete(ack)
}

override fun onNackReceived(nack: LynxNack) {
super.onNackReceived(nack)
future.complete(nack)
}

override fun getResponse(): CompletableFuture<LynxMessage> {
return future
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.outoftheboxrobotics.photoncore.HAL.I2C.Commands

import com.outoftheboxrobotics.photoncore.HAL.PhotonCommandBase
import com.qualcomm.hardware.lynx.LynxModuleIntf
import com.qualcomm.hardware.lynx.commands.LynxMessage
import com.qualcomm.hardware.lynx.commands.core.LynxI2cReadSingleByteCommand
import com.qualcomm.hardware.lynx.commands.standard.LynxAck
import com.qualcomm.hardware.lynx.commands.standard.LynxNack
import com.qualcomm.robotcore.hardware.I2cAddr
import java.util.concurrent.CompletableFuture

class PhotonLynxI2cReadSingleByteCommand : LynxI2cReadSingleByteCommand, PhotonCommandBase {
private var future: CompletableFuture<LynxMessage> = CompletableFuture();

constructor(module: LynxModuleIntf?) : super(module);

constructor(module: LynxModuleIntf?, busZ: Int, i2cAddr: I2cAddr?) : super(module, busZ, i2cAddr);

override fun onResponseReceived(response: LynxMessage) {
super.onResponseReceived(response)
future.complete(response)
}

override fun onAckReceived(ack: LynxAck) {
super.onAckReceived(ack)
future.complete(ack)
}

override fun onNackReceived(nack: LynxNack) {
super.onNackReceived(nack)
future.complete(nack)
}

override fun getResponse(): CompletableFuture<LynxMessage> {
return future
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.outoftheboxrobotics.photoncore.HAL.I2C.Commands

import com.outoftheboxrobotics.photoncore.HAL.PhotonCommandBase
import com.qualcomm.hardware.lynx.LynxModuleIntf
import com.qualcomm.hardware.lynx.commands.LynxMessage
import com.qualcomm.hardware.lynx.commands.core.LynxI2cWriteReadMultipleBytesCommand
import com.qualcomm.hardware.lynx.commands.standard.LynxAck
import com.qualcomm.hardware.lynx.commands.standard.LynxNack
import com.qualcomm.robotcore.hardware.I2cAddr
import java.util.concurrent.CompletableFuture

class PhotonLynxI2cWriteReadMultipleBytesCommand : LynxI2cWriteReadMultipleBytesCommand, PhotonCommandBase {
private val future: CompletableFuture<LynxMessage> = CompletableFuture();

constructor(module: LynxModuleIntf?) : super(module)

constructor(module: LynxModuleIntf?, busZ: Int, i2cAddr: I2cAddr?, i2cStartAddr: Int, cbToRead: Int) : super(module, busZ, i2cAddr, i2cStartAddr, cbToRead)

override fun onResponseReceived(response: LynxMessage) {
super.onResponseReceived(response)
future.complete(response)
}

override fun onAckReceived(ack: LynxAck) {
super.onAckReceived(ack)
future.complete(ack)
}

override fun onNackReceived(nack: LynxNack) {
super.onNackReceived(nack)
future.complete(nack)
}

override fun getResponse(): CompletableFuture<LynxMessage> {
return future
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.outoftheboxrobotics.photoncore.HAL.I2C.Commands

import com.outoftheboxrobotics.photoncore.HAL.PhotonCommandBase
import com.qualcomm.hardware.lynx.LynxModuleIntf
import com.qualcomm.hardware.lynx.commands.LynxMessage
import com.qualcomm.hardware.lynx.commands.core.LynxI2cWriteSingleByteCommand
import com.qualcomm.hardware.lynx.commands.standard.LynxAck
import com.qualcomm.hardware.lynx.commands.standard.LynxNack
import com.qualcomm.robotcore.hardware.I2cAddr
import java.util.concurrent.CompletableFuture

class PhotonLynxI2cWriteSingleByteCommand : LynxI2cWriteSingleByteCommand, PhotonCommandBase {
private val future: CompletableFuture<LynxMessage> = CompletableFuture();

constructor(module: LynxModuleIntf?) : super(module)

constructor(module: LynxModuleIntf?, busZ: Int, i2cAddr: I2cAddr?, bValue: Int) : super(module, busZ, i2cAddr, bValue)

override fun onResponseReceived(response: LynxMessage) {
super.onResponseReceived(response)
future.complete(response)
}

override fun onAckReceived(ack: LynxAck) {
super.onAckReceived(ack)
future.complete(ack)
}

override fun onNackReceived(nack: LynxNack) {
super.onNackReceived(nack)
future.complete(nack)
}

override fun getResponse(): CompletableFuture<LynxMessage> {
return future
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.outoftheboxrobotics.photoncore.HAL.I2C.Commands

import com.outoftheboxrobotics.photoncore.HAL.PhotonCommandBase
import com.qualcomm.hardware.lynx.LynxModuleIntf
import com.qualcomm.hardware.lynx.commands.LynxMessage
import com.qualcomm.hardware.lynx.commands.core.LynxI2cWriteStatusQueryCommand
import com.qualcomm.hardware.lynx.commands.standard.LynxAck
import com.qualcomm.hardware.lynx.commands.standard.LynxNack
import java.util.concurrent.CompletableFuture

class PhotonLynxI2cWriteStatusQueryCommand : LynxI2cWriteStatusQueryCommand, PhotonCommandBase {
private val future: CompletableFuture<LynxMessage> = CompletableFuture();

constructor(module: LynxModuleIntf?) : super(module)
constructor(module: LynxModuleIntf?, busZ: Int) : super(module, busZ)

override fun onResponseReceived(response: LynxMessage) {
super.onResponseReceived(response)
future.complete(response)
}

override fun onAckReceived(ack: LynxAck) {
super.onAckReceived(ack)
future.complete(ack)
}

override fun onNackReceived(nack: LynxNack) {
super.onNackReceived(nack)
future.complete(nack)
}

override fun getResponse(): CompletableFuture<LynxMessage> {
return future
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.outoftheboxrobotics.photoncore.HAL.I2C

import com.qualcomm.hardware.bosch.BHI260IMU
import com.qualcomm.robotcore.hardware.I2cDeviceSynchSimple


class PhotonBHI260IMU(i2cDeviceSynchSimple: I2cDeviceSynchSimple?, deviceClientIsOwned: Boolean) : BHI260IMU(i2cDeviceSynchSimple, deviceClientIsOwned)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.outoftheboxrobotics.photoncore.HAL.I2C

import com.qualcomm.hardware.lynx.LynxEmbeddedIMU
import com.qualcomm.robotcore.hardware.I2cDeviceSynch

class PhotonBNO055IMU(deviceClient: I2cDeviceSynch?, deviceClientIsOwned: Boolean) : LynxEmbeddedIMU(deviceClient, deviceClientIsOwned)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.outoftheboxrobotics.photoncore.HAL.I2C

import com.qualcomm.hardware.lynx.LynxEmbeddedBNO055IMUNew
import com.qualcomm.robotcore.hardware.I2cDeviceSynchSimple

class PhotonBNO055IMUNew(deviceClient: I2cDeviceSynchSimple?, deviceClientIsOwned: Boolean) : LynxEmbeddedBNO055IMUNew(deviceClient, deviceClientIsOwned)
Loading