Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1702 - 1
#include <inttypes.h>
2
#include <avr/pgmspace.h>
3
 
4
//#include <Spi.h>
5
#include <Max3421e.h>
6
#include <Max3421e_constants.h>
7
#include <Max_LCD.h>
8
#include <Usb.h>
9
 
10
#include <ptp.h>
11
#include <ptpdebug.h>
12
#include "devinfoparser.h"
13
 
14
#define DEV_ADDR        1
15
 
16
// Canon EOS 400D
17
#define DATA_IN_EP      1
18
#define DATA_OUT_EP     2
19
#define INTERRUPT_EP    3
20
#define CONFIG_NUM      1
21
 
22
//Nikon Coolpix L110, P100
23
//#define DATA_IN_EP 2
24
//#define DATA_OUT_EP 1
25
 
26
void setup();
27
void loop();
28
 
29
class CamStateHandlers : public PTPStateHandlers
30
{
31
      bool stateConnected;
32
 
33
public:
34
      CamStateHandlers() : stateConnected(false) {};
35
 
36
      virtual void OnDeviceDisconnectedState(PTP *ptp);
37
      virtual void OnDeviceInitializedState(PTP *ptp);
38
} CamStates;
39
 
40
PTP  Ptp(DEV_ADDR, DATA_IN_EP, DATA_OUT_EP, INTERRUPT_EP, CONFIG_NUM, &CamStates);
41
 
42
void CamStateHandlers::OnDeviceDisconnectedState(PTP *ptp)
43
{
44
    if (stateConnected)
45
    {
46
        stateConnected = false;
47
        Notify(PSTR("Camera disconnected\r\n"));
48
    }
49
}
50
 
51
void CamStateHandlers::OnDeviceInitializedState(PTP *ptp)
52
{
53
    if (!stateConnected)
54
    {
55
        stateConnected = true;
56
        {
57
        	HexDump          dmp;
58
        	Ptp.GetDeviceInfo(&dmp);
59
                Notify(PSTR("\n"));
60
        }
61
        {
62
                DevInfoParser    prs;
63
        	Ptp.GetDeviceInfo(&prs);
64
        }
65
    }
66
}
67
 
68
void setup() {
69
  Serial.begin( 115200 );
70
  Serial.println("Start");
71
  Ptp.Setup();
72
  delay( 200 );
73
}
74
 
75
void loop() {
76
    Ptp.Task();
77
}
78