Add module library code

This commit is contained in:
Midgard 2020-08-25 21:48:23 +02:00
parent 87824c6356
commit 4fd6cc6d8f
Signed by: midgard
GPG key ID: 511C112F1331BBB4
2 changed files with 36 additions and 0 deletions

29
lib/module.cpp Normal file
View file

@ -0,0 +1,29 @@
#include "obus_can.h"
#include "module.h"
struct module this_module;
uint8_t strike_count;
void obusmodule_setup(uint8_t type, uint8_t id) {
this_module.type = type;
this_module.id = id;
obuscan_init();
strike_count = 0;
}
void obusmodule_loop() {
}
void obusmodule_strike() {
strike_count++;
obuscan_send_m_strike(this_module, strike_count);
}
void obusmodule_solve() {
obuscan_send_m_solved(this_module);
}

7
lib/module.hpp Normal file
View file

@ -0,0 +1,7 @@
void obusmodule_setup(uint8_t type, uint8_t id);
void obusmodule_loop();
void obusmodule_strike();
void obusmodule_solve();