communication mbed/pld altera lib

Dependents:   scooter_mbed_etudiant scooter_mbed_correction_mbed_os scooter_ scooter_mbed_etudiant_fini_1 ... more

Committer:
superphil06
Date:
Sun Aug 23 14:16:56 2015 +0000
Revision:
2:01a42472c867
Parent:
1:7b4e6771a530
update documentation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
superphil06 0:49abff3f269a 1
superphil06 0:49abff3f269a 2 /** bloc_io class.
superphil06 0:49abff3f269a 3 * Used for exchange byte with altera 7064 PLD.
superphil06 0:49abff3f269a 4 *
superphil06 0:49abff3f269a 5 * Example:
superphil06 0:49abff3f269a 6 * @code
superphil06 0:49abff3f269a 7 * #include "mbed.h"
superphil06 0:49abff3f269a 8 * #include "bloc_io.h"
superphil06 0:49abff3f269a 9 *
superphil06 0:49abff3f269a 10 * Bloc_IO My_PLD (pin RD_WRn,pin CS, pin D0......,pin D7);
superphil06 0:49abff3f269a 11 * unsigned char byVal;
superphil06 0:49abff3f269a 12 *
superphil06 0:49abff3f269a 13 * int main() {
superphil06 0:49abff3f269a 14 * My_PLD.write (byVal);// send byte from Mbed to PLD
superphil06 0:49abff3f269a 15 * byVal=My_PLD.read();// read byre from PLD to Mbed
superphil06 0:49abff3f269a 16 * }
superphil06 0:49abff3f269a 17 * @endcode
superphil06 0:49abff3f269a 18 */
superphil06 2:01a42472c867 19
superphil06 2:01a42472c867 20 #ifndef BLOC_IO_H
superphil06 2:01a42472c867 21
superphil06 2:01a42472c867 22
superphil06 2:01a42472c867 23
superphil06 2:01a42472c867 24 #define BLOC_IO_H
superphil06 2:01a42472c867 25
superphil06 2:01a42472c867 26 #include "mbed.h"
superphil06 2:01a42472c867 27
superphil06 2:01a42472c867 28
superphil06 2:01a42472c867 29
superphil06 0:49abff3f269a 30
superphil06 0:49abff3f269a 31 class Bloc_IO {
superphil06 0:49abff3f269a 32 public:
superphil06 0:49abff3f269a 33 /** Bloc_IO construct
superphil06 0:49abff3f269a 34 *
superphil06 0:49abff3f269a 35 * @param RD_WRn pin reserved for R/W control signal on mbed
superphil06 0:49abff3f269a 36 * @param CS pin reserved for chip select control signal on mbed
superphil06 0:49abff3f269a 37 * @param __D0 pin reserved for lsb on Mbed data bus
superphil06 0:49abff3f269a 38 * @param __D7 pin reserved for msb on Mbed data bus
superphil06 0:49abff3f269a 39 * @returns
superphil06 0:49abff3f269a 40 * no return
superphil06 0:49abff3f269a 41 */
superphil06 0:49abff3f269a 42 Bloc_IO(PinName RD_WRn,PinName CS,PinName __D0,PinName __D1,PinName __D2,PinName __D3,PinName __D4,PinName __D5,PinName __D6,PinName __D7);
superphil06 0:49abff3f269a 43
superphil06 0:49abff3f269a 44 /** read byte method
superphil06 1:7b4e6771a530 45 * @param : no parameter
superphil06 0:49abff3f269a 46 * @returns
superphil06 1:7b4e6771a530 47 * byte red from PLD
superphil06 0:49abff3f269a 48 */
superphil06 0:49abff3f269a 49 unsigned char read(void);
superphil06 0:49abff3f269a 50
superphil06 0:49abff3f269a 51 /** write byte method
superphil06 0:49abff3f269a 52 *@param byWrVal: byte to write to PLD
superphil06 0:49abff3f269a 53 * @returns
superphil06 0:49abff3f269a 54 * no returns
superphil06 0:49abff3f269a 55 */
superphil06 0:49abff3f269a 56 void write (unsigned char byWrVal);
superphil06 0:49abff3f269a 57
superphil06 0:49abff3f269a 58
superphil06 0:49abff3f269a 59 private:
superphil06 0:49abff3f269a 60 DigitalOut _RD_WRn;
superphil06 0:49abff3f269a 61 DigitalOut _CS;
superphil06 0:49abff3f269a 62 BusInOut Bloc_IoPort;
superphil06 1:7b4e6771a530 63
superphil06 0:49abff3f269a 64
superphil06 0:49abff3f269a 65
superphil06 0:49abff3f269a 66 };
superphil06 0:49abff3f269a 67
superphil06 0:49abff3f269a 68
superphil06 1:7b4e6771a530 69 #endif