Lindholm Engineers / Mbed 2 deprecated Ultrasonic_Firmware

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TI_Registers.h Source File

TI_Registers.h

00001 //Object file for SPI register action for a TI chip
00002 //Created on 7 December 2015 by Eric Lindholm
00003 //Member functions contained in TI_Registers.cpp
00004 
00005 #include "mbed.h"
00006 
00007 /** TI_Registers
00008  *   The TI_Registers class features an SPI connection to a TI chip.
00009  *   More documentation to come.
00010  */
00011 
00012 #ifndef TI_REGISTERS_H
00013 #define TI_REGISTERS_H
00014 
00015 //Abstract data definitions
00016 class TI_Registers 
00017 {
00018 public:
00019     /** Ultrasonic_Registers class
00020      *   To access the registers of the ultrasonic driver chip: the TDC1000
00021      *   MOSI is the pin which is assigned as serial out from the MCU.
00022      *   MISO is the pin which is assigned as serial in to the MCU.
00023      *   SCLK is the pin which is assigned as serial clock.
00024      *   SPICS is the chip select pin for the SPI connection.
00025      */
00026     TI_Registers(PinName MOSI, PinName MISO, PinName SCLK, PinName SPICS);
00027  
00028     /** registerRead8 function
00029      *   The registerRead functions individually read 1, 2, or 3 bytes of data.
00030      *   address is the address that is included in the TI documentation for the 
00031      *    register in question, and is 6 bits long.
00032      */
00033     int registerRead8(int);
00034      
00035     /** registerRead16 function
00036      *   The registerRead functions individually read 1, 2, or 3 bytes of data.
00037      *   address is the address that is included in the TI documentation for the 
00038      *    register in question, and is 6 bits long.
00039      */
00040     int registerRead16(int);
00041      
00042     /** registerRead24 function
00043      *   The registerRead functions individually read 1, 2, or 3 bytes of data.
00044      *   address is the address that is included in the TI documentation for the 
00045      *    register in question, and is 6 bits long.
00046      */
00047     int registerRead24(int);
00048 
00049     /** registerWrite function 
00050      *   The registerWrite function writes one byte of data to the register 
00051      *   address is the 8-bit address for the register in question, determined
00052      *    from the TI documentation for the chip: 6 bits.  
00053      *   contents is the 8 bits of data that will be written to the register.
00054      */
00055     void registerWrite(int, int);
00056 private:
00057     SPI device;
00058     DigitalOut cs;
00059 };
00060 
00061 #endif