Difference between revisions of "DSerial Library"
m (→UART) |
|||
Line 14: | Line 14: | ||
Initializes DSerial. Returns <b>false</b> if DSerial wasn't detected. | Initializes DSerial. Returns <b>false</b> if DSerial wasn't detected. | ||
+ | |||
+ | <cpp> | ||
+ | typedef enum { DISCONNECTED, BOOTLOADER, FIRMWARE } DseStatus | ||
+ | DseStatus dseStatus() | ||
+ | </cpp> | ||
+ | |||
+ | Returns current state of the DSerail. | ||
<cpp> | <cpp> | ||
Line 20: | Line 27: | ||
Uploads raw [[firmware]] data into DSerial. <b>data</b> should be a proper [[Firmware Image]] with a CRC. Returns <b>false</b> if firmware upload failed. | Uploads raw [[firmware]] data into DSerial. <b>data</b> should be a proper [[Firmware Image]] with a CRC. Returns <b>false</b> if firmware upload failed. | ||
+ | |||
+ | <cpp> | ||
+ | bool dseMatchFirmware(char * data, unsigned int fwsize) | ||
+ | </cpp> | ||
<cpp> | <cpp> | ||
Line 26: | Line 37: | ||
Boots [[firmware]] if we're in [[bootloader]]. Boots bootloader if we're in firmware. Returns <b>false</b> if operation failed. | Boots [[firmware]] if we're in [[bootloader]]. Boots bootloader if we're in firmware. Returns <b>false</b> if operation failed. | ||
+ | |||
+ | <cpp> | ||
+ | void dseSetModes(unsigned char modes) | ||
+ | </cpp> | ||
=== UART === | === UART === | ||
Line 63: | Line 78: | ||
=== ADC === | === ADC === | ||
− | + | <cpp> | |
+ | uint8 dseAdcRead(char *buffer) | ||
+ | </cpp> | ||
+ | |||
+ | === Servos === | ||
+ | |||
+ | <cpp> | ||
+ | void dseServoSetAll(uint8 * positions) | ||
+ | </cpp> | ||
+ | |||
+ | <cpp> | ||
+ | void dseServoSet(uint16 servo, uint8 position) | ||
+ | </cpp> | ||
=== PWM === | === PWM === |
Revision as of 22:28, 3 July 2007
Contents
Description
libdserial allows to use DSerial in DS homebrews.
Note: The following sections are subject to change in the near future.
Functions
Configuration
<cpp> bool dseInit() </cpp>
Initializes DSerial. Returns false if DSerial wasn't detected.
<cpp> typedef enum { DISCONNECTED, BOOTLOADER, FIRMWARE } DseStatus DseStatus dseStatus() </cpp>
Returns current state of the DSerail.
<cpp> bool dseUploadFirmware(char * data, unsigned int size) </cpp>
Uploads raw firmware data into DSerial. data should be a proper Firmware Image with a CRC. Returns false if firmware upload failed.
<cpp> bool dseMatchFirmware(char * data, unsigned int fwsize) </cpp>
<cpp> bool dseBoot() </cpp>
Boots firmware if we're in bootloader. Boots bootloader if we're in firmware. Returns false if operation failed.
<cpp> void dseSetModes(unsigned char modes) </cpp>
UART
<cpp> bool dseUartSetBaudrate(unsigned int baudrate) </cpp>
Sets UART baud rate. Returns false if operation failed.
<cpp> void dseUartSetReceiveHandler(void (*receiveHandler)(char * data, unsigned int size)) </cpp>
Sets UART receive handler. Handler gets called when data has arrived. Set to NULL to stop.
<cpp> void dseUartSetSendHandler(int (*sendHandler)(void)) </cpp>
Sets UART send handler. Handler gets called when data send is completed. Set to NULL to stop.
<cpp> bool dseUartSendBuffer(char * data, unsigned int size, bool block = false) </cpp>
Sends data on the UART port. size is maximum 32. Returns false if something went wrong.
Tilt
To be written.
I/O
To be written.
ADC
<cpp> uint8 dseAdcRead(char *buffer) </cpp>
Servos
<cpp> void dseServoSetAll(uint8 * positions) </cpp>
<cpp> void dseServoSet(uint16 servo, uint8 position) </cpp>
PWM
To be written.
USB Device
To be written.
Misc
To be written.