Kouichi Iijima
/
KXP84-2050_test
main.cpp@4:da0bfca19735, 2011-06-17 (annotated)
- Committer:
- mr11451
- Date:
- Fri Jun 17 08:40:35 2011 +0000
- Revision:
- 4:da0bfca19735
- Parent:
- 0:ca2662a35eb0
pin connection comment.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mr11451 | 0:ca2662a35eb0 | 1 | #include "KXP84.h" |
mr11451 | 0:ca2662a35eb0 | 2 | |
mr11451 | 0:ca2662a35eb0 | 3 | #define VERSION 0 |
mr11451 | 0:ca2662a35eb0 | 4 | #define REVISION 1 |
mr11451 | 0:ca2662a35eb0 | 5 | |
mr11451 | 0:ca2662a35eb0 | 6 | #ifdef _DEBUG |
mr11451 | 0:ca2662a35eb0 | 7 | Serial debug(USBTX, USBRX); // tx, rx |
mr11451 | 0:ca2662a35eb0 | 8 | #define dbg(FMT,...) debug.printf(FMT, ##__VA_ARGS__) |
mr11451 | 0:ca2662a35eb0 | 9 | #else |
mr11451 | 0:ca2662a35eb0 | 10 | #define dbg(...) |
mr11451 | 0:ca2662a35eb0 | 11 | #endif |
mr11451 | 0:ca2662a35eb0 | 12 | |
mr11451 | 0:ca2662a35eb0 | 13 | void tickproc(); |
mr11451 | 0:ca2662a35eb0 | 14 | |
mr11451 | 0:ca2662a35eb0 | 15 | KXP84_2050 kxp84(p11,p12,p13,p14,p10); /* KXP84 compatible digital SPI input (PinName mosi, PinName miso, PinName sclk, PinName cs, PinName rst) */ |
mr11451 | 4:da0bfca19735 | 16 | /* SPI mode OUTPUT: |
mr11451 | 4:da0bfca19735 | 17 | * mbed KXP84-2050 or AE-KXP84 module |
mr11451 | 4:da0bfca19735 | 18 | * 10 ------ 8(RESET) 8(RESET) |
mr11451 | 4:da0bfca19735 | 19 | * 11 ------ 10(ADDRO/SDI) 9(ADDRO/SDI) |
mr11451 | 4:da0bfca19735 | 20 | * 12 ------ 11(SDA_SDO) 7(SDA_SDO) |
mr11451 | 4:da0bfca19735 | 21 | * 13 ------ 12(SCL/SCLK) 5(SCL/SCLK) |
mr11451 | 4:da0bfca19735 | 22 | * 14 ------ 9(CS) 10(CS) |
mr11451 | 4:da0bfca19735 | 23 | */ |
mr11451 | 4:da0bfca19735 | 24 | |
mr11451 | 0:ca2662a35eb0 | 25 | //KXM52_1050 kxm52(p10,p15,p16,p17); /* KXM52 compatible analog input (PinName power, PinName ix, PinName iy, PinName iz) */ |
mr11451 | 4:da0bfca19735 | 26 | /* ANALOG OUTOUT: |
mr11451 | 4:da0bfca19735 | 27 | * mbed KXM52-1050(or KXP84-2050 analog output) |
mr11451 | 4:da0bfca19735 | 28 | * 10 ------ 2(VDD) |
mr11451 | 4:da0bfca19735 | 29 | * 15 ------ 5(X_OUT) |
mr11451 | 4:da0bfca19735 | 30 | * 16 ------ 6(Y_OUT) |
mr11451 | 4:da0bfca19735 | 31 | * 17 ------ 7(Z_OUT) |
mr11451 | 4:da0bfca19735 | 32 | */ |
mr11451 | 0:ca2662a35eb0 | 33 | |
mr11451 | 0:ca2662a35eb0 | 34 | int main() { |
mr11451 | 0:ca2662a35eb0 | 35 | dbg("\rKXP84-2050 Test Program %d.%03d\r\n", VERSION, REVISION); |
mr11451 | 0:ca2662a35eb0 | 36 | kxp84.Set_Risthner(tickproc); |
mr11451 | 0:ca2662a35eb0 | 37 | kxp84.Start(); |
mr11451 | 0:ca2662a35eb0 | 38 | } |
mr11451 | 0:ca2662a35eb0 | 39 | |
mr11451 | 0:ca2662a35eb0 | 40 | void tickproc() |
mr11451 | 0:ca2662a35eb0 | 41 | { |
mr11451 | 0:ca2662a35eb0 | 42 | dbg("%4X %4X %4X\r\n", kxp84.Get_X(), kxp84.Get_Y(), kxp84.Get_Z() ); |
mr11451 | 0:ca2662a35eb0 | 43 | } |
mr11451 | 0:ca2662a35eb0 | 44 |