mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-27 15:00:46 +00:00
cf1c8fb223
* sepate one wire class * TM2004 writer * app mode write ds1990 * test another blanks protocol * new ibutton slave * one wire states * tim1 capture compare and update interrupts * interrupt mgr, new timers IRQ * discard HAL_TIM_PeriodElapsedCallback from main * add exti_14 line * add external interrupt callback * use int mgr in input * better interrupt managment * add interrupt callback enable and disable fns * properly init app * changed timings * rename one wire classes * use new owb classes * properly remove interrupts * new blanks writer * remove unused tests * new core includes * extern c guard * fix api_interrupt_remove usage * remove debug info, new way to detect blanks writing * remove copy constructor * change keys template * fix app sources recipe
39 lines
745 B
C++
39 lines
745 B
C++
#include "one_wire_device.h"
|
|
|
|
OneWireDevice::OneWireDevice(
|
|
uint8_t id_1,
|
|
uint8_t id_2,
|
|
uint8_t id_3,
|
|
uint8_t id_4,
|
|
uint8_t id_5,
|
|
uint8_t id_6,
|
|
uint8_t id_7) {
|
|
id_storage[0] = id_1;
|
|
id_storage[1] = id_2;
|
|
id_storage[2] = id_3;
|
|
id_storage[3] = id_4;
|
|
id_storage[4] = id_5;
|
|
id_storage[5] = id_6;
|
|
id_storage[6] = id_7;
|
|
id_storage[7] = maxim_crc8(id_storage, 7);
|
|
}
|
|
|
|
OneWireDevice::~OneWireDevice() {
|
|
if(bus != nullptr) {
|
|
bus->deattach();
|
|
}
|
|
}
|
|
|
|
void OneWireDevice::send_id() const {
|
|
if(bus != nullptr) {
|
|
bus->send(id_storage, 8);
|
|
}
|
|
}
|
|
|
|
void OneWireDevice::attach(OneWireSlave* _bus) {
|
|
bus = _bus;
|
|
}
|
|
|
|
void OneWireDevice::deattach(void) {
|
|
bus = nullptr;
|
|
}
|