add missing files, support display blanking
This commit is contained in:
		
							parent
							
								
									3fc72514a4
								
							
						
					
					
						commit
						9f8b9059f9
					
				
					 9 changed files with 293 additions and 25 deletions
				
			
		
							
								
								
									
										25
									
								
								CL56.cpp
									
										
									
									
									
								
							
							
						
						
									
										25
									
								
								CL56.cpp
									
										
									
									
									
								
							| 
						 | 
					@ -9,9 +9,14 @@ _shiftReg(shiftReg)
 | 
				
			||||||
void DualCl56::tick()
 | 
					void DualCl56::tick()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ++_currentLit;
 | 
					    ++_currentLit;
 | 
				
			||||||
    if(_currentLit > 7)_currentLit = 0;
 | 
					    if(_currentLit > 7)
 | 
				
			||||||
    unsigned char bits[2] = {0b10000000>>_currentLit, ~(_segments[_currentLit])};
 | 
					        _currentLit = 0;
 | 
				
			||||||
    _shiftReg->write(reinterpret_cast<unsigned char*>(&bits));
 | 
					
 | 
				
			||||||
 | 
					    unsigned char bits[2] = {static_cast<unsigned char>(0b10000000 >> _currentLit),
 | 
				
			||||||
 | 
					        static_cast<unsigned char>(~(_segments[_currentLit]))};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if(!_blank)
 | 
				
			||||||
 | 
					        _shiftReg->write(reinterpret_cast<unsigned char*>(&bits));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void DualCl56::setString(const char string[], const uint8_t dp)
 | 
					void DualCl56::setString(const char string[], const uint8_t dp)
 | 
				
			||||||
