This file contains hidden or 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 <Arduino.h> | |
// Source: | |
// https://web.archive.org/web/20160815200234/https://www.circuitsathome.com/mcu/programming/reading-rotary-encoder-on-arduino | |
const uint8_t ROTARY_PIN_A = 1; // TX | |
const uint8_t ROTARY_PIN_B = 3; // RX | |
int8_t rotaryValue = 0; |
This file contains hidden or 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
#!/bin/sh | |
# Note: use this script like so: | |
# git checkout dev | |
# ./sizecheck.sh > size0.txt | |
# git checkout some-feature-branch | |
# ./sizecheck.sh > size1.txt | |
# sizediff size0.txt size1.txt | |
for t in testdata/*.go; do echo host $t; tinygo build -o test.elf -size=short -no-debug $t; md5sum test.elf; done |
This file contains hidden or 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
package main | |
import ( | |
"unsafe" | |
"syscall" | |
"github.com/go-ole/go-ole" | |
) | |
type IBluetoothAdapterStatics struct { |
This file contains hidden or 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
// This is a small example (and test) how to use tilegraphics. It displays a | |
// small yellow square on a black background that bounces to both sides of the display. | |
package main | |
import ( | |
"image/color" | |
"time" | |
"github.com/aykevl/go-smartwatch" | |
"github.com/aykevl/tilegraphics" |
This file contains hidden or 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 "unsafe" | |
func printfloat32(f float32) { | |
// Here be dragons. | |
// Correctly printing floats turns out to be really, really difficult (there | |
// have been multiple research papers on the topic). Instead of aiming to be | |
// exact, I've tried to print something that isn't wrong in at least most | |
// cases (hopefully) and doesn't look too bad. Also, I want this to be | |
// really small. | |
// TODO: make this smaller and/or more precise. Also, print some values like |
This file contains hidden or 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 machine | |
import pixels | |
import array | |
import urandom | |
import time | |
# Source: | |
# https://github.com/FastLED/FastLED/blob/master/examples/Fire2012WithPalette/Fire2012WithPalette.ino | |
heatColors = array.array('L', [0x000000, |
This file contains hidden or 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 <stdio.h> | |
__attribute__((used)) | |
int bar() { | |
printf("bar\n"); | |
return 42; | |
} | |
__attribute__((noinline,naked)) |
This file contains hidden or 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
diff --git a/ports/nrf/hal/hal_uart.c b/ports/nrf/hal/hal_uart.c | |
index 39590272b..583a8761d 100644 | |
--- a/ports/nrf/hal/hal_uart.c | |
+++ b/ports/nrf/hal/hal_uart.c | |
@@ -122,7 +122,7 @@ void hal_uart_init(NRF_UART_Type * p_instance, hal_uart_init_t const * p_uart_in | |
if (p_uart_init->flow_control) { | |
hal_gpio_cfg_pin(p_uart_init->rts_pin->port, p_uart_init->rts_pin->pin, HAL_GPIO_MODE_OUTPUT, HAL_GPIO_PULL_DISABLED); | |
- hal_gpio_cfg_pin(p_uart_init->cts_pin->port, p_uart_init->cts_pin->pin, HAL_GPIO_MODE_INPUT, HAL_GPIO_PULL_DISABLED); | |
+ hal_gpio_cfg_pin(p_uart_init->cts_pin->port, p_uart_init->cts_pin->pin, HAL_GPIO_MODE_INPUT, HAL_GPIO_PULL_DOWN); |
This file contains hidden or 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
/* | |
* This file is part of the MicroPython project, http://micropython.org/ | |
* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2018 Glenn Ruben Bakke | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights |
This file contains hidden or 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
diff --git a/ports/nrf/bluetooth_conf.h b/ports/nrf/bluetooth_conf.h | |
index 6a3cbdc83..9e649c940 100644 | |
--- a/ports/nrf/bluetooth_conf.h | |
+++ b/ports/nrf/bluetooth_conf.h | |
@@ -6,7 +6,7 @@ | |
#if (BLUETOOTH_SD == 110) | |
#define MICROPY_PY_BLE (1) | |
-#define MICROPY_PY_BLE_NUS (0) | |
+#define MICROPY_PY_BLE_NUS (1) |
NewerOlder