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 <stdint.h> | |
| // modify this to change the timer resolution | |
| typedef uint8_t st_type; | |
| /** | |
| * @brief software timer callback handler type declaration | |
| * | |
| * @return void | |
| */ |
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 <stdint.h> | |
| typedef enum _e_status { | |
| ACK = 0x00, | |
| NACK | |
| } e_status; | |
| struct timer_data { | |
| uint16_t crc16; |
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 "pca.h" | |
| #include "../model.h" | |
| #include "main.h" | |
| #include <avr/interrupt.h> | |
| #include <util/atomic.h> | |
| #define LED_DDRD DDRB | |
| #define LED_PORT PORTB | |
| #define LED_PIN PORTB0 |
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
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| $|++; | |
| use Device::SerialPort; | |
| use Digest::CRC qw/crc16/; | |
| use Time::HiRes qw/usleep/; |
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 <stdint.h> | |
| #include "crc.h" | |
| /** CRC table for the CRC-16. The poly is 0x8005 (x^16 + x^15 + x^2 + 1) */ | |
| uint16_t const crc16_table[256] = { | |
| 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, | |
| 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, | |
| 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, | |
| 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, | |
| 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40, |
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
| #define BAUD_2400 B2400 | |
| #define BAUD_4800 B4800 | |
| #define BAUD_9600 B9600 | |
| #define BAUD_38400 B38400 | |
| #define BAUD_57600 B57600 | |
| #define BAUD_115200 B115200 | |
| static int tty_attrib_conf(int fd, int speed, int parity) { |
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
| int main(int argc, char const *argv[]) { | |
| g_fd = 0x00; | |
| struct response *resp; | |
| struct timer_data *data; | |
| uint8_t buff[8] = {0x00}; | |
| uint16_t crc = 0x00; | |
| if (argc <= 3) { | |
| fprintf(stderr, "host_slip <prescaler> <ocr> <st_max>\n"); |
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
| while (1) { | |
| my @alsa_event = MIDI::ALSA::input(); | |
| # last event -> exit | |
| last if ($alsa_event[0] == SND_SEQ_EVENT_PORT_UNSUBSCRIBED()); | |
| # midi event to midi score event | |
| my @score_event = MIDI::ALSA::alsa2scoreevent( @alsa_event ); | |
| # filter out empty events |
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
| struct note { | |
| uint16_t note; | |
| uint16_t duration; | |
| }; | |
| struct packet { | |
| uint16_t crc16; | |
| unsigned char num; | |
| struct note notes[4]; | |
| }; |
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 "beeper.h" | |
| #include "notes.h" | |
| #include "serial.h" | |
| #include "slip.h" | |
| #include <avr/io.h> | |
| #include <util/delay.h> | |
| struct note { | |
| uint16_t note; |