~walmis/+junk/lpc17xx

« back to all changes in this revision

Viewing changes to test.cpp

  • Committer: Valmantas PalikÅ¡a
  • Date: 2011-10-12 09:45:00 UTC
  • Revision ID: walmis@balticum-tv.lt-20111012094500-yjrbbqtras8lwccf
latest

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
 
37
37
IOInterrupt int2(pin2);
38
38
 
39
 
SSP spi(0);
 
39
//SSP spi(0);
40
40
 
41
41
void interrupt() {
42
42
        led = !led;
43
43
}
44
44
 
 
45
class A {
 
46
public:
 
47
        A() {
 
48
                delay_busy(100);
 
49
                LPC_GPIO1->FIOPIN |= 1<<18;
 
50
        }
 
51
        virtual void test() {
 
52
                LPC_GPIO1->FIOPIN = 0;
 
53
        }
 
54
        virtual ~A() {
 
55
                delay_busy(100);
 
56
                LPC_GPIO1->FIOCLR |= 1<<18;
 
57
        }
 
58
 
 
59
};
 
60
 
 
61
class B : public A {
 
62
public:
 
63
        void test() {
 
64
                LPC_GPIO1->FIOPIN = 1;
 
65
        }
 
66
};
 
67
void yo() {
 
68
        B a;
 
69
        a.test();
 
70
}
 
71
//A b;
 
72
#include <malloc.h>
45
73
//const IO led2(LPC_GPIO0, 1<<5);
46
74
int main() {
47
75
        //IOPin led(1, 18);
50
78
        SYSTICK_Cmd(ENABLE);
51
79
 
52
80
        led.set_dir(1);
53
 
 
54
 
        spi.setup(9, SPI, 0);
 
81
        //b.test();
 
82
        yo();
 
83
 
 
84
 
 
85
        //A* a = new A;
 
86
 
 
87
        //spi.setup(9, SPI, 0);
55
88
 
56
89
        led = 1;
57
90
        pin2.set_mode(PINMODE_PULLDOWN);