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
import Foundation | |
func asn1_int_to_bytes(length: UInt) -> Data { | |
var l = length | |
var d = Data() | |
while (l > 0) { | |
let b: UInt8 = UInt8(l & 0xFF) | |
d.append(contentsOf: [b]) | |
l = length >> 8 | |
} |
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
#include <bc_common.h> | |
#include <bc_scheduler.h> | |
#include <bc_usb_cdc.h> | |
void application_on_tick(void *event_param) | |
{ | |
// Send 'Hello world!' string to USB | |
char buffer[] = "Hello world!\r\n"; | |
bc_usb_cdc_write(buffer, strlen(buffer)); |
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
#include <bc_common.h> | |
#include <bc_usb_cdc.h> | |
#include <bc_button.h> | |
static bc_button_t button; | |
void button_event_handler(bc_button_t *self, bc_button_event_t event, void *event_param) | |
{ | |
if (event == BC_BUTTON_EVENT_PRESS) | |
{ |
NewerOlder