BaseMachine OscController Library
Revision 7:03f0c7e507ce, committed 2017-02-13
- Comitter:
- ryood
- Date:
- Mon Feb 13 19:20:56 2017 +0000
- Parent:
- 6:edb527640651
- Parent:
- 5:dda1279a1bf4
- Commit message:
- Test OK.
Changed in this revision
SpiOscController.h | Show annotated file Show diff for this revision Revisions of this file |
SpiOscController.h.orig | Show diff for this revision Revisions of this file |
diff -r edb527640651 -r 03f0c7e507ce SpiOscController.h --- a/SpiOscController.h Mon Feb 13 19:20:17 2017 +0000 +++ b/SpiOscController.h Mon Feb 13 19:20:56 2017 +0000 @@ -40,7 +40,7 @@ pSpiM->write(pulseWidth); pSpiM->write(frequency10 >> 8); pSpiM->write(frequency10 & 0xff); - SPI_WAIT; + //SPI_WAIT; DcoCS = 1; }
diff -r edb527640651 -r 03f0c7e507ce SpiOscController.h.orig --- a/SpiOscController.h.orig Mon Feb 13 19:20:17 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * BaseMachine SpiOscController - * - * mbed Rev 135 / mbed-rtos Rev 123 - * - * 2017.02.13 - * - */ -#ifndef _SPI_OSC_CONTROLLER_H_ -#define _SPI_OSC_CONTROLLER_H_ - -#include "mbed.h" -#include "OscController.h" - -#define DCO_PACKET_HEADER (0x55) -#define SPI_WAIT (wait_us(1)) - -class SpiOscController : public OscController { -public: - SpiOscController(SPI* _pSpim, PinName _DcoCS, uint8_t _waveShape=WAVESHAPE_SQUARE, uint8_t _pulseWidth=127) : - OscController(_waveShape, _pulseWidth), - pSpiM(_pSpim), - DcoCS(_DcoCS, 1) {} - - virtual void outDco() - { - #if(UART_TRACE) - OscController.outDco(); - printf("%d\t", DCO_PACKET_HEADER); - printf("%d\t", waveShape); - printf("%d\t", pulseWidth); - printf("%d\t", frequency10 >> 8); - printf("%d\t", frequency10 & 0xff); - printf("\r\n"); - #endif - - DcoCS = 0; - pSpiM->write(DCO_PACKET_HEADER); - pSpiM->write(waveShape); - pSpiM->write(pulseWidth); - pSpiM->write(frequency10 >> 8); - pSpiM->write(frequency10 & 0xff); - SPI_WAIT; - DcoCS = 1; - } - -private: - SPI* pSpiM; - DigitalOut DcoCS; -}; - -#endif //_SPI_OSC_CONTROLLER_H_