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:
- 1:bc9ca1d1d7a6
- Parent:
- 0:5ef90cd25c10
- Child:
- 2:25049dc7da13
--- a/CD22M3494.h Tue Sep 03 12:49:43 2013 +0000 +++ b/CD22M3494.h Tue Sep 10 21:34:24 2013 +0000 @@ -2,6 +2,12 @@ #define CD22M3494_H #include <mbed.h> + +#include <map> +//using std::map; +#include <string> +//using std::string; + /* X ADDRESS AX3 AX2 AX1 AX0 X SWITCH @@ -119,13 +125,39 @@ } return false; } - + + void associate(string name, unsigned short xp1, unsigned short xp2) { + unsigned short xps[2]; + xps[0] = xp1; + xps[1] = xp2; + associationTable[name] = xps; + } + + bool routeAssociations(string src, string dst) { + if (associationTable.count(src) && associationTable.count(dst)) { + crossPointConnect(associationTable[src][0], associationTable[dst][1]); + crossPointConnect(associationTable[src][0], associationTable[dst][1]); + return true; + } + return false; + } + + bool unRouteAssociations(string src, string dst) { + if (associationTable.count(src) && associationTable.count(dst)) { + crossPointDisconnect(associationTable[src][0], associationTable[dst][1]); + crossPointDisconnect(associationTable[src][0], associationTable[dst][1]); + return true; + } + return false; + } + private: BusOut* xbus; BusOut* ybus; DigitalOut* data; DigitalOut* strobe; - DigitalOut* reset; + DigitalOut* reset; + map<string, unsigned short*> associationTable; };