Skip to content

Instantly share code, notes, and snippets.

int main(void)
{
// Initialize
leds_init();
timers_init();
buttons_init();
APP_GPIOTE_INIT(1);
uart_init();
ble_stack_init();
scheduler_init();
/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
*
* The information contained herein is property of Nordic Semiconductor ASA.
* Terms and conditions of usage are described in detail in NORDIC
* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information. NO
* WARRANTY of ANY KIND is provided. This heading must NOT be removed from
* the file.
*
NSMutableData* data = [NSMutableData dataWithLength:sizeof(uint8_t) * 100];
uint8_t* array = [data mutableBytes];
#import <UIKit/UIKit.h>
#import "SKPSMTPMessage.h"
#import "NSData+Base64Additions.h"
@interface ViewController : UIViewController<SKPSMTPMessageDelegate>
@end
- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
{
uint8_t *byte = (uint8_t *)[characteristic.value bytes];
...
}
- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
{
NSString* str = [[NSString alloc] initWithData:characteristic.value encoding:NSUTF8StringEncoding];
...
}
#include <MailCore/MailCore.h>
...
-(void) sendEmail:(NSString *) message
{
MCOSMTPSession *smtpSession = [[MCOSMTPSession alloc] init];
smtpSession.hostname = @"smtp.gmail.com"; // SMTPサーバのアドレス
smtpSession.port = 465;
smtpSession.username = @"moemoe"; // SMTPサーバのユーザ名
@ksksue
ksksue / c_cpp_properties.json
Last active October 10, 2018 16:27
VSCode c_cpp_properties.json for nRF5_SDK_15.2.0
{
"env": {
"gccArmPath": "/usr/local/gcc-arm-none-eabi-6-2017-q2-update",
"nrf5SdkPath": "~/Documents/Nordic/nRF5_SDK_15.2.0_9412b96"
},
"configurations": [{
"name": "Mac",
"includePath": [
"${gccArmPath}/arm-none-eabi/include",
"${gccArmPath}/arm-none-eabi/include/bits",
@ksksue
ksksue / gist:4ec4ddd0a6d35215c30714681b44b535
Created March 21, 2019 02:14
非同期実行時にfunction内の引数が保持されるかの確認。結果保持される。
var state = 0;
function hoge(a) {
if(state === 0) {
setTimeout(function(){console.log(a);},1000);
} else {
setTimeout(function(){console.log(a);},500);
}
state++;
}