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
| typedef struct { | |
| uint8_t device; | |
| uint8_t command; | |
| uint32_t value; | |
| uint64_t serial; | |
| uint8_t ack; | |
| } Command; | |
| void SenderApplication::didReceiveGoodPacket(SerialPacket *p) { | |
| Serial.println("Got good packet!"); |
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
| typedef struct { | |
| uint8_t device; | |
| uint8_t command; | |
| uint32_t value; | |
| uint64_t serial; | |
| uint8_t ack; | |
| } Command; | |
| void SenderApplication::didReceiveGoodPacket(SerialPacket *p) { | |
| Serial.println("Got good packet!"); |
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
| // found at https://learn.adafruit.com/memories-of-an-arduino/measuring-free-memory | |
| int freeRam () { | |
| extern int __heap_start, *__brkval; | |
| int v; | |
| return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); | |
| } |
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
| // CRC-8 - based on the CRC8 formulas by Dallas/Maxim | |
| // code released under the therms of the GNU GPL 3.0 license | |
| // Found at: http://www.leonardomiliani.com/en/2013/un-semplice-crc8-per-arduino/ | |
| uint8_t SerialPacket::_crc8(const uint8_t *data, uint8_t len) { | |
| uint8_t crc = 0x00; | |
| while (len--) { | |
| uint8_t extract = *data++; | |
| for (uint8_t tempI = 8; tempI; tempI--) { | |
| uint8_t sum = (crc ^ extract) & 0x01; | |
| crc >>= 1; |
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 "mbed.h" | |
| DigitalOut data(PTB9); | |
| DigitalOut clk(PTB8); | |
| DigitalOut oe(PTB10); | |
| DigitalOut rst(PTB11); | |
| Serial out(PTA2, PTA1); |
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" | |
| #define data 8 | |
| #define clk 9 | |
| #define oe 7 | |
| #define rst 6 | |
| void pulseClock() { | |
| digitalWrite(clk, HIGH); | |
| digitalWrite(clk, LOW); |
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> | |
| #define PIN_LED 13 | |
| #define LED_STATE_SWITCH_INTERVAL 500 // milliseconds between LED state change | |
| void setup(void) { | |
| pinMode(PIN_LED, OUTPUT); | |
| digitalWrite(PIN_LED, LOW); | |
| } |
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> | |
| #define PIN_LED 13 | |
| #define LED_STATE_SWITCH_INTERVAL 500 // milliseconds between LED state change | |
| unsigned long ledNextStateFlip = 0; | |
| bool ledIsOn = false; | |
| void setup(void) { | |
| pinMode(PIN_LED, OUTPUT); |
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> | |
| #define PIN_LED_A 13 | |
| #define PIN_LED_B 12 | |
| #define LED_A_STATE_SWITCH_INTERVAL 500 // milliseconds between LED state change | |
| #define LED_B_STATE_SWITCH_INTERVAL 750 // milliseconds between LED state change | |
| unsigned long ledANextStateFlip = 0, ledBNextStateFlip = 0; | |
| uint8_t ledAIsOn = LOW, ledBIsOn = LOW; |
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> | |
| #define PIN_LED_A 13 | |
| #define PIN_LED_B 12 | |
| #define PIN_LED_C 11 | |
| #define LED_A_STATE_SWITCH_INTERVAL 500 // milliseconds between LED state change | |
| #define LED_B_STATE_SWITCH_INTERVAL 300 // milliseconds between LED state change | |
| #define LED_C_STATE_SWITCH_INTERVAL 200 // milliseconds between LED state change |