mirror of
https://github.com/isometimes/rpi4-osdev
synced 2024-11-21 17:50:40 +00:00
Added simple iOS controller to emulate 2-button mouse, and examples/wgt23.c
This commit is contained in:
parent
a748a257ab
commit
f20210526b
23 changed files with 987 additions and 6 deletions
|
@ -0,0 +1,349 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 50;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
AC9F7547231E6ADA00387AF8 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC9F7546231E6ADA00387AF8 /* AppDelegate.swift */; };
|
||||
AC9F7549231E6ADA00387AF8 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC9F7548231E6ADA00387AF8 /* ViewController.swift */; };
|
||||
AC9F754C231E6ADA00387AF8 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AC9F754A231E6ADA00387AF8 /* Main.storyboard */; };
|
||||
AC9F754E231E6AE300387AF8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AC9F754D231E6AE300387AF8 /* Assets.xcassets */; };
|
||||
AC9F7551231E6AE300387AF8 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AC9F754F231E6AE300387AF8 /* LaunchScreen.storyboard */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
AC9F7543231E6ADA00387AF8 /* rpi4-osdev-ioscontrol.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "rpi4-osdev-ioscontrol.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
AC9F7546231E6ADA00387AF8 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
AC9F7548231E6ADA00387AF8 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||
AC9F754B231E6ADA00387AF8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
AC9F754D231E6AE300387AF8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
AC9F7550231E6AE300387AF8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
AC9F7552231E6AE300387AF8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
AC9F7540231E6ADA00387AF8 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
AC9F753A231E6AD900387AF8 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AC9F7545231E6ADA00387AF8 /* rpi4-osdev-ioscontrol */,
|
||||
AC9F7544231E6ADA00387AF8 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AC9F7544231E6ADA00387AF8 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AC9F7543231E6ADA00387AF8 /* rpi4-osdev-ioscontrol.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AC9F7545231E6ADA00387AF8 /* rpi4-osdev-ioscontrol */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AC9F7546231E6ADA00387AF8 /* AppDelegate.swift */,
|
||||
AC9F7548231E6ADA00387AF8 /* ViewController.swift */,
|
||||
AC9F754A231E6ADA00387AF8 /* Main.storyboard */,
|
||||
AC9F754D231E6AE300387AF8 /* Assets.xcassets */,
|
||||
AC9F754F231E6AE300387AF8 /* LaunchScreen.storyboard */,
|
||||
AC9F7552231E6AE300387AF8 /* Info.plist */,
|
||||
);
|
||||
path = "rpi4-osdev-ioscontrol";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
AC9F7542231E6ADA00387AF8 /* rpi4-osdev-ioscontrol */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = AC9F7555231E6AE300387AF8 /* Build configuration list for PBXNativeTarget "rpi4-osdev-ioscontrol" */;
|
||||
buildPhases = (
|
||||
AC9F753F231E6ADA00387AF8 /* Sources */,
|
||||
AC9F7540231E6ADA00387AF8 /* Frameworks */,
|
||||
AC9F7541231E6ADA00387AF8 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "rpi4-osdev-ioscontrol";
|
||||
productName = BLEPeripheralApp;
|
||||
productReference = AC9F7543231E6ADA00387AF8 /* rpi4-osdev-ioscontrol.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
AC9F753B231E6AD900387AF8 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 1020;
|
||||
LastUpgradeCheck = 1240;
|
||||
ORGANIZATIONNAME = isometimes;
|
||||
TargetAttributes = {
|
||||
AC9F7542231E6ADA00387AF8 = {
|
||||
CreatedOnToolsVersion = 10.2.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = AC9F753E231E6AD900387AF8 /* Build configuration list for PBXProject "rpi4-osdev-ioscontrol" */;
|
||||
compatibilityVersion = "Xcode 9.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = AC9F753A231E6AD900387AF8;
|
||||
productRefGroup = AC9F7544231E6ADA00387AF8 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
AC9F7542231E6ADA00387AF8 /* rpi4-osdev-ioscontrol */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
AC9F7541231E6ADA00387AF8 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AC9F7551231E6AE300387AF8 /* LaunchScreen.storyboard in Resources */,
|
||||
AC9F754E231E6AE300387AF8 /* Assets.xcassets in Resources */,
|
||||
AC9F754C231E6ADA00387AF8 /* Main.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
AC9F753F231E6ADA00387AF8 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AC9F7549231E6ADA00387AF8 /* ViewController.swift in Sources */,
|
||||
AC9F7547231E6ADA00387AF8 /* AppDelegate.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
AC9F754A231E6ADA00387AF8 /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
AC9F754B231E6ADA00387AF8 /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AC9F754F231E6AE300387AF8 /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
AC9F7550231E6AE300387AF8 /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
AC9F7553231E6AE300387AF8 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.2;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
AC9F7554231E6AE300387AF8 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.2;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
AC9F7556231E6AE300387AF8 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = 7L2BE98W4U;
|
||||
INFOPLIST_FILE = "rpi4-osdev-ioscontrol/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.AwayPlays.BLEPeripheralApp;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
AC9F7557231E6AE300387AF8 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = 7L2BE98W4U;
|
||||
INFOPLIST_FILE = "rpi4-osdev-ioscontrol/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.AwayPlays.BLEPeripheralApp;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
AC9F753E231E6AD900387AF8 /* Build configuration list for PBXProject "rpi4-osdev-ioscontrol" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
AC9F7553231E6AE300387AF8 /* Debug */,
|
||||
AC9F7554231E6AE300387AF8 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
AC9F7555231E6AE300387AF8 /* Build configuration list for PBXNativeTarget "rpi4-osdev-ioscontrol" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
AC9F7556231E6AE300387AF8 /* Debug */,
|
||||
AC9F7557231E6AE300387AF8 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = AC9F753B231E6AD900387AF8 /* Project object */;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:/Users/agb/Desktop/BLEPeripheral/BLEPeripheralApp/rpi4-osdev-ioscontrol.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
|
@ -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>
|
|
@ -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>PreviewsEnabled</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,18 @@
|
|||
<?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>BuildLocationStyle</key>
|
||||
<string>UseAppPreferences</string>
|
||||
<key>CustomBuildLocationType</key>
|
||||
<string>RelativeToDerivedData</string>
|
||||
<key>DerivedDataLocationStyle</key>
|
||||
<string>Default</string>
|
||||
<key>IssueFilterStyle</key>
|
||||
<string>ShowActiveSchemeOnly</string>
|
||||
<key>LiveSourceIssuesEnabled</key>
|
||||
<true/>
|
||||
<key>ShowSharedSchemesAutomaticallyEnabled</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Bucket
|
||||
type = "1"
|
||||
version = "2.0">
|
||||
</Bucket>
|
|
@ -0,0 +1,14 @@
|
|||
<?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>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>BLEPeripheralApp.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,19 @@
|
|||
<?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>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>BLEPeripheralApp.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>rpi4-osdev-ioscontrol.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,37 @@
|
|||
//
|
||||
// AppDelegate.swift
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
var window: UIWindow?
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
// Override point for customization after application launch.
|
||||
return true
|
||||
}
|
||||
|
||||
func applicationWillResignActive(_ application: UIApplication) {
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
func applicationDidEnterBackground(_ application: UIApplication) {
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
}
|
||||
|
||||
func applicationWillEnterForeground(_ application: UIApplication) {
|
||||
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
|
||||
}
|
||||
|
||||
func applicationDidBecomeActive(_ application: UIApplication) {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
func applicationWillTerminate(_ application: UIApplication) {
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "83.5x83.5",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ios-marketing",
|
||||
"size" : "1024x1024",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="rpi4-osdev" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gYQ-qY-dBB">
|
||||
<rect key="frame" x="92.5" y="420.5" width="229" height="55"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="46"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="gYQ-qY-dBB" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="BvU-Yo-5Nr"/>
|
||||
<constraint firstItem="gYQ-qY-dBB" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="bwr-gc-khw"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="52.173913043478265" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
|
@ -0,0 +1,84 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="BLEPeripheralApp" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="BLE Raspberry Pi Controller" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Nvs-RN-f05">
|
||||
<rect key="frame" x="59" y="62" width="256" height="35"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.58823529409999997" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gtS-Ti-qhi">
|
||||
<rect key="frame" x="37" y="105" width="300" height="42"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="20"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="MOVE" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CWa-Ey-a10">
|
||||
<rect key="frame" x="16" y="386" width="343" height="400"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<gestureRecognizers/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="30"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<connections>
|
||||
<outletCollection property="gestureRecognizers" destination="GjC-JK-4bv" appends="YES" id="Ymm-cd-Mow"/>
|
||||
</connections>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Vf2-Dd-ZFQ">
|
||||
<rect key="frame" x="16" y="155" width="343" height="223"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" systemColor="systemRedColor"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="30"/>
|
||||
<state key="normal" title="FIRE">
|
||||
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="onFireDown" destination="BYZ-38-t0r" eventType="touchDown" id="N9D-xx-NDo"/>
|
||||
<action selector="onFireUp" destination="BYZ-38-t0r" eventType="touchUpInside" id="Br9-ZB-fvf"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<gestureRecognizers/>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="fireButton" destination="Vf2-Dd-ZFQ" id="W1S-Vp-53a"/>
|
||||
<outlet property="messageLabel" destination="gtS-Ti-qhi" id="8xj-Ng-Gnm"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
<panGestureRecognizer cancelsTouchesInView="NO" delaysTouchesEnded="NO" minimumNumberOfTouches="1" id="GjC-JK-4bv">
|
||||
<connections>
|
||||
<action selector="handlePan:" destination="BYZ-38-t0r" id="yHY-we-sIy"/>
|
||||
</connections>
|
||||
</panGestureRecognizer>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="14.492753623188406" y="97.098214285714278"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<systemColor name="systemRedColor">
|
||||
<color red="1" green="0.23137254901960785" blue="0.18823529411764706" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
47
part12-wgt/controller-ios/rpi4-osdev-ioscontrol/Info.plist
Normal file
47
part12-wgt/controller-ios/rpi4-osdev-ioscontrol/Info.plist
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?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>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>NSBluetoothAlwaysUsageDescription</key>
|
||||
<string>Sending control information to the Raspberry Pi 4</string>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,101 @@
|
|||
//
|
||||
// ViewController.swift
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import CoreBluetooth
|
||||
|
||||
class ViewController: UIViewController,CBPeripheralManagerDelegate {
|
||||
@IBOutlet weak var messageLabel: UILabel!
|
||||
@IBOutlet weak var fireButton: UIButton!
|
||||
|
||||
private var service: CBUUID!
|
||||
private var peripheralManager : CBPeripheralManager!
|
||||
let myCharacteristic1 = CBMutableCharacteristic(type: CBUUID(string: "EC0E"), properties: [.notify, .write, .read], value: nil, permissions: [.readable, .writeable])
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
peripheralManager = CBPeripheralManager(delegate: self, queue: nil)
|
||||
}
|
||||
|
||||
@IBAction func onFireUp() {
|
||||
let fireup : [UInt8] = [2, 1]
|
||||
|
||||
messageLabel.text = "Fired"
|
||||
|
||||
var fireupData = Data()
|
||||
fireupData.append(contentsOf: fireup)
|
||||
|
||||
peripheralManager.updateValue(fireupData, for: myCharacteristic1, onSubscribedCentrals: nil)
|
||||
}
|
||||
|
||||
@IBAction func onFireDown() {
|
||||
let firedown : [UInt8] = [1, 1]
|
||||
|
||||
messageLabel.text = "Firing"
|
||||
|
||||
var firedownData = Data()
|
||||
firedownData.append(contentsOf: firedown)
|
||||
|
||||
peripheralManager.updateValue(firedownData, for: myCharacteristic1, onSubscribedCentrals: nil)
|
||||
}
|
||||
|
||||
@IBAction func handlePan(_ gesture: UIPanGestureRecognizer) {
|
||||
let screenSize: CGRect = UIScreen.main.bounds
|
||||
let tap = gesture.location(in: view)
|
||||
|
||||
let maxx = screenSize.width
|
||||
let maxy = screenSize.height
|
||||
|
||||
let realx = UInt16(((tap.x / maxx) * 320).rounded())
|
||||
let realy = UInt16(((tap.y / maxy) * 200).rounded())
|
||||
|
||||
let coords : [UInt8] = [UInt8(realx & 0x00ff), UInt8(realx >> 8 & 0x00ff), UInt8(realy & 0x00ff), UInt8(realy >> 8 & 0x00ff)]
|
||||
|
||||
var coordData = Data()
|
||||
coordData.append(contentsOf: coords)
|
||||
|
||||
peripheralManager.updateValue(coordData, for: myCharacteristic1, onSubscribedCentrals: nil)
|
||||
}
|
||||
|
||||
func peripheralManagerDidUpdateState(_ peripheral: CBPeripheralManager) {
|
||||
switch peripheral.state {
|
||||
case .unknown:
|
||||
print("Bluetooth Device is UNKNOWN")
|
||||
case .unsupported:
|
||||
print("Bluetooth Device is UNSUPPORTED")
|
||||
case .unauthorized:
|
||||
print("Bluetooth Device is UNAUTHORIZED")
|
||||
case .resetting:
|
||||
print("Bluetooth Device is RESETTING")
|
||||
case .poweredOff:
|
||||
print("Bluetooth Device is POWERED OFF")
|
||||
case .poweredOn:
|
||||
print("Bluetooth Device is POWERED ON")
|
||||
addServices()
|
||||
@unknown default:
|
||||
fatalError()
|
||||
}
|
||||
}
|
||||
|
||||
func addServices() {
|
||||
service = CBUUID(string: "EC00")
|
||||
let myService = CBMutableService(type: service, primary: true)
|
||||
myService.characteristics = [myCharacteristic1]
|
||||
peripheralManager.add(myService)
|
||||
startAdvertising()
|
||||
}
|
||||
|
||||
func startAdvertising() {
|
||||
messageLabel.text = "Waiting for subscriber"
|
||||
peripheralManager.startAdvertising([CBAdvertisementDataLocalNameKey : "echo", CBAdvertisementDataServiceUUIDsKey : [service]])
|
||||
}
|
||||
|
||||
func peripheralManager(_ peripheral: CBPeripheralManager, central: CBCentral, didSubscribeTo characteristic: CBCharacteristic) {
|
||||
messageLabel.text = "Sub \(central.identifier.uuidString)"
|
||||
}
|
||||
|
||||
func peripheralManager(_ peripheral: CBPeripheralManager, central: CBCentral, didUnsubscribeFrom characteristic: CBCharacteristic) {
|
||||
messageLabel.text = "Unsub \(central.identifier.uuidString)"
|
||||
}
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
#define IOS_CONTROL
|
||||
|
||||
#include "../include/io.h"
|
||||
|
||||
// UART0
|
||||
|
@ -232,7 +234,11 @@ void sendACLsubscribe(unsigned int handle)
|
|||
bt_writeByte(lo(channel));
|
||||
bt_writeByte(hi(channel));
|
||||
|
||||
#ifdef IOS_CONTROL
|
||||
volatile unsigned char command[5] = { 0x12, 0x3d, 0x00, 0x01, 0x00 };
|
||||
#else
|
||||
volatile unsigned char command[5] = { 0x12, 0x2b, 0x00, 0x01, 0x00 };
|
||||
#endif
|
||||
|
||||
unsigned int c=0;
|
||||
while (c++<data_length) bt_writeByte(command[c-1]);
|
||||
|
@ -353,7 +359,9 @@ void connect(unsigned char *addr)
|
|||
|
||||
command[0] = lo(p);
|
||||
command[2] = lo(q);
|
||||
#ifdef IOS_CONTROL
|
||||
command[5] = 1; // Necessary for iOS connection
|
||||
#endif
|
||||
command[6] = *(addr+5);
|
||||
command[7] = *(addr+4);
|
||||
command[8] = *(addr+3);
|
||||
|
|
121
part12-wgt/samples/wgt23.c
Normal file
121
part12-wgt/samples/wgt23.c
Normal file
|
@ -0,0 +1,121 @@
|
|||
#include "include/wgtspr.h"
|
||||
#include "include/mem.h"
|
||||
#include "include/multicore.h"
|
||||
|
||||
// ######## REQUIRED FUNCTIONS ########
|
||||
|
||||
unsigned long state0 = 1000;
|
||||
unsigned long state1 = 2000;
|
||||
|
||||
unsigned long rand(void)
|
||||
{
|
||||
unsigned long s1 = state0;
|
||||
unsigned long s0 = state1;
|
||||
|
||||
state0 = s0;
|
||||
s1 ^= s1 << 23;
|
||||
s1 ^= s1 >> 17;
|
||||
s1 ^= s0;
|
||||
s1 ^= s0 >> 26;
|
||||
state1 = s1;
|
||||
|
||||
return state0 + state1;
|
||||
}
|
||||
|
||||
// ######## STUB FUNCTIONS ########
|
||||
|
||||
unsigned int kb = 0;
|
||||
|
||||
unsigned int kbhit(void) {
|
||||
kb++;
|
||||
return kb / 500;
|
||||
}
|
||||
|
||||
void getch(void) {
|
||||
wait_msec(0x500000);
|
||||
kb = 0;
|
||||
}
|
||||
|
||||
// ######## WGT EXAMPLES ########
|
||||
|
||||
#define SPRITES_IN_FILE 20 /* We're loading 20 sprites */
|
||||
|
||||
int i; /* Generic counter */
|
||||
color palette[256]; /* Our palette */
|
||||
block sprites[SPRITES_IN_FILE+1]; /* Pointers to sprites */
|
||||
int quit; /* if quit !=0, program quits */
|
||||
|
||||
void looper (void); /* Function to move cursor */
|
||||
|
||||
void wgt23()
|
||||
{
|
||||
set_clock_rate(get_max_clock());
|
||||
mem_init();
|
||||
vga256 ();
|
||||
|
||||
start_core2(minit); // Start the comms engine (core 2)
|
||||
while (!comms_up); // Wait for comms up
|
||||
|
||||
/* Load our sprites from the file. Palette is loaded too */
|
||||
extern unsigned char _binary_bin_mouse_spr_start[];
|
||||
wloadsprites (palette, &_binary_bin_mouse_spr_start[0], sprites, 0, SPRITES_IN_FILE);
|
||||
wsetpalette (0, 255, palette);
|
||||
|
||||
/* Initialize the WGT sprite system */
|
||||
initialize_sprites (sprites);
|
||||
maxsprite = 1; /* number of sprites on */
|
||||
|
||||
for (i = 0; i < 200; i++) /* draw a background */
|
||||
{
|
||||
wsetcolor (vgapal[i]);
|
||||
wline (0, i, 159, i);
|
||||
wline (160, 199 - i, 319, 199 - i);
|
||||
}
|
||||
|
||||
wcopyscreen (0, 0, 319, 199, NULL, 0, 0, backgroundscreen);
|
||||
wcopyscreen (0, 0, 319, 199, NULL, 0, 0, spritescreen);
|
||||
/* when using sprites, whatever is on the visual page must be on
|
||||
spritescreen too! */
|
||||
|
||||
/* Also, you must make sure you turn a sprite on AFTER you draw
|
||||
the background or it will leave a black spot where the sprite
|
||||
is first shown. */
|
||||
wsetscreen (spritescreen);
|
||||
spriteon (1, 160, 100, 1); /* turn on any sprites */
|
||||
|
||||
animate (1, "(1,30)(2,30)(3,30)(4,30)(3,30)(2,30)R");
|
||||
animon (1);
|
||||
/* animate the sprite */
|
||||
|
||||
do {
|
||||
looper (); /* Position cursor where mouse is */
|
||||
} while (!quit);
|
||||
|
||||
spriteoff (1); /* turn off sprites */
|
||||
/* To be safe, turn off all sprites before ending your program.
|
||||
This will free any memory used from them. */
|
||||
|
||||
deinitialize_sprites ();
|
||||
mdeinit (); /* Deinitialize the mouse handler */
|
||||
wfreesprites (sprites, 0, SPRITES_IN_FILE); /* free memory */
|
||||
}
|
||||
|
||||
void looper (void)
|
||||
{
|
||||
erase_sprites(); /* clear the sprites */
|
||||
|
||||
s[1].x = mx; /* any direct sprite movements must be placed */
|
||||
s[1].y = my; /* between erasespr and drawspr */
|
||||
/* This will place sprite number 1 where the mouse cursor is. */
|
||||
|
||||
draw_sprites (1); /* draw them back on */
|
||||
wait_msec(0x3E9F);
|
||||
if (but)
|
||||
quit = 1;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
wgt23();
|
||||
while (1);
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
#include "include/wgtspr.h"
|
||||
#include "include/mem.h"
|
||||
#include "include/multicore.h"
|
||||
|
||||
// ######## REQUIRED FUNCTIONS ########
|
||||
|
||||
|
@ -52,9 +53,14 @@ void wgt25()
|
|||
set_clock_rate(get_max_clock());
|
||||
mem_init();
|
||||
vga256 ();
|
||||
|
||||
start_core2(minit); // Start the comms engine (core 2)
|
||||
while (!comms_up); // Wait for comms up
|
||||
|
||||
extern unsigned char _binary_bin_mouse_spr_start[];
|
||||
wloadsprites (palette, &_binary_bin_mouse_spr_start[0], sprites, 0, 1000);
|
||||
wsetpalette (0, 255, palette);
|
||||
|
||||
initialize_sprites (sprites); /* initialize them */
|
||||
maxsprite = 4; /* number of sprites on */
|
||||
|
||||
|
@ -98,7 +104,7 @@ void wgt25()
|
|||
|
||||
do {
|
||||
looper ();
|
||||
} while (1);
|
||||
} while (!quit);
|
||||
|
||||
spriteoff (1); /* turn off sprite */
|
||||
spriteoff (2); /* turn off sprite */
|
||||
|
@ -112,13 +118,13 @@ void wgt25()
|
|||
|
||||
void looper (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
erase_sprites (); /* clear the sprites */
|
||||
|
||||
/*
|
||||
if (kbhit ())
|
||||
if (but)
|
||||
{
|
||||
c = toupper (getch ());
|
||||
if (c == 'Q')
|
||||
if (but == 2)
|
||||
quit = 1;
|
||||
|
||||
sprite_toggle = !sprite_toggle;
|
||||
|
@ -136,8 +142,8 @@ void looper (void)
|
|||
moveyon (i);
|
||||
animon (i);
|
||||
}
|
||||
noclick();
|
||||
}
|
||||
*/
|
||||
|
||||
draw_sprites (1); /* draw them back on */
|
||||
/* This loop is required to update sprite
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#define IOS_CONTROL
|
||||
|
||||
#include "../include/wgt.h"
|
||||
#include "../include/multicore.h"
|
||||
#include "../include/io.h"
|
||||
|
@ -173,7 +175,11 @@ void acl_poll()
|
|||
unsigned char opcode = data[4];
|
||||
|
||||
if (thandle == connection_handle && opcode == 0x1b) {
|
||||
#ifdef IOS_CONTROL
|
||||
if (channel == 4 && data[5] == 0x3b && data[6] == 0x00) {
|
||||
#else
|
||||
if (channel == 4 && data[5] == 0x2a && data[6] == 0x00) {
|
||||
#endif
|
||||
if (length == 7) msetxy(data[7] | (data[8] << 8), data[9] | (data[10] << 8));
|
||||
if (length == 5) msetbut(data[7], data[8]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue