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 <BleGamepad.h> // https://github.com/lemmingDev/ESP32-BLE-Gamepad | |
#include <Encoder.h> // Encoder - by Paul Stoffregen | |
BleGamepad bleGamepad("SimWheel"); | |
#define TIME unsigned int | |
#define ENCODER_PULSES_PER_STEP 2 | |
#define numOfRotaryButtons 10 // 5 rotaries x 2 (rotate left and right) | |
#define numOfhc165 3 | |
#define dataWidth numOfhc165 * 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
#define BUF_SIZE 64 | |
char simHubMessageBuf[BUF_SIZE]; | |
RGBDigit rgbDigit(1, <your-pin-here>); | |
char gear = '-'; | |
void setup() { | |
Serial.begin(115200); |
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 "BluetoothSerial.h" | |
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED) | |
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it | |
#endif | |
#define BUF_SIZE 64 | |
char simHubMessageBuf[BUF_SIZE]; | |
BluetoothSerial btSerial; |
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
#define BytesValT unsigned int | |
#define numOfRotaryButtons 10 | |
#define numOfhc165 3 | |
#define dataWidth numOfhc165 * 8 | |
#define pulseWidthUSec 5 | |
byte previousButtonStates[dataWidth]; | |
byte currentButtonStates[dataWidth]; |
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 "BluetoothSerial.h" | |
#include <FastLED.h> | |
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED) | |
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it | |
#endif | |
#define BUF_SIZE 64 | |
#define REV_LIGHTS_COUNT 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 <FastLED.h> | |
#define LED_COUNT 10 | |
CRGB leds[LED_COUNT]; | |
int lastPot = -100; | |
float col[3]; | |
void setup() { |
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
/// Usage | |
/// foos.sortedBy((it) => it.bar); | |
extension MapExt<T, U> on Map<T, U> { | |
Map<T, U> sortedBy(Comparable value(U u)) { | |
final entries = this.entries.toList(); | |
entries.sort((a, b) => value(a.value).compareTo(value(b.value))); | |
return Map<T, U>.fromEntries(entries); | |
} | |
} |
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 android.support.test.InstrumentationRegistry | |
import java.util.concurrent.CountDownLatch | |
fun waitForIdle(errorMessage: String) { | |
val countDownLatch = CountDownLatch(1) | |
InstrumentationRegistry.getInstrumentation().waitForIdle { countDownLatch.countDown() } | |
try { | |
countDownLatch.await() | |
} catch (e: InterruptedException) { |
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
package com.carte_app.carte.util | |
import android.content.Intent | |
fun Intent.addLocation(location: Location): Intent { | |
putExtra(IntentExtensions.INTENT_PARAM_LOCATION_LAT, location.lat) | |
putExtra(IntentExtensions.INTENT_PARAM_LOCATION_LNG, location.lng) | |
return this | |
} |
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
/** | |
* Allows reuse of typical subscribeOn & observeOn scheduling. | |
*/ | |
fun <T> applyIOMainSchedulers(): Observable.Transformer<T, T> { | |
return Observable.Transformer { observable -> | |
observable.subscribeOn(Schedulers.io()) | |
.observeOn(AndroidSchedulers.mainThread()) | |
} | |
} |