Skip to content

Commit 8d3e8da

Browse files
committed
commit all
1 parent e08c32e commit 8d3e8da

File tree

21 files changed

+1336
-0
lines changed

21 files changed

+1336
-0
lines changed

IRQTest/IRQTest.ino

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
void setup() {
2+
// put your setup code here, to run once:
3+
4+
Serial.begin(9600);
5+
Serial.println("Program Start") ;
6+
attachInterrupt(0, TheButtonPressed, LOW);
7+
}
8+
9+
void loop() {
10+
// put your main code here, to run repeatedly:
11+
Serial.print("now program run in loop()");
12+
}
13+
14+
void TheButtonPressed()
15+
{
16+
Serial.println("The Button is pressed by user") ;
17+
}
18+
19+

LIB/Enerlib.zip

2.34 KB
Binary file not shown.

LIB/Enerlib/Enerlib.cpp

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
Enerlib: easy-to-use wrapper for AVR's Sleep lib.
3+
By E.P.G. - 12/2012 - Ver. 1.0.1
4+
*/
5+
6+
#include <avr/sleep.h>
7+
#include "Enerlib.h"
8+
#if defined(ARDUINO) && ARDUINO >= 100
9+
#include <arduino.h>
10+
#else
11+
#include <wiring.h>
12+
#endif
13+
14+
Energy::Energy()
15+
{
16+
sleeping = false;
17+
}
18+
19+
bool Energy::WasSleeping(void)
20+
{
21+
bool a = sleeping;
22+
sleeping = false;
23+
return a;
24+
}
25+
26+
void Energy::PowerDown(void)
27+
{
28+
delay(100);
29+
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
30+
sleeping = true;
31+
sleep_enable();
32+
sleep_mode();
33+
sleep_disable();
34+
}
35+
36+
void Energy::Idle(void)
37+
{
38+
delay(100);
39+
set_sleep_mode(SLEEP_MODE_IDLE);
40+
sleeping = true;
41+
sleep_enable();
42+
sleep_mode();
43+
sleep_disable();
44+
}
45+
46+
void Energy::SleepADC(void)
47+
{
48+
delay(100);
49+
set_sleep_mode(SLEEP_MODE_ADC);
50+
sleeping = true;
51+
sleep_enable();
52+
sleep_mode();
53+
sleep_disable();
54+
}
55+
56+
void Energy::PowerSave(void)
57+
{
58+
delay(100);
59+
set_sleep_mode(SLEEP_MODE_PWR_SAVE);
60+
sleeping = true;
61+
sleep_enable();
62+
sleep_mode();
63+
sleep_disable();
64+
}
65+
66+
void Energy::Standby(void)
67+
{
68+
delay(100);
69+
set_sleep_mode(SLEEP_MODE_STANDBY);
70+
sleeping = true;
71+
sleep_enable();
72+
sleep_mode();
73+
sleep_disable();
74+
}

LIB/Enerlib/Enerlib.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
Enerlib: easy-to-use wrapper for AVR's Sleep lib.
3+
By E.P.G. - 12/2012 - Ver. 1.0.1
4+
*/
5+
6+
#ifndef Enerlib_h
7+
#define Enerlib_h
8+
9+
class Energy
10+
{
11+
private:
12+
bool sleeping;
13+
public:
14+
Energy();
15+
void PowerDown(void);
16+
void Idle(void);
17+
void SleepADC(void);
18+
void PowerSave(void);
19+
void Standby(void);
20+
bool WasSleeping(void);
21+
};
22+
23+
#endif
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
Enerlib: easy-to-use wrapper for AVR's Sleep library.
3+
By E.P.G. - 11/2010 - Ver. 1.0.0
4+
5+
When you call any methods for put Arduino in a low
6+
power state, it can only be waked up by triggering
7+
an interruption. If you don't use any interruption,
8+
you must reset Arduino to wake it.
9+
*/
10+
11+
#include <Enerlib.h>
12+
13+
Energy energy;
14+
15+
void INT0_ISR(void)
16+
{
17+
/*
18+
The WasSleeping function will return true if Arduino
19+
was sleeping before the IRQ. Subsequent calls to
20+
WasSleeping will return false until Arduino reenters
21+
in a low power state. The WasSleeping function should
22+
only be called in the ISR.
23+
*/
24+
if (energy.WasSleeping())
25+
{
26+
/*
27+
Arduino was waked up by IRQ.
28+
29+
If you shut down external peripherals before sleeping, you
30+
can reinitialize them here. Look on ATMega's datasheet for
31+
hardware limitations in the ISR when microcontroller just
32+
leave any low power state.
33+
*/
34+
}
35+
else
36+
{
37+
/*
38+
The IRQ happened in awake state.
39+
40+
This code is for the "normal" ISR.
41+
*/
42+
}
43+
}
44+
45+
void setup()
46+
{
47+
attachInterrupt(0, INT0_ISR, LOW);
48+
/*
49+
Pin 2 will be the "wake button". Due to uC limitations,
50+
it needs to be a level interrupt.
51+
For experienced programmers:
52+
ATMega's datasheet contains information about the rest of
53+
wake up sources. The Extended Standby is not implemented.
54+
*/
55+
56+
energy.PowerDown(); //Most power saving
57+
energy.Standby();
58+
energy.PowerSave();
59+
energy.SleepADC();
60+
energy.Idle(); //Least power saving
61+
62+
/*
63+
You should look on the ATMega328P's datasheet:
64+
http://www.atmel.com/dyn/resources/prod_documents/doc8271.pdf
65+
for more information about low power modes.
66+
*/
67+
}
68+
69+
void loop()
70+
{
71+
}

