Mark Vandermeulen / FYDP_Final2

Dependencies:   Servo mbed

Committer:
majik
Date:
Sat Mar 21 21:31:29 2015 +0000
Revision:
0:21019d94ad33
Both IMUs work now

Who changed what in which revision?

UserRevisionLine numberNew contents of line
majik 0:21019d94ad33 1 /*
majik 0:21019d94ad33 2
majik 0:21019d94ad33 3 To add another device some functions/macros need to be defined.
majik 0:21019d94ad33 4 The Device folder shows examples of other devices.
majik 0:21019d94ad33 5
majik 0:21019d94ad33 6 1. In MACROS.h the include to the macro file need to be added.
majik 0:21019d94ad33 7
majik 0:21019d94ad33 8 2. A <NameOfYourFile.h> file needs to be added, it needs to include the ifdef(target) statement, and definitions for:
majik 0:21019d94ad33 9 MODSERIAL_IRQ_REG --- register which enables/disables serial IRQs
majik 0:21019d94ad33 10 DISABLE_TX_IRQ --- macro that disables TX IRQs
majik 0:21019d94ad33 11 DISABLE_RX_IRQ --- macro that disables RX IRQs
majik 0:21019d94ad33 12 ENABLE_TX_IRQ --- macro that enables TX IRQs
majik 0:21019d94ad33 13 ENABLE_RX_IRQ --- macro that enables RX IRQs
majik 0:21019d94ad33 14
majik 0:21019d94ad33 15 RESET_TX_FIFO --- macro that resets TX FIFO buffer, if applicable. If not, something like while(1==0) won't do anything and doesn't generate compiler warnings
majik 0:21019d94ad33 16 RESET_RX_FIFO --- macro that resets RX FIFO buffer, if no hardware options, you can also read data until no more data is available
majik 0:21019d94ad33 17
majik 0:21019d94ad33 18 MODSERIAL_READ_REG --- register where RX data is in
majik 0:21019d94ad33 19 MODSERIAL_WRITE_REG --- register where TX data is in (can be same as previous)
majik 0:21019d94ad33 20 MODSERIAL_READABLE --- returns true if new data is available in read_reg
majik 0:21019d94ad33 21 MODSERIAL_WRITABLE --- returns true if we may write new data in write_reg
majik 0:21019d94ad33 22
majik 0:21019d94ad33 23 RX_IRQ_ENABLED --- checks if RX IRQs are enabled by MODSERIAL. Only required if the device has no registers that tell which IRQ fired. If those registers are available (LPCs have then), may just be 'true'
majik 0:21019d94ad33 24 TX_IRQ_ENABLED --- checks if TX IRQs are enabled by MODSERIAL. See previous
majik 0:21019d94ad33 25
majik 0:21019d94ad33 26 3. A <NameOfYourFile.cpp> file needs to be added, it needs to include the ifdef(target) statement, and functions for:
majik 0:21019d94ad33 27 void setBase(void) --- function that sets _base pointer to point to correct UART, and _IRQ pointer to point to correct IRQ.
majik 0:21019d94ad33 28
majik 0:21019d94ad33 29 void initDevice(void)--- function that allows for setting registers after everything else is initialized, if required
majik 0:21019d94ad33 30
majik 0:21019d94ad33 31 bool txIsBusy(void) --- function that returns true as long as long as device isn't done with transmitting
majik 0:21019d94ad33 32
majik 0:21019d94ad33 33 */
majik 0:21019d94ad33 34