Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
iC_MU.h@1:ae562ccce5bd, 2015-04-02 (annotated)
- Committer:
- ms523
- Date:
- Thu Apr 02 07:33:39 2015 +0000
- Revision:
- 1:ae562ccce5bd
- Parent:
- 0:ed3c161e6715
Working on small NAB PCBs
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ms523 | 0:ed3c161e6715 | 1 | #ifndef MBED_IC_MU_H |
| ms523 | 0:ed3c161e6715 | 2 | #define MBED_IC_MU_H |
| ms523 | 0:ed3c161e6715 | 3 | |
| ms523 | 0:ed3c161e6715 | 4 | #include "mbed.h" |
| ms523 | 0:ed3c161e6715 | 5 | |
| ms523 | 0:ed3c161e6715 | 6 | class iC_MU { |
| ms523 | 0:ed3c161e6715 | 7 | public: |
| ms523 | 0:ed3c161e6715 | 8 | /** |
| ms523 | 0:ed3c161e6715 | 9 | * Constructor. |
| ms523 | 0:ed3c161e6715 | 10 | */ |
| ms523 | 0:ed3c161e6715 | 11 | iC_MU(PinName mosi, PinName miso, PinName sclk, PinName cs); |
| ms523 | 0:ed3c161e6715 | 12 | |
| ms523 | 0:ed3c161e6715 | 13 | /** |
| ms523 | 0:ed3c161e6715 | 14 | * Request the device status |
| ms523 | 0:ed3c161e6715 | 15 | * |
| ms523 | 0:ed3c161e6715 | 16 | * returns the current status |
| ms523 | 0:ed3c161e6715 | 17 | */ |
| ms523 | 0:ed3c161e6715 | 18 | int RequestSTATUS(); |
| ms523 | 0:ed3c161e6715 | 19 | |
| ms523 | 0:ed3c161e6715 | 20 | /** |
| ms523 | 0:ed3c161e6715 | 21 | * Reads the specified reg |
| ms523 | 0:ed3c161e6715 | 22 | * |
| ms523 | 0:ed3c161e6715 | 23 | * @returns the reg contents |
| ms523 | 0:ed3c161e6715 | 24 | */ |
| ms523 | 0:ed3c161e6715 | 25 | int ReadREGISTER(char reg); |
| ms523 | 0:ed3c161e6715 | 26 | |
| ms523 | 0:ed3c161e6715 | 27 | /** |
| ms523 | 0:ed3c161e6715 | 28 | * Writes to the specified reg. |
| ms523 | 0:ed3c161e6715 | 29 | * |
| ms523 | 0:ed3c161e6715 | 30 | * @returns the device reply |
| ms523 | 0:ed3c161e6715 | 31 | */ |
| ms523 | 0:ed3c161e6715 | 32 | int WriteREGISTER(char reg, char data); |
| ms523 | 0:ed3c161e6715 | 33 | |
| ms523 | 0:ed3c161e6715 | 34 | /** |
| ms523 | 0:ed3c161e6715 | 35 | * Send the activate cmd |
| ms523 | 0:ed3c161e6715 | 36 | * |
| ms523 | 0:ed3c161e6715 | 37 | * @returns the device reply |
| ms523 | 0:ed3c161e6715 | 38 | */ |
| ms523 | 0:ed3c161e6715 | 39 | int ACTIVATE(char reg); |
| ms523 | 0:ed3c161e6715 | 40 | |
| ms523 | 0:ed3c161e6715 | 41 | /** |
| ms523 | 0:ed3c161e6715 | 42 | * Read the current position |
| ms523 | 0:ed3c161e6715 | 43 | * |
| ms523 | 0:ed3c161e6715 | 44 | * @returns the position as an int |
| ms523 | 0:ed3c161e6715 | 45 | */ |
| ms523 | 0:ed3c161e6715 | 46 | int ReadPOSITION(); |
| ms523 | 0:ed3c161e6715 | 47 | |
| ms523 | 0:ed3c161e6715 | 48 | /** |
| ms523 | 0:ed3c161e6715 | 49 | * Sets the iC_MU up as the eval board was sniffed. |
| ms523 | 0:ed3c161e6715 | 50 | * Not sure we need to do this??? |
| ms523 | 0:ed3c161e6715 | 51 | * |
| ms523 | 0:ed3c161e6715 | 52 | * @returns 1 |
| ms523 | 0:ed3c161e6715 | 53 | */ |
| ms523 | 0:ed3c161e6715 | 54 | int initalise(); |
| ms523 | 0:ed3c161e6715 | 55 | |
| ms523 | 0:ed3c161e6715 | 56 | private: |
| ms523 | 0:ed3c161e6715 | 57 | SPI _spi; |
| ms523 | 0:ed3c161e6715 | 58 | DigitalOut _ncs; |
| ms523 | 0:ed3c161e6715 | 59 | }; |
| ms523 | 0:ed3c161e6715 | 60 | |
| ms523 | 0:ed3c161e6715 | 61 | #endif |