Loading files
#pragma once
#include "Stream/ReadWritable.hpp"
#include "Utils/Timer.h"
namespace Espfc::Output {
class OutputIBUS
{
public:
OutputIBUS() {}
int begin(Stream::ReadWritable* serial)
{
_serial = serial;
_timer.setInterval(7000); // 7ms
return 1;
}
int update()
{
if (!_timer.check()) return 0;
// const uint8_t data[] = {
// 0x20, 0x40, // preambule (len, cmd)
// 0xDC, 0x05, 0xDC, 0x05, 0xBE, 0x05, 0xDC, 0x05, // channel 1-4
// 0xD0, 0x07, 0xD0, 0x07, 0xDC, 0x05, 0xDC, 0x05, // channel 5-8
// 0xDC, 0x05, 0xDC, 0x05, 0xDC, 0x05, 0xDC, 0x05, // channel 9-12
// 0xDC, 0x05, 0xDC, 0x05, // channel 13-14
// 0x83, 0xF3 // checksum
// };
// clang-format off
const uint8_t data[] = {
0x20, 0x40,
0xDB, 0x05, 0xDC, 0x05, 0x54, 0x05, 0xDC, 0x05, 0xE8, 0x03, 0xD0, 0x07, 0xD2, 0x05, 0xE8, 0x03,
0xDC, 0x05, 0xDC, 0x05, 0xDC, 0x05, 0xDC, 0x05, 0xDC, 0x05, 0xDC, 0x05,
0xDA, 0xF3,
};
// clang-format on
_serial->write(data, sizeof(data));
return 1;
}
private:
Stream::ReadWritable* _serial;
Utils::Timer _timer;
};
} // namespace Espfc::Output
c04356942This file is pinned to the selected release. Download the original to open it in your design tool.