Commit | Line | Data |
---|---|---|
4c5afeb9 MZ |
1 | /* File: ftdi.i */ |
2 | ||
3 | %module(docstring="Python interface to libftdi") ftdi | |
4 | ||
05c0dae8 TH |
5 | %include "typemaps.i" |
6 | %include "cpointer.i" | |
4c5afeb9 | 7 | %include "cstring.i" |
f5b59bd6 | 8 | |
05c0dae8 | 9 | %typemap(in) unsigned char* = char*; |
4c5afeb9 | 10 | |
05c0dae8 TH |
11 | %ignore ftdi_write_data_async; |
12 | %ignore ftdi_async_complete; | |
13 | ||
b060307c TJ |
14 | %immutable ftdi_version_info::version_str; |
15 | %immutable ftdi_version_info::snapshot_str; | |
16 | ||
4c5afeb9 | 17 | %rename("%(strip:[ftdi_])s") ""; |
b790d38e | 18 | |
4c5afeb9 MZ |
19 | %apply char *OUTPUT { char * manufacturer }; |
20 | %apply char *OUTPUT { char * description }; | |
21 | %apply char *OUTPUT { char * serial }; | |
22 | %cstring_bounded_output( char * manufacturer, 256 ); | |
23 | %cstring_bounded_output( char * description, 256 ); | |
24 | %cstring_bounded_output( char * serial, 256 ); | |
25 | int ftdi_usb_get_strings(struct ftdi_context *ftdi, struct libusb_device *dev, | |
26 | char * manufacturer, int mnf_len, | |
27 | char * description, int desc_len, | |
28 | char * serial, int serial_len); | |
29 | %clear char * manufacturer; | |
30 | %clear char * description; | |
31 | %clear char * serial; | |
05c0dae8 TH |
32 | |
33 | %apply char *OUTPUT { unsigned char *buf }; | |
34 | int ftdi_read_data(struct ftdi_context *ftdi, unsigned char *buf, int size); | |
35 | %clear unsigned char *buf; | |
f0005c33 | 36 | |
05c0dae8 TH |
37 | %apply int *OUTPUT { unsigned int *chunksize }; |
38 | int ftdi_read_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize); | |
39 | int ftdi_write_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize); | |
40 | %clear unsigned int *chunksize; | |
f0005c33 | 41 | |
05c0dae8 TH |
42 | %apply char *OUTPUT { unsigned char *pins }; |
43 | int ftdi_read_pins(struct ftdi_context *ftdi, unsigned char *pins); | |
44 | %clear unsigned char *pins; | |
f0005c33 | 45 | |
05c0dae8 TH |
46 | %apply char *OUTPUT { unsigned char *latency }; |
47 | int ftdi_get_latency_timer(struct ftdi_context *ftdi, unsigned char *latency); | |
f0005c33 TJ |
48 | %clear unsigned char *latency; |
49 | ||
4c5afeb9 | 50 | %apply short *OUTPUT { unsigned short *status }; |
05c0dae8 | 51 | int ftdi_poll_modem_status(struct ftdi_context *ftdi, unsigned short *status); |
f0005c33 TJ |
52 | %clear unsigned short *status; |
53 | ||
4c5afeb9 MZ |
54 | %apply int *OUTPUT { int* value }; |
55 | int ftdi_get_eeprom_value(struct ftdi_context *ftdi, enum ftdi_eeprom_value value_name, int* value); | |
56 | %clear int* value; | |
f0005c33 | 57 | |
4c5afeb9 MZ |
58 | %apply short *OUTPUT { unsigned short *eeprom_val }; |
59 | int ftdi_read_eeprom_location (struct ftdi_context *ftdi, int eeprom_addr, unsigned short *eeprom_val); | |
60 | %clear unsigned short *eeprom_val; | |
f0005c33 | 61 | |
05c0dae8 TH |
62 | %apply int *OUTPUT { unsigned int *chipid }; |
63 | int ftdi_read_chipid(struct ftdi_context *ftdi, unsigned int *chipid); | |
64 | %clear unsigned int *chipid; | |
65 | ||
4c5afeb9 MZ |
66 | %include ftdi.h |
67 | %{ | |
68 | #include <ftdi.h> | |
69 | %} | |
70 | ||
71 | %include ftdi_i.h | |
72 | %{ | |
73 | #include <ftdi_i.h> | |
74 | %} | |
75 | ||
76 | %pointer_functions(struct ftdi_device_list *, device_listpp) |