Library for TI's DRV2667
Diff: DRV2667.h
- Revision:
- 2:101901b3f05e
- Parent:
- 1:a57042b30965
- Child:
- 3:870dc06a0e8a
--- a/DRV2667.h Thu Feb 08 02:12:16 2018 +0000 +++ b/DRV2667.h Thu Feb 08 07:38:17 2018 +0000 @@ -49,64 +49,80 @@ DRV2667(I2C &i2c, InputMux im = Digital, Gain gn = GNx1, Timeout to = TOx1); /** - Write value to specified register of device - @param reg The device register to write - @param value The value to write to the register + * Write value to specified register of device + * @param reg The device register to write + * @param value The value to write to the register */ void i2cWriteByte(char reg, char value); /** - Read value from register of device - @param reg The device register to read - @return The result + * Read value from register of device + * @param reg The device register to read + * @return The result */ char i2cReadByte(char reg); + + /** + * Initialize the device + * + * @param im DRV2667::Digital or DRV2667::Analog + * @param gn gain for the amplifier + * @param to timeout for FIFO interface (digital input only) + */ + void init(InputMux im = Digital, Gain gn = GNx1, Timeout to = TOx1); /** - Starts waveform playback + * Reset the device + */ + void reset(); + + /** + * Starts waveform playback */ void play(); /** - Cancel waveform playback + * Cancel waveform playback */ void stop(); /** - Set sequencer to play waveform - - @param id array of waveform ID in RAM - @param setNum the number of waveform to set + * Set sequencer to play waveform + * + * @param id array of waveform ID in RAM + * @param setNum the number of waveform to set */ void setWaveform(char* id, char setNum); ///** - // Entry point for FIFO data read out automatically at an 8-kHz sampling rate - // - // @param data signed 8-bit data - // @param size size of waveform - // To be implemented + //* Entry point for FIFO data read out automatically at an 8-kHz sampling rate + //* + //* @param data signed 8-bit data + //* @param size size of waveform + //* To be implemented //*/ //void loadFIFO(signed char* data, char size); /** - Set internal wavefrom storage for the Waveform Synthesis Playback mode - @param data[][0] Peak voltage = amp / 255 x Gain / 2 - @param data[][1] Sinusoidal frequency - @param data[][2] Number of cycles to be played - @param data[][3] The envelope setting: bits [7:4] sets ramp-up rate; - bits [3:0] sets ramp-down rate. 0x00 NoEnvelope; 0x01 - 32ms; 0x02 64ms; 0x03 96ms; 0x04 128ms; 0x05 160ms; - 0x06 192ms; 0x07 224ms; 0x08 256ms; 0x09 512ms; 0x0A - 768ms; 0x0B 1024ms; 0xC 1280ms; 0x0D 1536ms; 0x0E - 1792ms; 0x0F 2048ms. - @param waveNum the number of waveform + * Set internal wavefrom storage for the Waveform Synthesis Playback mode + * @param data[][0] Peak voltage = amp / 255 x Gain / 2 + * @param data[][1] Sinusoidal frequency + * @param data[][2] Number of cycles to be played + * @param data[][3] The envelope setting: bits [7:4] sets ramp-up rate; + * bits [3:0] sets ramp-down rate. 0x00 NoEnvelope; 0x01 + * 32ms; 0x02 64ms; 0x03 96ms; 0x04 128ms; 0x05 160ms; + * 0x06 192ms; 0x07 224ms; 0x08 256ms; 0x09 512ms; 0x0A + * 768ms; 0x0B 1024ms; 0xC 1280ms; 0x0D 1536ms; 0x0E + * 1792ms; 0x0F 2048ms. + * @param data[][4] Number of repeat. Setting "0" plays infinite loop until + * the GO bit is cleared by the user. + * @param waveNum the number of waveform */ - void setWSP(char data[][4], char waveNum); + void setWSP(char data[][5], char waveNum); ///** - // Set internal wavefrom storage for the Direct Playback from RAM mode - // To be implemented + //* Set internal wavefrom storage for the Direct Playback from RAM mode + //* To be implemented //*/ //void setDPR(void);