Versión de Firmware con funciones de RAM incorporadas.
Dependencies: mbed
Fork of VmRecorderV1dot1 by
KXR94/KXR94.h@0:3d456b8ce449, 2015-06-15 (annotated)
- Committer:
- JuanManuelAmador
- Date:
- Mon Jun 15 15:34:27 2015 +0000
- Revision:
- 0:3d456b8ce449
prueba
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JuanManuelAmador | 0:3d456b8ce449 | 1 | /** |
JuanManuelAmador | 0:3d456b8ce449 | 2 | * @author Juan Manuel Amador Olivares (virtualmech) |
JuanManuelAmador | 0:3d456b8ce449 | 3 | */ |
JuanManuelAmador | 0:3d456b8ce449 | 4 | |
JuanManuelAmador | 0:3d456b8ce449 | 5 | #ifndef KXR94_H |
JuanManuelAmador | 0:3d456b8ce449 | 6 | #define KXR94_H |
JuanManuelAmador | 0:3d456b8ce449 | 7 | |
JuanManuelAmador | 0:3d456b8ce449 | 8 | #include "mbed.h" |
JuanManuelAmador | 0:3d456b8ce449 | 9 | |
JuanManuelAmador | 0:3d456b8ce449 | 10 | #define CONVERTX 0x00 |
JuanManuelAmador | 0:3d456b8ce449 | 11 | #define CONVERTY 0x01 |
JuanManuelAmador | 0:3d456b8ce449 | 12 | #define CONVERTZ 0x02 |
JuanManuelAmador | 0:3d456b8ce449 | 13 | #define READREG 0x03 |
JuanManuelAmador | 0:3d456b8ce449 | 14 | #define WRITEREG 0x04 |
JuanManuelAmador | 0:3d456b8ce449 | 15 | #define CONVERTAUX 0x05 |
JuanManuelAmador | 0:3d456b8ce449 | 16 | |
JuanManuelAmador | 0:3d456b8ce449 | 17 | |
JuanManuelAmador | 0:3d456b8ce449 | 18 | /*-------------Hardware connections------------- |
JuanManuelAmador | 0:3d456b8ce449 | 19 | VIO----- mbed Vout (3.3 Volt) |
JuanManuelAmador | 0:3d456b8ce449 | 20 | SDI----- mbed mosi (p5) |
JuanManuelAmador | 0:3d456b8ce449 | 21 | SDO----- mbed miso (p6) |
JuanManuelAmador | 0:3d456b8ce449 | 22 | SCK----- mbed sck (p7) |
JuanManuelAmador | 0:3d456b8ce449 | 23 | CS------ mbed (p8) // chip select |
JuanManuelAmador | 0:3d456b8ce449 | 24 | GND----- mbed GND (0 Volt) |
JuanManuelAmador | 0:3d456b8ce449 | 25 | VDO----- mbed Vout (3.3 Volt) |
JuanManuelAmador | 0:3d456b8ce449 | 26 | there are no additional external components used |
JuanManuelAmador | 0:3d456b8ce449 | 27 | //----------------------------------------------*/ |
JuanManuelAmador | 0:3d456b8ce449 | 28 | |
JuanManuelAmador | 0:3d456b8ce449 | 29 | /** |
JuanManuelAmador | 0:3d456b8ce449 | 30 | * KXR94 triple axis, digital interface, accelerometer. |
JuanManuelAmador | 0:3d456b8ce449 | 31 | */ |
JuanManuelAmador | 0:3d456b8ce449 | 32 | class KXR94 { |
JuanManuelAmador | 0:3d456b8ce449 | 33 | |
JuanManuelAmador | 0:3d456b8ce449 | 34 | public: |
JuanManuelAmador | 0:3d456b8ce449 | 35 | /** |
JuanManuelAmador | 0:3d456b8ce449 | 36 | * Constructor. |
JuanManuelAmador | 0:3d456b8ce449 | 37 | * |
JuanManuelAmador | 0:3d456b8ce449 | 38 | * @param mosi mbed pin to use for MOSI line of SPI interface. |
JuanManuelAmador | 0:3d456b8ce449 | 39 | * @param miso mbed pin to use for MISO line of SPI interface. |
JuanManuelAmador | 0:3d456b8ce449 | 40 | * @param sck mbed pin to use for SCK line of SPI interface. |
JuanManuelAmador | 0:3d456b8ce449 | 41 | * @param cs mbed pin to use for not chip select line of SPI interface. |
JuanManuelAmador | 0:3d456b8ce449 | 42 | */ |
JuanManuelAmador | 0:3d456b8ce449 | 43 | KXR94(PinName mosi, PinName miso, PinName sck, PinName cs); |
JuanManuelAmador | 0:3d456b8ce449 | 44 | |
JuanManuelAmador | 0:3d456b8ce449 | 45 | void write_reg(char data); |
JuanManuelAmador | 0:3d456b8ce449 | 46 | char read_reg(); |
JuanManuelAmador | 0:3d456b8ce449 | 47 | |
JuanManuelAmador | 0:3d456b8ce449 | 48 | void ReadAccels_KXR94(int*); |
JuanManuelAmador | 0:3d456b8ce449 | 49 | |
JuanManuelAmador | 0:3d456b8ce449 | 50 | void AcelerometroSleep(void); //Pone el acelerometro en sleep mode para no consumir energía |
JuanManuelAmador | 0:3d456b8ce449 | 51 | void AcelerometroWakeUp(void); //Pone el acelerometro preparado para medir |
JuanManuelAmador | 0:3d456b8ce449 | 52 | |
JuanManuelAmador | 0:3d456b8ce449 | 53 | private: |
JuanManuelAmador | 0:3d456b8ce449 | 54 | |
JuanManuelAmador | 0:3d456b8ce449 | 55 | SPI spi_; |
JuanManuelAmador | 0:3d456b8ce449 | 56 | DigitalOut nCS_; |
JuanManuelAmador | 0:3d456b8ce449 | 57 | |
JuanManuelAmador | 0:3d456b8ce449 | 58 | }; |
JuanManuelAmador | 0:3d456b8ce449 | 59 | |
JuanManuelAmador | 0:3d456b8ce449 | 60 | #endif /* KXR94_H */ |