bosko lekovic
/
IO_board_K22
K22 processor
Diff: temp/IOgpiospi.h
- Revision:
- 7:4aa3dac73b66
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/temp/IOgpiospi.h Sun Mar 21 18:20:15 2021 +0100 @@ -0,0 +1,39 @@ +#ifndef IOGPIOSPI_H +#define IOGPIOSPI_H + + +#include "mbed.h" + +//typedef void (*pf_pc_c)(char* tx, char rx); + + +class C_gpioSpi +{ + private: + DigitalIn *p_MOSI; + DigitalOut *p_MISO; + InterruptIn *p_SpiClock; + + char bitCount = 0; + char readData; + char writeData = 0; + // pf_pc_c transfer_fun = nullptr; + + void (*pfv) (void); + void spiClockCount_fun(void); + + public: + C_gpioSpi( /*PinName Mosi, PinName Miso, PinName spiClock*/ ); + // void attach( pf_pc_c fun) { transfer_fun = fun;} + virtual void spiByteTransfer( char * tx, char rx) = 0; + char get_bitCount( void ) { return bitCount;} + void clear_bitCount( void ) { bitCount = 0;} + + void spi_monitor( void ); + +}; + + + + +#endif \ No newline at end of file