Difference between revisions of "DSerial Library"

From NaWiki
Jump to: navigation, search
(UART)
Line 30: Line 30:
  
 
<cpp>
 
<cpp>
bool dseUartSetBaudrate(unsigned int baudrate)
+
bool dseUartSetBaudrate(DseUart uart, unsigned int baudrate)
 
</cpp>
 
</cpp>
  
Sets [[UART]] baud rate. Returns <b>false</b> if operation failed.
+
Sets baud rate for given UART. Returns <b>false</b> if operation failed.
  
 
<cpp>
 
<cpp>
void dseUartSetReceiveHandler(void (*receiveHandler)(char * data, unsigned int size))
+
void dseUartSetReceiveHandler(DseUart uart, void (*receiveHandler)(char * data, unsigned int size))
 
</cpp>
 
</cpp>
  
Sets [[UART]] receive handler. Handler gets called when data has arrived. Set to <b>NULL</b> to stop.
+
Sets receive handler for given UART. Handler gets called when data has arrived. Set to <b>NULL</b> to stop.
  
 
<cpp>
 
<cpp>
void dseUartSetSendHandler(int (*sendHandler)(void))
+
void dseUartSetSendHandler(DseUart uart, int (*sendHandler)(void))
 
</cpp>
 
</cpp>
  
Sets [[UART]] send handler. Handler gets called when data send is completed. Set to <b>NULL</b> to stop.
+
Sets send handler for the specified UART. Handler gets called when data send is completed. Set to <b>NULL</b> to stop.
  
 
<cpp>
 
<cpp>
bool dseUartSendBuffer(char * data, unsigned int size, bool block = false)
+
bool dseUartSendBuffer(DseUart uart, char * data, unsigned int size, bool block = false)
 
</cpp>
 
</cpp>
  
Sends data on the [[UART]] port. <b>size</b> is maximum 32. Returns <b>false</b> if something went wrong.
+
Sends data on the specified UART. <b>size</b> is maximum 32. Returns <b>false</b> if something went wrong.
  
 
=== Tilt ===
 
=== Tilt ===

Revision as of 09:07, 25 November 2008

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> 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 dseBoot() </cpp>

Boots firmware if we're in bootloader. Boots bootloader if we're in firmware. Returns false if operation failed.

UART

<cpp> bool dseUartSetBaudrate(DseUart uart, unsigned int baudrate) </cpp>

Sets baud rate for given UART. Returns false if operation failed.

<cpp> void dseUartSetReceiveHandler(DseUart uart, void (*receiveHandler)(char * data, unsigned int size)) </cpp>

Sets receive handler for given UART. Handler gets called when data has arrived. Set to NULL to stop.

<cpp> void dseUartSetSendHandler(DseUart uart, int (*sendHandler)(void)) </cpp>

Sets send handler for the specified UART. Handler gets called when data send is completed. Set to NULL to stop.

<cpp> bool dseUartSendBuffer(DseUart uart, char * data, unsigned int size, bool block = false) </cpp>

Sends data on the specified UART. size is maximum 32. Returns false if something went wrong.

Tilt

To be written.

I/O

To be written.

ADC

To be written.

PWM

To be written.

USB Device

To be written.

Misc

To be written.