| 
						 | 
					@ -166,5 +171,17 @@ void DualCl56::setString(const char string[], const uint8_t dp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void DualCl56::setSegments(const uint8_t segments, const uint8_t place)
 | 
					void DualCl56::setSegments(const uint8_t segments, const uint8_t place)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	_segments[place] = segments;
 | 
					    _segments[place] = segments;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void DualCl56::setBlank(bool blankIn)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    _blank = blankIn;
 | 
				
			||||||
 | 
					    if(_blank)
 | 
				
			||||||
 | 
					        _shiftReg->clear();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool DualCl56::getBlank()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return _blank;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										22
									
								
								CL56.h
									
										
									
									
									
								
							
							
						
						
									
										22
									
								
								CL56.h
									
										
									
									
									
								
							| 
						 | 
					@ -7,14 +7,14 @@ class DualCl56
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static constexpr uint8_t SEG_A = 0b10000000;
 | 
					    static constexpr uint8_t SEG_A = 0b10000000;
 | 
				
			||||||
	static constexpr uint8_t SEG_B = 0b01000000;
 | 
					    static constexpr uint8_t SEG_B = 0b01000000;
 | 
				
			||||||
	static constexpr uint8_t SEG_C = 0b00100000;
 | 
					    static constexpr uint8_t SEG_C = 0b00100000;
 | 
				
			||||||
	static constexpr uint8_t SEG_D = 0b00010000;
 | 
					    static constexpr uint8_t SEG_D = 0b00010000;
 | 
				
			||||||
	static constexpr uint8_t SEG_E = 0b00001000;
 | 
					    static constexpr uint8_t SEG_E = 0b00001000;
 | 
				
			||||||
	static constexpr uint8_t SEG_F = 0b00000100;
 | 
					    static constexpr uint8_t SEG_F = 0b00000100;
 | 
				
			||||||
	static constexpr uint8_t SEG_G = 0b00000010;
 | 
					    static constexpr uint8_t SEG_G = 0b00000010;
 | 
				
			||||||
	static constexpr uint8_t SEG_DP= 0b00000001;
 | 
					    static constexpr uint8_t SEG_DP= 0b00000001;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    static constexpr uint8_t COLEN_A = 0b00000010;
 | 
					    static constexpr uint8_t COLEN_A = 0b00000010;
 | 
				
			||||||
    static constexpr uint8_t COLEN_B = 0b00100000;
 | 
					    static constexpr uint8_t COLEN_B = 0b00100000;
 | 
				
			||||||
| 
						 | 
					@ -72,13 +72,17 @@ class DualCl56
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    ShiftReg<16>* _shiftReg;
 | 
					    ShiftReg<16>* _shiftReg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool _blank = false;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    DualCl56(ShiftReg<16>* shiftReg);
 | 
					    DualCl56(ShiftReg<16>* shiftReg);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    void tick();
 | 
					    void tick();
 | 
				
			||||||
 | 
					    void setBlank(bool blank);
 | 
				
			||||||
 | 
					    bool getBlank();
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    void setString(const char* string, const uint8_t dp = 0);
 | 
					    void setString(const char* string, const uint8_t dp = 0);
 | 
				
			||||||
	void setSegments(const uint8_t segments, const uint8_t place);
 | 
					    void setSegments(const uint8_t segments, const uint8_t place);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										85
									
								
								WirelessRelay.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								WirelessRelay.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,85 @@
 | 
				
			||||||
 | 
					#include"WirelessRelay.h"
 | 
				
			||||||
 | 
					#include <avr/io.h>
 | 
				
			||||||
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					volatile unsigned char *_port = &PORTD;
 | 
				
			||||||
 | 
					unsigned char _pin = PD2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void WirelessRelay::sendId()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    writePin(_port,_pin,true);
 | 
				
			||||||
 | 
					    _delay_us(SMALL_TIME);
 | 
				
			||||||
 | 
					    writePin(_port,_pin,false);
 | 
				
			||||||
 | 
					    _delay_us(LARGE_TIME);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    for(short i = 0; i<10; i++)
 | 
				
			||||||
 | 
					    { 
 | 
				
			||||||
 | 
					        sendBit( id  &  1 << (15 - i) );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void WirelessRelay::sendBit(const bool in) 
 | 
				
			||||||
 | 
					{ 
 | 
				
			||||||
 | 
					    switch(in)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        case true:
 | 
				
			||||||
 | 
					        //Der Code fuer '0'
 | 
				
			||||||
 | 
					        writePin(_port,_pin,true);
 | 
				
			||||||
 | 
					        _delay_us(SMALL_TIME);
 | 
				
			||||||
 | 
					        writePin(_port,_pin,false);
 | 
				
			||||||
 | 
					        _delay_us(LARGE_TIME);
 | 
				
			||||||
 | 
					        writePin(_port,_pin,true);
 | 
				
			||||||
 | 
					        _delay_us(SMALL_TIME);
 | 
				
			||||||
 | 
					        writePin(_port,_pin,false);
 | 
				
			||||||
 | 
					        _delay_us(LARGE_TIME);
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case false:
 | 
				
			||||||
 | 
					        //Der Code fuer '1'
 | 
				
			||||||
 | 
					        writePin(_port,_pin,true);
 | 
				
			||||||
 | 
					        _delay_us(LARGE_TIME);
 | 
				
			||||||
 | 
					        writePin(_port,_pin,false);
 | 
				
			||||||
 | 
					        _delay_us(SMALL_TIME);
 | 
				
			||||||
 | 
					        writePin(_port,_pin,true);
 | 
				
			||||||
 | 
					        _delay_us(SMALL_TIME);
 | 
				
			||||||
 | 
					        writePin(_port,_pin,false);
 | 
				
			||||||
 | 
					        _delay_us(LARGE_TIME);
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    }   
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void WirelessRelay::sync()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    writePin(_port,_pin,false);
 | 
				
			||||||
 | 
					    _delay_us(SMALL_TIME*31);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void WirelessRelay::setValue(const uint8_t value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						lastValue = value;
 | 
				
			||||||
 | 
					    for(short z = 0; z<10; z++)
 | 
				
			||||||
 | 
					    { 
 | 
				
			||||||
 | 
					        sendId();
 | 
				
			||||||
 | 
					        sendBit(value);
 | 
				
			||||||
 | 
					        sendBit(!value);
 | 
				
			||||||
 | 
					        sync();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void WirelessRelay::resend()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						setValue(lastValue);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					WirelessRelay::WirelessRelay(const uint16_t idIn, char nameIn[])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    id = idIn;
 | 
				
			||||||
 | 
					    setName(nameIn);
 | 
				
			||||||
 | 
					    type = 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					WirelessRelay::WirelessRelay(const Item& item)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    Item::operator=(item);
 | 
				
			||||||
 | 
					    type = 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										27
									
								
								WirelessRelay.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								WirelessRelay.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,27 @@
 | 
				
			||||||
 | 
					#ifndef RF433_H
 | 
				
			||||||
 | 
					#define RF433_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include<util/delay.h>
 | 
				
			||||||
 | 
					#include"writepin.h"
 | 
				
			||||||
 | 
					#include "item.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class WirelessRelay: public Item
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    static constexpr uint16_t LARGE_TIME = 750;
 | 
				
			||||||
 | 
					    static constexpr uint8_t  SMALL_TIME = 250;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    static constexpr uint16_t MAX_NAME_LENGTH = 16;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					private:
 | 
				
			||||||
 | 
					    void sendBit(const bool i);
 | 
				
			||||||
 | 
					    void sync();
 | 
				
			||||||
 | 
					    void sendId();
 | 
				
			||||||
 | 
					     
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    WirelessRelay(const uint16_t idIn, char nameIn[]);
 | 
				
			||||||
 | 
					    WirelessRelay(const Item& item);
 | 
				
			||||||
 | 
					    void setValue(const uint8_t value); 
 | 
				
			||||||
 | 
						void resend();
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										88
									
								
								dht11.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										88
									
								
								dht11.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,88 @@
 | 
				
			||||||
 | 
					#include "dht11.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Dht11::Dht11(volatile unsigned char * const port, volatile unsigned char * const inPort, volatile unsigned char * const port_ctl, const unsigned char pin): _port(port), _port_ctl(port_ctl), _inPort(inPort), _pin(pin)
 | 
				
			||||||
 | 
					{}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					uint8_t Dht11::read()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						// BUFFER TO RECEIVE
 | 
				
			||||||
 | 
						uint8_t bits[5];
 | 
				
			||||||
 | 
						uint8_t cnt = 7;
 | 
				
			||||||
 | 
						uint8_t idx = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// EMPTY BUFFER
 | 
				
			||||||
 | 
						for (uint8_t i=0; i< 5; i++) bits[i] = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// REQUEST SAMPLE
 | 
				
			||||||
 | 
						setDirection(_port_ctl, _pin, true);
 | 
				
			||||||
 | 
						writePin(_port, _pin, false);
 | 
				
			||||||
 | 
						_delay_ms(18);
 | 
				
			||||||
 | 
					    writePin(_port, _pin, true);
 | 
				
			||||||
 | 
						setDirection(_port_ctl, _pin, false);
 | 
				
			||||||
 | 
						_delay_us(42);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// ACKNOWLEDGE or TIMEOUT
 | 
				
			||||||
 | 
						unsigned int loopCnt = LOOP_TIMEOUT_COUNT;
 | 
				
			||||||
 | 
						while(!readPin(_inPort, _pin)) if (loopCnt-- == 0) return 1;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
						loopCnt = LOOP_TIMEOUT_COUNT;
 | 
				
			||||||
 | 
						while(readPin(_inPort, _pin) ) if (loopCnt-- == 0)  return 2;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        PORTD |= 1 << PD1;
 | 
				
			||||||
 | 
					        PORTD &= ~(1 << PD1);
 | 
				
			||||||
 | 
					        PORTD |= 1 << PD1;
 | 
				
			||||||
 | 
					        PORTD &= ~(1 << PD1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// READ OUTPUT - 40 BITS => 5 BYTES or TIMEOUT
 | 
				
			||||||
 | 
						for (uint8_t i=0; i<40; i++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							loopCnt = LOOP_TIMEOUT_COUNT;
 | 
				
			||||||
 | 
							while(!readPin(_inPort, _pin))
 | 
				
			||||||
 | 
								if (loopCnt-- == 0) 
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                PORTD |= 1 << PD1;
 | 
				
			||||||
 | 
					                return 3;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							loopCnt = 0;
 | 
				
			||||||
 | 
							while(readPin(_inPort, _pin))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								_delay_us(10);
 | 
				
			||||||
 | 
								if (loopCnt++ > LOOP_TIMEOUT_SMALL_COUNT) return 4;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if( loopCnt > BIT_COUNT )
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
								PORTD |= 1 << PD1;
 | 
				
			||||||
 | 
					            PORTD &= ~(1 << PD1);
 | 
				
			||||||
 | 
					            bits[idx] |= (1 << cnt);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
							if (cnt == 0)   // next byte?
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								cnt = 7;    // restart at MSB
 | 
				
			||||||
 | 
								idx++;      // next byte!
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							else cnt--;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						uint8_t sum;
 | 
				
			||||||
 | 
						if constexpr(DHT22) sum= bits[0] + bits[1] + bits[2] + bits[3];
 | 
				
			||||||
 | 
						else sum = bits[0] + bits[2];
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if((bits[4] == sum && sum != 0) || true)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if constexpr(DHT22)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								humidity    = (static_cast<uint16_t>(bits[0]) << 8) + bits[1]; 
 | 
				
			||||||
 | 
								temperature = (static_cast<uint16_t>((bits[2] & 0b01111111) << 8) + bits[3]);
 | 
				
			||||||
 | 
								if(bits[2] & 0b10000000) temperature=temperature*-1;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								humidity = bits[0]*10;
 | 
				
			||||||
 | 
								temperature = bits[2]*10;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else return 5;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										23
									
								
								dht11.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								dht11.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,23 @@
 | 
				
			||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					#include <stdint.h>
 | 
				
			||||||
 | 
					#include<util/delay.h>
 | 
				
			||||||
 | 
					#include "writepin.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Dht11
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						static constexpr uint16_t LOOP_TIMEOUT_COUNT = (10000.0 / 16000000.0)*F_CPU;
 | 
				
			||||||
 | 
						static constexpr uint8_t LOOP_TIMEOUT_SMALL_COUNT = (100.0 / 16000000.0)*F_CPU;
 | 
				
			||||||
 | 
						static constexpr uint8_t BIT_COUNT = 5;//(6.0 / 16000000.0)*F_CPU;
 | 
				
			||||||
 | 
						static constexpr bool DHT22 = true;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					    volatile unsigned char * const _port;
 | 
				
			||||||
 | 
					    volatile unsigned char * const _port_ctl;
 | 
				
			||||||
 | 
					    volatile unsigned char * const _inPort;
 | 
				
			||||||
 | 
					    const unsigned char _pin;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    Dht11(volatile unsigned char * const port, volatile unsigned char * const inPort, volatile unsigned char * const port_ctl, const unsigned char pin);
 | 
				
			||||||
 | 
					    uint8_t read();
 | 
				
			||||||
 | 
					    int16_t humidity = 0;
 | 
				
			||||||
 | 
					    int16_t temperature = 0;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
							
								
								
									
										9
									
								
								item.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								item.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,9 @@
 | 
				
			||||||
 | 
					#include "item.h"
 | 
				
			||||||
 | 
					#include "string.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Item::setName(const char * const nameN)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    size_t len = strlen(nameN);
 | 
				
			||||||
 | 
					    if(len < MAX_NAME_LENGTH)memcpy(name, nameN, len+1);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										14
									
								
								item.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								item.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,14 @@
 | 
				
			||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					#include <stdint.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Item
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    static constexpr uint16_t MAX_NAME_LENGTH = 16;
 | 
				
			||||||
 | 
					    bool lastValue = 0;
 | 
				
			||||||
 | 
					    uint16_t id;
 | 
				
			||||||
 | 
					    char name[MAX_NAME_LENGTH]="";
 | 
				
			||||||
 | 
					    uint8_t type = 0;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    void setName(const char * const name);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
							
								
								
									
										23
									
								
								main.cpp
									
										
									
									
									
								
							
							
						
						
									
										23
									
								
								main.cpp
									
										
									
									
									
								
							| 
						 | 
					@ -66,13 +66,10 @@ volatile uint8_t displayDevider = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ISR(TIMER1_COMPA_vect)
 | 
					ISR(TIMER1_COMPA_vect)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if(displayDevider > 1)
 | 
						TIMSK2 = 0;
 | 
				
			||||||
	{
 | 
						W433DataReciver::staticInterrupt();
 | 
				
			||||||
		TIMSK2 = 0;
 | 
						writePin(&PORTB, PB5, !readPin(&PORTB, PB5));
 | 
				
			||||||
		W433DataReciver::staticInterrupt();
 | 
						TIMSK2 = 1;
 | 
				
			||||||
		writePin(&PORTB, PB5, !readPin(&PORTB, PB5));
 | 
					 | 
				
			||||||
		TIMSK2 = 1;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ISR(TIMER2_OVF_vect)
 | 
					ISR(TIMER2_OVF_vect)
 | 
				
			||||||
| 
						 | 
					@ -89,6 +86,12 @@ ISR(TIMER2_OVF_vect)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void buttonHandler(uint8_t index, uint8_t type, void* data)
 | 
					void buttonHandler(uint8_t index, uint8_t type, void* data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						if(display.getBlank())
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							display.setBlank(false);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!setting)
 | 
						if(!setting)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if(index == 0 && type == Buttons::RELEASED)
 | 
							if(index == 0 && type == Buttons::RELEASED)
 | 
				
			||||||
| 
						 | 
					@ -483,10 +486,8 @@ int main()
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if(time.min > 45)
 | 
							if(time.min == 45)
 | 
				
			||||||
			displayDevider = 16;
 | 
								display.setBlank(true);
 | 
				
			||||||
		else
 | 
					 | 
				
			||||||
			displayDevider = 1;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if(time.hour == 0 && time.min == 0 && time.sec == timeOffsetSeconds+10)
 | 
							if(time.hour == 0 && time.min == 0 && time.sec == timeOffsetSeconds+10)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue