Driver for a CD22M3494 cross point switcher
Library description
The CD22M3494 is a 16x8 crosspoint switch matrix, it can be used in any configuration i.e. 16 ins' 8 outs' or 16 outs' and 8 ins'. Control of the chip is pretty simple there are two parallel address buses a 4 byte address controls the X axis (16 IO pins) and a 3 byte address controls the Y axis (8 IO pins). A data bus says whether to open or close the switch and a 'strobe' bus actually performs the switch. This library provides a simple interface to control the CD22M3494 and provides a mechanism to associate source and destinations in pairs and switch the pairs via their names.
Diff: CD22M3494.h
- Revision:
- 6:3f51c9139496
- Parent:
- 5:ca315c82dc1b
- Child:
- 7:6dc462dd6a0a
--- a/CD22M3494.h Thu Sep 19 11:56:37 2013 +0000 +++ b/CD22M3494.h Wed Oct 09 12:48:33 2013 +0000 @@ -94,6 +94,12 @@ #define MAX_X 0x0F #define MAX_Y 0x7 +struct Association { + string name; + string xp1; + string xp2; +}; + /**A driver for the CD22M3494 crosspoint switch matrix. */ class CD22M3494 { @@ -157,7 +163,7 @@ associationTable.clear(); delete &associationTable; } - + /**Closes the switch at the given cross point. * * @param x the x axis @@ -212,7 +218,9 @@ assoc->xp1 = xp1; assoc->xp2 = xp2; associationTable[name] = assoc; + return true; } + return false; } /**Connects all the crosspoints for the given associations. @@ -242,18 +250,17 @@ } return false; } - + + Association* getAssociation(string name) { + return associationTable[name]; + } + private: BusOut *xbus; BusOut *ybus; DigitalOut *data; DigitalOut *obe; - DigitalOut *reset; - struct Association { - string name; - string xp1; - string xp2; - }; + DigitalOut *reset; map<string, Association*> associationTable; map<string, unsigned short> crosspointLookup; };