-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
73 changed files
with
9,776 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# This workflow will build a Swift project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift | ||
|
||
name: Swift | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: macos-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build | ||
run: xcodebuild test -scheme ShimmerBluetoothTests |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Xcode | ||
# | ||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore | ||
|
||
## User settings | ||
xcuserdata/ | ||
|
||
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) | ||
*.xcscmblueprint | ||
*.xccheckout | ||
|
||
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) | ||
build/ | ||
DerivedData/ | ||
*.moved-aside | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
|
||
## Obj-C/Swift specific | ||
*.hmap | ||
|
||
## App packaging | ||
*.ipa | ||
*.dSYM.zip | ||
*.dSYM | ||
|
||
## Playgrounds | ||
timeline.xctimeline | ||
playground.xcworkspace | ||
|
||
# Swift Package Manager | ||
# | ||
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. | ||
# Packages/ | ||
# Package.pins | ||
# Package.resolved | ||
# *.xcodeproj | ||
# | ||
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata | ||
# hence it is not needed unless you have added a package configuration file to your project | ||
# .swiftpm | ||
|
||
.build/ | ||
|
||
# CocoaPods | ||
# | ||
# We recommend against adding the Pods directory to your .gitignore. However | ||
# you should judge for yourself, the pros and cons are mentioned at: | ||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control | ||
# | ||
# Pods/ | ||
# | ||
# Add this line if you want to avoid checking in source code from the Xcode workspace | ||
# *.xcworkspace | ||
|
||
# Carthage | ||
# | ||
# Add this line if you want to avoid checking in source code from Carthage dependencies. | ||
# Carthage/Checkouts | ||
|
||
Carthage/Build/ | ||
|
||
# Accio dependency management | ||
Dependencies/ | ||
.accio/ | ||
|
||
# fastlane | ||
# | ||
# It is recommended to not store the screenshots in the git repo. | ||
# Instead, use fastlane to re-generate the screenshots whenever they are needed. | ||
# For more information about the recommended setup visit: | ||
# https://docs.fastlane.tools/best-practices/source-control/#source-control | ||
|
||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots/**/*.png | ||
fastlane/test_output | ||
|
||
# Code Injection | ||
# | ||
# After new code Injection tools there's a generated folder /iOSInjectionProject | ||
# https://github.com/johnno1962/injectionforxcode | ||
|
||
iOSInjectionProject/ | ||
.DS_Store |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# SwiftAPI | ||
# ShimmerSwiftAPI |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
5 changes: 5 additions & 0 deletions
5
Shimmer.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict/> | ||
</plist> |
625 changes: 625 additions & 0 deletions
625
ShimmerBluetooth/ShimmerBluetooth.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
ShimmerBluetooth/ShimmerBluetooth.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...ooth/ShimmerBluetooth.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
// | ||
// ADCSensor.swift | ||
// ShimmerBluetooth | ||
// | ||
// Created by Shimmer Engineering on 22/11/2023. | ||
// | ||
|
||
import Foundation | ||
|
||
public class ADCSensor: Sensor, SensorProcessing { | ||
|
||
public var packetIndex:Int = -1 | ||
public enum ADCType { | ||
case Shimmer3_A13 | ||
case Shimmer3_A12 | ||
case Shimmer3_A1 | ||
case Shimmer3_A6 | ||
case Shimmer3_A7 | ||
case Shimmer3_A15 | ||
|
||
var description: String { | ||
switch self { | ||
case .Shimmer3_A13: | ||
return "Internal ADC A13" | ||
case .Shimmer3_A12: | ||
return "Internal ADC A12" | ||
case .Shimmer3_A1: | ||
return "Internal ADC A1" | ||
case .Shimmer3_A7: | ||
return "External ADC A7" | ||
case .Shimmer3_A6: | ||
return "External ADC A6" | ||
case .Shimmer3_A15: | ||
return "External ADC A15" | ||
} | ||
} | ||
|
||
// Add any other properties or methods you might need here | ||
} | ||
|
||
public override init(){ | ||
super.init() | ||
} | ||
|
||
public init(adc: ADCType) { | ||
super.init() | ||
self.internalADCType = adc | ||
self.ojcName = adc.description | ||
} | ||
|
||
private var internalADCType:ADCType = ADCType.Shimmer3_A13; | ||
private var ojcName = "Internal ADC A13" | ||
|
||
public func processData(sensorPacket: [UInt8], objectCluster: ObjectCluster) -> ObjectCluster { | ||
let x = Array(sensorPacket[packetIndex..<packetIndex+2]) | ||
let rawData = Double(ShimmerUtilities.parseSensorData(sensorData: x, dataType: SensorDataType.u12)!) | ||
if (calibrationEnabled){ | ||
let calData = calibrateU12AdcValue(rawData, 0, 3, 1); | ||
objectCluster.addData(sensorName: ojcName, formatName: SensorFormats.Calibrated.rawValue, unitName: SensorUnits.milliVolts.rawValue, value: calData) | ||
} | ||
objectCluster.addData(sensorName: ojcName, formatName: SensorFormats.Raw.rawValue, unitName: SensorUnits.noUnit.rawValue, value: rawData) | ||
return objectCluster | ||
} | ||
|
||
public func setInfoMem(infomem: [UInt8]) { | ||
|
||
if (self.internalADCType==ADCType.Shimmer3_A13){ | ||
var enabled = Int(infomem[ConfigByteLayoutShimmer3.idxSensors1]) & 1 | ||
if (enabled > 0){ | ||
sensorEnabled = true | ||
} else { | ||
sensorEnabled = false | ||
} | ||
} else if (self.internalADCType==ADCType.Shimmer3_A12){ | ||
var enabled = Int(infomem[ConfigByteLayoutShimmer3.idxSensors1]) & 2 | ||
if (enabled > 0){ | ||
sensorEnabled = true | ||
} else { | ||
sensorEnabled = false | ||
} | ||
} else if (self.internalADCType==ADCType.Shimmer3_A7){ | ||
var enabled = Int(infomem[ConfigByteLayoutShimmer3.idxSensors0]) & 2 | ||
if (enabled > 0){ | ||
sensorEnabled = true | ||
} else { | ||
sensorEnabled = false | ||
} | ||
} else if (self.internalADCType==ADCType.Shimmer3_A6){ | ||
var enabled = Int(infomem[ConfigByteLayoutShimmer3.idxSensors0]) & 1 | ||
if (enabled > 0){ | ||
sensorEnabled = true | ||
} else { | ||
sensorEnabled = false | ||
} | ||
} else if (self.internalADCType==ADCType.Shimmer3_A1){ | ||
var enabled = Int(infomem[ConfigByteLayoutShimmer3.idxSensors1]) & 4 | ||
if (enabled > 0){ | ||
sensorEnabled = true | ||
} else { | ||
sensorEnabled = false | ||
} | ||
} else if (self.internalADCType==ADCType.Shimmer3_A15){ | ||
var enabled = Int(infomem[ConfigByteLayoutShimmer3.idxSensors1]) & 8 | ||
if (enabled > 0){ | ||
sensorEnabled = true | ||
} else { | ||
sensorEnabled = false | ||
} | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.