43 lines
690 B
C++
43 lines
690 B
C++
|
|
||
|
#include <Arduino.h>
|
||
|
|
||
|
#include "afsk_sinus.hpp"
|
||
|
|
||
|
|
||
|
extern void sendOne(uint32_t *us, uint8_t *phaseShift);
|
||
|
extern void sendZero(uint32_t *us, uint8_t *phaseShift);
|
||
|
|
||
|
uint32_t m = 0;
|
||
|
uint8_t phaseShift = 0;
|
||
|
|
||
|
void sendBell202(uint8_t byt) {
|
||
|
for (uint8_t i = 0; i < 8; ++i) {
|
||
|
if ((byt >> i) & 1) {
|
||
|
sendOne(&m, &phaseShift);
|
||
|
} else {
|
||
|
sendZero(&m, &phaseShift);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void sendBell202buf(uint8_t *buf, size_t len) {
|
||
|
m = micros();
|
||
|
for (size_t i = 0; i < len; ++i) {
|
||
|
sendBell202(buf[i]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
void setup() {
|
||
|
OUT_DDR = 0xff;
|
||
|
Serial.begin(115200);
|
||
|
}
|
||
|
|
||
|
uint8_t bytes[] = {
|
||
|
0xff, 0x55, 0xff, 0x00, 0xff, 0x00
|
||
|
};
|
||
|
|
||
|
void loop() {
|
||
|
sendBell202buf(bytes, 6);
|
||
|
}
|