Fork of the MODSERIAL library by Erik Olieman.

Dependents:   trs_master

Fork of MODSERIAL by Erik -

Committer:
Sissors
Date:
Sun Feb 08 19:59:54 2015 +0000
Revision:
45:8ef4f91813fd
Parent:
35:9a41078f0488
Added K22F support (probably)

Who changed what in which revision?

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