|
void | systemInit (void) |
|
static void | morse_nibble (u8 nibble) |
|
static void | showError (u8 errorCode, u8 blinkState) |
|
int | main (void) |
|
u8 | applPeripheralReset (void) |
|
u8 | applProcessCmd (u8 protocol, u16 rxSize, const u8 *rxData, u16 *txSize, u8 *txData) |
|
u8 | applProcessCyclic (u8 *protocol, u16 *txSize, u8 *txData, u16 remainingSize) |
|
const char * | applFirmwareInformation () |
|
u8 | cmdReadReg (u16 rxSize, const u8 *rxData, u16 *txSize, u8 *txData) |
|
u8 | applReadReg (u16 rxSize, const u8 *rxData, u16 *txSize, u8 *txData) |
|
u8 | cmdWriteReg (u16 rxSize, const u8 *rxData, u16 *txSize, u8 *txData) |
|
u8 | applWriteReg (u16 rxSize, const u8 *rxData, u16 *txSize, u8 *txData) |
|
System initialization and main loop.
- Author
- Ulrich Herrmann
-
Bernhard Breinbauer
Definition in file main.c.
u8 applProcessCmd |
( |
u8 |
protocol, |
|
|
u16 |
rxSize, |
|
|
const u8 * |
rxData, |
|
|
u16 * |
txSize, |
|
|
u8 * |
txData |
|
) |
| |
Command dispatcher for application-specific commands.
function which can be implemented by the application process application- specific commands for I/O. If data should be returned, the txData buffer can be filled with data which should be sent to the PC. In argument txSize, the size is returned.
- Parameters
-
[in] | protocol | : the protocol byte which needs to be processed |
[in] | rxData | : pointer to payload for appl commands (in stream protocol buffer). |
[in] | rxSize | : size of rxData |
[out] | txData | : pointer to buffer to store returned data (payload only) |
[out] | txSize | : size of returned data |
- Returns
- the status byte to be interpreted by the stream layer on the host
Definition at line 396 of file main.c.
u8 applProcessCyclic |
( |
u8 * |
protocol, |
|
|
u16 * |
txSize, |
|
|
u8 * |
txData, |
|
|
u16 |
remainingSize |
|
) |
| |
Called cyclic (even when no full usb packet was received). Use this is you need to send several packets (time delayed) in response to one usb request.
function which can be implemented by the application process If data should be returned, the txData buffer must be filled with the data to be sent to the PC. In argument txSize, the size is returned. The function also must fill in the protocol byte (this is the protocol value that is filled in in the protocol header.
- Parameters
-
[out] | protocol | : protocol byte to be used for the packet header |
[out] | txData | : pointer to buffer to store returned data (payload only) |
[out] | txSize | : size of returned data |
[in] | remainingSize | : how many bytes are free in the buffer txData |
- Returns
- the status byte to be interpreted by the stream layer on the host
Definition at line 403 of file main.c.
u8 applReadReg |
( |
u16 |
rxSize, |
|
|
const u8 * |
rxData, |
|
|
u16 * |
txSize, |
|
|
u8 * |
txData |
|
) |
| |
Generic function to read one or more registers.
Function which can be implemented by the application to read registers. If data should be returned, the txData buffer must be filled with the data to be sent to the PC. In argument txSize, the size is returned. The function also must fill in the protocol byte (this is the protocol value that is filled in in the protocol header.
- Parameters
-
[in] | rxData | : pointer to payload for appl commands (in stream protocol buffer). |
[in] | rxSize | : size of rxData |
[out] | txData | : pointer to buffer to store returned data (payload only) |
[out] | txSize | : size of returned data |
- Returns
- the status byte to be interpreted by the stream layer on the host
Definition at line 480 of file main.c.
u8 applWriteReg |
( |
u16 |
rxSize, |
|
|
const u8 * |
rxData, |
|
|
u16 * |
txSize, |
|
|
u8 * |
txData |
|
) |
| |
Generic function to write one or more registers.
Function which can be implemented by the application to write registers. If data should be returned, the txData buffer must be filled with the data to be sent to the PC. In argument txSize, the size is returned. The function also must fill in the protocol byte (this is the protocol value that is filled in in the protocol header.
- Parameters
-
[in] | rxData | : pointer to payload for appl commands (in stream protocol buffer). |
[in] | rxSize | : size of rxData |
[out] | txData | : pointer to buffer to store returned data (payload only) |
[out] | txSize | : size of returned data |
- Returns
- the status byte to be interpreted by the stream layer on the host
Definition at line 509 of file main.c.
u8 cmdReadReg |
( |
u16 |
rxSize, |
|
|
const u8 * |
rxData, |
|
|
u16 * |
txSize, |
|
|
u8 * |
txData |
|
) |
| |
This function reads one or all registers from the AS3993. See also applReadReg().
The format of the report from the host is as follows:
Byte | 0 | 1 |
Content | mode | reg_addr |
Where mode = 0 requests to read all registers and mode = 1 requests to read only the register with address reg_addr. If mode = 0 reg_addr is ignored.
If mode = 0 the device sends back:
Byte | 0 | .. | 29 | 30 | 31 | .. | 36 | 37 | 38 | 48 |
Content | reg 0x00 | .. | reg 0x1D | reg 0x22 | reg 0x29 | .. | reg 0x2E | reg 0x33 | reg 0x35 | .. | reg 0x3F |
If mode = 1 the device sends back:
returns ERR_NONE if operation was successful, ERR_PARAM is invalid mode was set.
Definition at line 460 of file main.c.
u8 cmdWriteReg |
( |
u16 |
rxSize, |
|
|
const u8 * |
rxData, |
|
|
u16 * |
txSize, |
|
|
u8 * |
txData |
|
) |
| |
This function writes one register on the AS3993. See also applWriteReg().
The format of the report from the host is as follows:
Byte | 0 | 1 |
Content | reg_addr | value |
if reg_addr > 0x80, then an immediate command is executed.
The device sends back:
returns ERR_NONE if operation was successful.
Definition at line 500 of file main.c.