diff --git a/Konashi.xcworkspace/contents.xcworkspacedata b/Konashi.xcworkspace/contents.xcworkspacedata index eb7ee09..0a2c652 100644 --- a/Konashi.xcworkspace/contents.xcworkspacedata +++ b/Konashi.xcworkspace/contents.xcworkspacedata @@ -37,6 +37,9 @@ + + diff --git a/samples/SPISample/SPISample.xcodeproj/project.pbxproj b/samples/SPISample/SPISample.xcodeproj/project.pbxproj new file mode 100644 index 0000000..fb13b47 --- /dev/null +++ b/samples/SPISample/SPISample.xcodeproj/project.pbxproj @@ -0,0 +1,342 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + E98783DF1BDCEA5900EA9A0D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E98783DE1BDCEA5900EA9A0D /* main.m */; }; + E98783E21BDCEA5900EA9A0D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E98783E11BDCEA5900EA9A0D /* AppDelegate.m */; }; + E98783E51BDCEA5900EA9A0D /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E98783E41BDCEA5900EA9A0D /* ViewController.m */; }; + E98783E81BDCEA5900EA9A0D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E98783E61BDCEA5900EA9A0D /* Main.storyboard */; }; + E98783EA1BDCEA5900EA9A0D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E98783E91BDCEA5900EA9A0D /* Assets.xcassets */; }; + E98783ED1BDCEA5900EA9A0D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E98783EB1BDCEA5900EA9A0D /* LaunchScreen.storyboard */; }; + E98783F51BDCF06B00EA9A0D /* libKonashi.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E98783F41BDCF06B00EA9A0D /* libKonashi.a */; }; + E98783F81BDCF09100EA9A0D /* CoreBluetooth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E98783F71BDCF09100EA9A0D /* CoreBluetooth.framework */; }; + E98783FA1BDCF09800EA9A0D /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E98783F91BDCF09800EA9A0D /* JavaScriptCore.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + E98783DA1BDCEA5900EA9A0D /* SPISample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SPISample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + E98783DE1BDCEA5900EA9A0D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + E98783E01BDCEA5900EA9A0D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + E98783E11BDCEA5900EA9A0D /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + E98783E31BDCEA5900EA9A0D /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + E98783E41BDCEA5900EA9A0D /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + E98783E71BDCEA5900EA9A0D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + E98783E91BDCEA5900EA9A0D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + E98783EC1BDCEA5900EA9A0D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + E98783EE1BDCEA5900EA9A0D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E98783F41BDCF06B00EA9A0D /* libKonashi.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libKonashi.a; path = "../../../../../../../../Library/Developer/Xcode/DerivedData/Konashi-caxaibhpznpjxobbnixbnzoljfrb/Build/Products/Debug-iphoneos/libKonashi.a"; sourceTree = ""; }; + E98783F71BDCF09100EA9A0D /* CoreBluetooth.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreBluetooth.framework; path = System/Library/Frameworks/CoreBluetooth.framework; sourceTree = SDKROOT; }; + E98783F91BDCF09800EA9A0D /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + E98783D71BDCEA5900EA9A0D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + E98783FA1BDCF09800EA9A0D /* JavaScriptCore.framework in Frameworks */, + E98783F81BDCF09100EA9A0D /* CoreBluetooth.framework in Frameworks */, + E98783F51BDCF06B00EA9A0D /* libKonashi.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + E98783D11BDCEA5900EA9A0D = { + isa = PBXGroup; + children = ( + E98783DC1BDCEA5900EA9A0D /* SPISample */, + E98783F61BDCF07B00EA9A0D /* Frameworks */, + E98783DB1BDCEA5900EA9A0D /* Products */, + ); + sourceTree = ""; + }; + E98783DB1BDCEA5900EA9A0D /* Products */ = { + isa = PBXGroup; + children = ( + E98783DA1BDCEA5900EA9A0D /* SPISample.app */, + ); + name = Products; + sourceTree = ""; + }; + E98783DC1BDCEA5900EA9A0D /* SPISample */ = { + isa = PBXGroup; + children = ( + E98783E01BDCEA5900EA9A0D /* AppDelegate.h */, + E98783E11BDCEA5900EA9A0D /* AppDelegate.m */, + E98783E31BDCEA5900EA9A0D /* ViewController.h */, + E98783E41BDCEA5900EA9A0D /* ViewController.m */, + E98783E61BDCEA5900EA9A0D /* Main.storyboard */, + E98783E91BDCEA5900EA9A0D /* Assets.xcassets */, + E98783EB1BDCEA5900EA9A0D /* LaunchScreen.storyboard */, + E98783EE1BDCEA5900EA9A0D /* Info.plist */, + E98783DD1BDCEA5900EA9A0D /* Supporting Files */, + ); + path = SPISample; + sourceTree = ""; + }; + E98783DD1BDCEA5900EA9A0D /* Supporting Files */ = { + isa = PBXGroup; + children = ( + E98783DE1BDCEA5900EA9A0D /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + E98783F61BDCF07B00EA9A0D /* Frameworks */ = { + isa = PBXGroup; + children = ( + E98783F91BDCF09800EA9A0D /* JavaScriptCore.framework */, + E98783F71BDCF09100EA9A0D /* CoreBluetooth.framework */, + E98783F41BDCF06B00EA9A0D /* libKonashi.a */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + E98783D91BDCEA5900EA9A0D /* SPISample */ = { + isa = PBXNativeTarget; + buildConfigurationList = E98783F11BDCEA5900EA9A0D /* Build configuration list for PBXNativeTarget "SPISample" */; + buildPhases = ( + E98783D61BDCEA5900EA9A0D /* Sources */, + E98783D71BDCEA5900EA9A0D /* Frameworks */, + E98783D81BDCEA5900EA9A0D /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SPISample; + productName = SPISample; + productReference = E98783DA1BDCEA5900EA9A0D /* SPISample.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + E98783D21BDCEA5900EA9A0D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0710; + ORGANIZATIONNAME = "YUKAI Engineering.Inc"; + TargetAttributes = { + E98783D91BDCEA5900EA9A0D = { + CreatedOnToolsVersion = 7.1; + }; + }; + }; + buildConfigurationList = E98783D51BDCEA5900EA9A0D /* Build configuration list for PBXProject "SPISample" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = E98783D11BDCEA5900EA9A0D; + productRefGroup = E98783DB1BDCEA5900EA9A0D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + E98783D91BDCEA5900EA9A0D /* SPISample */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + E98783D81BDCEA5900EA9A0D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E98783ED1BDCEA5900EA9A0D /* LaunchScreen.storyboard in Resources */, + E98783EA1BDCEA5900EA9A0D /* Assets.xcassets in Resources */, + E98783E81BDCEA5900EA9A0D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + E98783D61BDCEA5900EA9A0D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E98783E51BDCEA5900EA9A0D /* ViewController.m in Sources */, + E98783E21BDCEA5900EA9A0D /* AppDelegate.m in Sources */, + E98783DF1BDCEA5900EA9A0D /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + E98783E61BDCEA5900EA9A0D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + E98783E71BDCEA5900EA9A0D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + E98783EB1BDCEA5900EA9A0D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + E98783EC1BDCEA5900EA9A0D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + E98783EF1BDCEA5900EA9A0D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + 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 = 9.1; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + E98783F01BDCEA5900EA9A0D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "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 = gnu99; + 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 = 9.1; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + E98783F21BDCEA5900EA9A0D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + HEADER_SEARCH_PATHS = ""; + INFOPLIST_FILE = SPISample/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + OTHER_LDFLAGS = ( + "-all_load", + "-ObjC", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.ux-xu.konashi.SPISample"; + PRODUCT_NAME = "$(TARGET_NAME)"; + USER_HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/** $(PROJECT_DIR)/../../**"; + }; + name = Debug; + }; + E98783F31BDCEA5900EA9A0D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + HEADER_SEARCH_PATHS = ""; + INFOPLIST_FILE = SPISample/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + OTHER_LDFLAGS = ( + "-all_load", + "-ObjC", + ); + PRODUCT_BUNDLE_IDENTIFIER = "com.ux-xu.konashi.SPISample"; + PRODUCT_NAME = "$(TARGET_NAME)"; + USER_HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/** $(PROJECT_DIR)/../../**"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + E98783D51BDCEA5900EA9A0D /* Build configuration list for PBXProject "SPISample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E98783EF1BDCEA5900EA9A0D /* Debug */, + E98783F01BDCEA5900EA9A0D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E98783F11BDCEA5900EA9A0D /* Build configuration list for PBXNativeTarget "SPISample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E98783F21BDCEA5900EA9A0D /* Debug */, + E98783F31BDCEA5900EA9A0D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = E98783D21BDCEA5900EA9A0D /* Project object */; +} diff --git a/samples/SPISample/SPISample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/SPISample/SPISample.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..084f51a --- /dev/null +++ b/samples/SPISample/SPISample.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/samples/SPISample/SPISample/AppDelegate.h b/samples/SPISample/SPISample/AppDelegate.h new file mode 100644 index 0000000..069a746 --- /dev/null +++ b/samples/SPISample/SPISample/AppDelegate.h @@ -0,0 +1,17 @@ +// +// AppDelegate.h +// SPISample +// +// Created by Akira Matsuda on 10/25/15. +// Copyright © 2015 YUKAI Engineering.Inc. All rights reserved. +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + + +@end + diff --git a/samples/SPISample/SPISample/AppDelegate.m b/samples/SPISample/SPISample/AppDelegate.m new file mode 100644 index 0000000..3aae30e --- /dev/null +++ b/samples/SPISample/SPISample/AppDelegate.m @@ -0,0 +1,45 @@ +// +// AppDelegate.m +// SPISample +// +// Created by Akira Matsuda on 10/25/15. +// Copyright © 2015 YUKAI Engineering.Inc. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application { + // 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 throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // 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. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // 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. +} + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + +@end diff --git a/samples/SPISample/SPISample/Assets.xcassets/AppIcon.appiconset/Contents.json b/samples/SPISample/SPISample/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..800bc8d --- /dev/null +++ b/samples/SPISample/SPISample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,40 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "icon_sample_120.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "icon_sample_180.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/samples/SPISample/SPISample/Assets.xcassets/AppIcon.appiconset/icon_sample_120.png b/samples/SPISample/SPISample/Assets.xcassets/AppIcon.appiconset/icon_sample_120.png new file mode 100644 index 0000000..54cb882 Binary files /dev/null and b/samples/SPISample/SPISample/Assets.xcassets/AppIcon.appiconset/icon_sample_120.png differ diff --git a/samples/SPISample/SPISample/Assets.xcassets/AppIcon.appiconset/icon_sample_180.png b/samples/SPISample/SPISample/Assets.xcassets/AppIcon.appiconset/icon_sample_180.png new file mode 100644 index 0000000..b78c86a Binary files /dev/null and b/samples/SPISample/SPISample/Assets.xcassets/AppIcon.appiconset/icon_sample_180.png differ diff --git a/samples/SPISample/SPISample/Base.lproj/LaunchScreen.storyboard b/samples/SPISample/SPISample/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..e44b23e --- /dev/null +++ b/samples/SPISample/SPISample/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/SPISample/SPISample/Base.lproj/Main.storyboard b/samples/SPISample/SPISample/Base.lproj/Main.storyboard new file mode 100644 index 0000000..be49fef --- /dev/null +++ b/samples/SPISample/SPISample/Base.lproj/Main.storyboard @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/SPISample/SPISample/Info.plist b/samples/SPISample/SPISample/Info.plist new file mode 100644 index 0000000..6905cc6 --- /dev/null +++ b/samples/SPISample/SPISample/Info.plist @@ -0,0 +1,40 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/samples/SPISample/SPISample/ViewController.h b/samples/SPISample/SPISample/ViewController.h new file mode 100644 index 0000000..2b53933 --- /dev/null +++ b/samples/SPISample/SPISample/ViewController.h @@ -0,0 +1,15 @@ +// +// ViewController.h +// SPISample +// +// Created by Akira Matsuda on 10/25/15. +// Copyright © 2015 YUKAI Engineering.Inc. All rights reserved. +// + +#import + +@interface ViewController : UIViewController + + +@end + diff --git a/samples/SPISample/SPISample/ViewController.m b/samples/SPISample/SPISample/ViewController.m new file mode 100644 index 0000000..f19f504 --- /dev/null +++ b/samples/SPISample/SPISample/ViewController.m @@ -0,0 +1,84 @@ +// +// ViewController.m +// SPISample +// +// Created by Akira Matsuda on 10/25/15. +// Copyright © 2015 YUKAI Engineering.Inc. All rights reserved. +// + +#import "ViewController.h" +#import "Konashi.h" + +@interface ViewController () + +@property (nonatomic, strong) IBOutlet UITextView *spiLogTextView; + +@end + +@implementation ViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. + // Override point for customization after application launch. + [[Konashi shared] setConnectedHandler:^{ + NSLog(@"CONNECTED"); + }]; + [[Konashi shared] setReadyHandler:^{ + NSLog(@"READY"); + KonashiResult result = [Konashi uartMode:KonashiUartModeEnable baudrate:KonashiUartBaudrateRate9K6]; + if (result == KonashiResultSuccess) { + result = [Konashi pinMode:KonashiDigitalIO2 mode:KonashiPinModeOutput]; + } + if (result == KonashiResultSuccess) { + result = [Konashi digitalWrite:KonashiDigitalIO2 value:KonashiLevelHigh]; + } + if (result == KonashiResultSuccess) { + result = [Konashi spiMode:KonashiSPIModeEnableCPOL0CPHA0 speed:KonashiSPISpeed200K bitOrder:KonashiSPIBitOrderMSBFirst]; + } + if (result == KonashiResultSuccess) { + NSLog(@"Ready to use SPI."); + [[Konashi shared] setSpiWriteCompleteHandler:^{ + [Konashi spiReadRequest]; + }]; + [[Konashi shared] setSpiReadCompleteHandler:^(NSData *data) { + self.spiLogTextView.text = [data description]; + NSLog(@"SPI Read %@", [data description]); + [Konashi digitalWrite:KonashiDigitalIO2 value:KonashiLevelHigh]; + }]; + } + }]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +#pragma mark - + +- (IBAction)find:(id)sender +{ + [Konashi find]; +} + +- (IBAction)send:(id)sender +{ + KonashiResult result = KonashiResultFailure; + // チップセレクトしたPIOを下げる + result = [Konashi digitalWrite:KonashiDigitalIO2 value:KonashiLevelLow]; + if (result == KonashiResultSuccess) { + // データを送信(0x61~0x6b) + Byte data[11] = {0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b}; + result = [Konashi spiWrite:[NSData dataWithBytes:&data length:11]]; + } + if (result == KonashiResultSuccess) { + // チップセレクトしたPIOを上げる + result = [Konashi digitalWrite:KonashiDigitalIO2 value:KonashiLevelHigh]; + } + NSLog(@"SPI send result : %d (0 == success)", result); +} + +@end diff --git a/samples/SPISample/SPISample/main.m b/samples/SPISample/SPISample/main.m new file mode 100644 index 0000000..230e398 --- /dev/null +++ b/samples/SPISample/SPISample/main.m @@ -0,0 +1,16 @@ +// +// main.m +// SPISample +// +// Created by Akira Matsuda on 10/25/15. +// Copyright © 2015 YUKAI Engineering.Inc. All rights reserved. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +}