mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-05-04 07:10:16 +00:00
test
This commit is contained in:
parent
fc02c79135
commit
c4000d6b75
@ -4,8 +4,8 @@
|
|||||||
#include "MemoryCheck.h"
|
#include "MemoryCheck.h"
|
||||||
/////////////// Pinout ///////////////
|
/////////////// Pinout ///////////////
|
||||||
|
|
||||||
#define encForward_PIN 5
|
#define encForward_PIN 0
|
||||||
#define encBackward_PIN 6
|
#define encBackward_PIN 5
|
||||||
|
|
||||||
#define LoopOut 12
|
#define LoopOut 12
|
||||||
#define ISR_Out 10
|
#define ISR_Out 10
|
||||||
@ -32,9 +32,9 @@ void decForwardISR() {
|
|||||||
decForward.isr();
|
decForward.isr();
|
||||||
}
|
}
|
||||||
|
|
||||||
// void decBackwardISR() {
|
void decBackwardISR() {
|
||||||
// decBackward.isr();
|
decBackward.isr();
|
||||||
// }
|
}
|
||||||
|
|
||||||
static uint8_t* portOut;
|
static uint8_t* portOut;
|
||||||
ISR(TIMER2_COMPA_vect) {
|
ISR(TIMER2_COMPA_vect) {
|
||||||
@ -42,9 +42,9 @@ ISR(TIMER2_COMPA_vect) {
|
|||||||
// encBackward.isr();
|
// encBackward.isr();
|
||||||
// encTree.isr();
|
// encTree.isr();
|
||||||
//TODO: Сделать выбор порта
|
//TODO: Сделать выбор порта
|
||||||
*portOut = (*portOut & 0b11001111) |
|
*portOut = (*portOut & 0b11111110) |
|
||||||
(
|
(
|
||||||
encForward.ir_out_virtual << 5U
|
encForward.ir_out_virtual << 0U
|
||||||
// | encBackward.ir_out_virtual << 6U
|
// | encBackward.ir_out_virtual << 6U
|
||||||
// | encTree.ir_out_virtual << 2U
|
// | encTree.ir_out_virtual << 2U
|
||||||
);
|
);
|
||||||
@ -60,7 +60,7 @@ uint32_t loopTimer;
|
|||||||
uint8_t sig = 0;
|
uint8_t sig = 0;
|
||||||
|
|
||||||
uint16_t targetAddr = IR_Broadcast;
|
uint16_t targetAddr = IR_Broadcast;
|
||||||
Timer t1(500, millis, []() {
|
Timer t1(750, millis, []() {
|
||||||
|
|
||||||
// Serial.println(sig);
|
// Serial.println(sig);
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ Timer t2(500, millis, []() {
|
|||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
void setup() {
|
void setup() {
|
||||||
IR_Encoder::timerSetup();
|
IR_Encoder::timerSetup();
|
||||||
portOut = &PORTD;
|
portOut = &PORTB;
|
||||||
|
|
||||||
Serial.begin(SERIAL_SPEED);
|
Serial.begin(SERIAL_SPEED);
|
||||||
Serial.println(F(INFO));
|
Serial.println(F(INFO));
|
||||||
@ -182,7 +182,7 @@ void setup() {
|
|||||||
|
|
||||||
|
|
||||||
attachInterrupt(0, decForwardISR, CHANGE); // D2
|
attachInterrupt(0, decForwardISR, CHANGE); // D2
|
||||||
// attachInterrupt(1, decBackwardISR, CHANGE); // D3
|
attachInterrupt(1, decBackwardISR, CHANGE); // D3
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
@ -193,7 +193,7 @@ void loop() {
|
|||||||
decBackward.tick();
|
decBackward.tick();
|
||||||
|
|
||||||
status(decForward);
|
status(decForward);
|
||||||
// status(decBackward);
|
status(decBackward);
|
||||||
|
|
||||||
|
|
||||||
// Serial.println(micros() - loopTimer);
|
// Serial.println(micros() - loopTimer);
|
||||||
@ -227,7 +227,7 @@ void loop() {
|
|||||||
|
|
||||||
//test
|
//test
|
||||||
void status(IR_Decoder& dec) {
|
void status(IR_Decoder& dec) {
|
||||||
if (dec.gotData.available()) {
|
if (dec.gotData.available() && dec.gotData.getAddrFrom() != 42) {
|
||||||
String str;
|
String str;
|
||||||
if (/* dec.gotData.getDataPrt()[1] */1) {
|
if (/* dec.gotData.getDataPrt()[1] */1) {
|
||||||
str += ("Data on pin "); str += (dec.isrPin); str += "\n";
|
str += ("Data on pin "); str += (dec.isrPin); str += "\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user