Skip to content

Instantly share code, notes, and snippets.

View ateska's full-sized avatar

Ales Teska ateska

View GitHub Profile
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
}
#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));
@ateska
ateska / bc_hello_world_1.c
Last active February 8, 2017 20:05
Hello world for BigClown Core Module.
#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)
{