From 1566f93274bf2a32126b2253cd09753f3a58e645 Mon Sep 17 00:00:00 2001 From: HomeSpan Date: Sat, 16 Oct 2021 11:33:49 -0500 Subject: [PATCH] Update extras.ino --- src/extras/extras.ino | 52 +++++++++++++------------------------------ 1 file changed, 16 insertions(+), 36 deletions(-) diff --git a/src/extras/extras.ino b/src/extras/extras.ino index 409aebd..cd42ab9 100644 --- a/src/extras/extras.ino +++ b/src/extras/extras.ino @@ -18,48 +18,28 @@ void setup() { Serial.println("\n\nHomeSpan RF Transmitter Example\n\n"); - RFControl rf(10); // create an instance of RFControl with signal output to pin 10 + RFControl rf(17); + rf.enableCarrier(38000,0.5); - uint32_t cf = 1e6/(pronto[1]*PRONTO_N); - double unit=pronto[1]*PRONTO_N; +// uint32_t code = 0xE0E019E6; // OFF + uint32_t code = 0xE0E09966; // ON - Serial.printf("Carrier Frequency = %d\n",cf); - Serial.printf("Unit = %g\n",unit); + int unit=563; - rf.enableCarrier( - - Serial.printf("CONF0: %d\n",REG_GET_FIELD(RMT_CH0CONF0_REG,RMT_DIV_CNT_CH0)); - Serial.printf("CONF1: %d\n",REG_GET_FIELD(RMT_CH0CONF1_REG,RMT_REF_ALWAYS_ON_CH0)); - Serial.printf("CHIGH: %d\n",REG_GET_FIELD(RMT_CH0CARRIER_DUTY_REG,RMT_CARRIER_HIGH_CH0)); - Serial.printf("CLOW: %d\n",REG_GET_FIELD(RMT_CH0CARRIER_DUTY_REG,RMT_CARRIER_LOW_CH0)); - - rf.clear(); - - uint32_t len=0; - - for(int i=0,n=4;i0){ - uint16_t data = pulse>32767?32767:pulse; - boolean phase=(i%2==0); - Serial.printf("Pulse %d: %d %d %d\n",i,pronto[n],data,phase); - pulse-=32767; - rf.phase(data,phase); - len+=data; - } - n++; + rf.add(4500,4500); + + for(int i=31;i>=0;i--){ + rf.add(unit,unit*((code&(1<