LIB/Enerlib/keywords.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#######################################
2+
# Syntax Coloring Map For IRremote
3+
#######################################
4+
5+
#######################################
6+
# Datatypes (KEYWORD1)
7+
#######################################
8+
9+
Energy KEYWORD1
10+
11+
#######################################
12+
# Methods and Functions (KEYWORD2)
13+
#######################################
14+
15+
PowerDown KEYWORD2
16+
Idle KEYWORD2
17+
SleepADC KEYWORD2
18+
PowerSave KEYWORD2
19+
Standby KEYWORD2
20+
WasSleeping KEYWORD2
21+
22+
23+
#######################################
24+
# Constants (LITERAL1)
25+
#######################################

LIB/RF433.zip

21.1 KB
Binary file not shown.

LIB/VirtualWire/CHANGES

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
1.10
2+
Updated this CHANGES file with changes since 1.4.
3+
4+
1.9 2012-02-07 Documentation updates
5+
Documentation updates
6+
7+
1.6 2012-01-10
8+
Fixed a problem where the receiver was always reenabled after
9+
transmission. Reported by David Bath
10+
11+
1.5 2011-09-09
12+
Added vx_tx_active() function.
13+
14+
1.4 2010-01-29
15+
Added vx_tx_active(), suggested by Alan Burlison.
16+
17+
1.3 2009-04-01
18+
Fixed a compatibility problem with ATMEGA328 of the new arduino
19+
Now use SIGNAL(TIMER1_COMPA_vect) instead of ISR(SIG_OUTPUT_COMPARE1A)
20+
as discussed in
21+
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1237714550/11
22+
and reported by Jaime Castro.
23+
24+
1.2 2009-03-30
25+
Fixed a problem that prevented compiling with arduino-0015
26+
Reported by Jaime Castro
27+
28+
1.1 2008-06-24
29+
Now can compile for atmega8
30+
Reported by creatrope
31+
32+
1.0 Original release

LIB/VirtualWire/LICENSE

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
This software is Copyright (C) 2008 Mike McCauley. Use is subject to license
2+
conditions. The main licensing options available are GPL V2 or Commercial:
3+
4+
Open Source Licensing GPL V2
5+
6+
This is the appropriate option if you want to share the source code of your
7+
application with everyone you distribute it to, and you also want to give them
8+
the right to share who uses it. If you wish to use this software under Open
9+
Source Licensing, you must contribute all your source code to the open source
10+
community in accordance with the GPL Version 2 when your application is
11+
distributed. See http://www.gnu.org/copyleft/gpl.html
12+
13+
Commercial Licensing
14+
15+
This is the appropriate option if you are creating proprietary applications
16+
and you are not prepared to distribute and share the source code of your
17+
application. Contact info@open.com.au for details.

LIB/VirtualWire/MANIFEST

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
VirtualWire/MANIFEST
2+
VirtualWire/README
3+
VirtualWire/LICENSE
4+
VirtualWire/CHANGES
5+
VirtualWire/VirtualWire.cpp
6+
VirtualWire/VirtualWire.h
7+
VirtualWire/examples/client/client.pde
8+
VirtualWire/examples/server/server.pde
9+
VirtualWire/examples/receiver/receiver.pde
10+
VirtualWire/examples/transmitter/transmitter.pde
11+
12+

0 commit comments

Comments
 (0)