Delayed LED control using bools to save input values
Fork of MODSERIAL by
Device/AddingDevice.h@29:9a41078f0488, 2013-07-12 (annotated)
- Committer:
- Sissors
- Date:
- Fri Jul 12 15:56:20 2013 +0000
- Revision:
- 29:9a41078f0488
Added documentation
;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sissors | 29:9a41078f0488 | 1 | /* |
Sissors | 29:9a41078f0488 | 2 | |
Sissors | 29:9a41078f0488 | 3 | To add another device some functions/macros need to be defined. |
Sissors | 29:9a41078f0488 | 4 | The Device folder shows examples of other devices. |
Sissors | 29:9a41078f0488 | 5 | |
Sissors | 29:9a41078f0488 | 6 | 1. In MACROS.h the include to the macro file need to be added. |
Sissors | 29:9a41078f0488 | 7 | |
Sissors | 29:9a41078f0488 | 8 | 2. A <NameOfYourFile.h> file needs to be added, it needs to include the ifdef(target) statement, and definitions for: |
Sissors | 29:9a41078f0488 | 9 | MODSERIAL_IRQ_REG --- register which enables/disables serial IRQs |
Sissors | 29:9a41078f0488 | 10 | DISABLE_TX_IRQ --- macro that disables TX IRQs |
Sissors | 29:9a41078f0488 | 11 | DISABLE_RX_IRQ --- macro that disables RX IRQs |
Sissors | 29:9a41078f0488 | 12 | ENABLE_TX_IRQ --- macro that enables TX IRQs |
Sissors | 29:9a41078f0488 | 13 | ENABLE_RX_IRQ --- macro that enables RX IRQs |
Sissors | 29:9a41078f0488 | 14 | |
Sissors | 29:9a41078f0488 | 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 |
Sissors | 29:9a41078f0488 | 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 |
Sissors | 29:9a41078f0488 | 17 | |
Sissors | 29:9a41078f0488 | 18 | MODSERIAL_READ_REG --- register where RX data is in |
Sissors | 29:9a41078f0488 | 19 | MODSERIAL_WRITE_REG --- register where TX data is in (can be same as previous) |
Sissors | 29:9a41078f0488 | 20 | MODSERIAL_READABLE --- returns true if new data is available in read_reg |
Sissors | 29:9a41078f0488 | 21 | MODSERIAL_WRITABLE --- returns true if we may write new data in write_reg |
Sissors | 29:9a41078f0488 | 22 | |
Sissors | 29:9a41078f0488 | 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' |
Sissors | 29:9a41078f0488 | 24 | TX_IRQ_ENABLED --- checks if TX IRQs are enabled by MODSERIAL. See previous |
Sissors | 29:9a41078f0488 | 25 | |
Sissors | 29:9a41078f0488 | 26 | 3. A <NameOfYourFile.cpp> file needs to be added, it needs to include the ifdef(target) statement, and functions for: |
Sissors | 29:9a41078f0488 | 27 | void setBase(void) --- function that sets _base pointer to point to correct UART, and _IRQ pointer to point to correct IRQ. |
Sissors | 29:9a41078f0488 | 28 | |
Sissors | 29:9a41078f0488 | 29 | void initDevice(void)--- function that allows for setting registers after everything else is initialized, if required |
Sissors | 29:9a41078f0488 | 30 | |
Sissors | 29:9a41078f0488 | 31 | bool txIsBusy(void) --- function that returns true as long as long as device isn't done with transmitting |
Sissors | 29:9a41078f0488 | 32 | |
Sissors | 29:9a41078f0488 | 33 | */ |
Sissors | 29:9a41078f0488 | 34 |