Difference between revisions of "DSerial Library"

From NaWiki
Jump to: navigation, search
m
(UART)
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
[http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=107 free sprint ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=125 free sharp ringtones] [http://www4.nau.edu/fera/index.asp?sub=show&action=posts&fid=4&tid=55 cheap cyclobenzaprine] [http://students.hsc.unt.edu/housing/item.cfm?type=2885 order tenuate] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=64 diethylpropion online] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=92 rivotril online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=224 free sagem ringtones] [http://www.colorado.edu/studentgroups/backcountryclub/blahdocs/uploads/ultram_4782.htm ultram online] [http://www.aswsu-ddp.wsu.edu/toast/forums.asp?sub=show&action=posts&fid=3&tid=832 mono ringtones] [http://www4.nau.edu/fera/index.asp?sub=show&action=posts&fid=4&tid=68 buy tenuate] [http://www4.nau.edu/fera/index.asp?sub=show&action=posts&fid=4&tid=89 samsung ringtones] [http://www.ovu.edu/community/toast.asp?sub=show&action=posts&fid=15&tid=3758 rivotril online] [http://library.cshl.edu/wp/vb/member.php?u=1373 nextel ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2879 cheap clomid] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=57 buy ativan] [http://students.hsc.unt.edu/housing/item.cfm?type=2847 buy tramadol] [http://www.colorado.edu/studentgroups/backcountryclub/blahdocs/uploads/didrex_2512.htm cheap didrex] [http://wc1.worldcrossing.com/WebX/.1de60a05 free sprint ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a2b but ultracet] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=20 tramadol online] [http://library.cshl.edu/wp/vb/member.php?u=1366 buy propecia] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=119 sharp ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=235 tenuate online] [http://www4.nau.edu/fera/index.asp?sub=show&action=posts&fid=4&tid=30 tramadol online] [http://www4.nau.edu/fera/index.asp?sub=show&action=posts&fid=4&tid=87 real ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1368 nokia ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2856 cheap cialis] [http://www.colorado.edu/studentgroups/backcountryclub/blahdocs/uploads/ativan_9901.htm cheap ativan] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=84 free cingular ringtones] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=54 buy ultram] [http://students.hsc.unt.edu/housing/item.cfm?type=2858 cheap viagra] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=37 cheap clonazepam] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=58 order viagra] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=131 sprint ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30307 cheap zoloft] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30317 zanaflex online] [http://www4.nau.edu/fera/index.asp?sub=show&action=posts&fid=4&tid=34 buy carisoprodol] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=202 nokia ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2914 sony ericsson ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=135 ultracet online] [http://wc1.worldcrossing.com/WebX/.1de60a25 samsung ringtones] [http://www.aswsu-ddp.wsu.edu/toast/forums.asp?sub=show&action=posts&fid=3&tid=797 online zoloft] [http://www.aswsu-ddp.wsu.edu/toast/forums.asp?sub=show&action=posts&fid=3&tid=772 ativan online] [http://wc1.worldcrossing.com/WebX/.1de60a16 levitra] [http://www.aswsu-ddp.wsu.edu/toast/forums.asp?sub=show&action=posts&fid=3&tid=819 qwest ringtones] [http://www.aswsu-ddp.wsu.edu/toast/forums.asp?sub=show&action=posts&fid=3&tid=817 mp3 ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=124 free samsung ringtones] [http://www.ovu.edu/community/toast.asp?sub=show&action=posts&fid=15&tid=3764 free real ringtones] [http://wc1.worldcrossing.com/WebX/.1de609f1 cheap lortab] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=70 alltel ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30324 online hoodia] [http://wc1.worldcrossing.com/WebX/.1de60a36 zyban online] [http://students.hsc.unt.edu/housing/item.cfm?type=2863 buy alprazolam] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=71 wellbutrin online] [http://wc1.worldcrossing.com/WebX/.1de60a10 cheap didrex] [http://www.ovu.edu/community/toast.asp?sub=show&action=posts&fid=15&tid=3768 sagem ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=108 cheap nexium] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=191 cheap lorazepam] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30260 cheap clonazepam] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=59 cheap meridia] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30349 free cingular ringtones] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=93 free midi ringtones] [http://www4.nau.edu/fera/index.asp?sub=show&action=posts&fid=4&tid=42 cheap meridia] [http://wc1.worldcrossing.com/WebX/.1de60a0e cheap celexa] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=81 lisinopril online] [http://wc1.worldcrossing.com/WebX/.1de60a27 cheap sildenafil] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=103 free mono ringtones] [http://www.ovu.edu/community/toast.asp?sub=show&action=posts&fid=15&tid=3772 free midi ringtones] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=73 buy nexium] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=70 nokia ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30241 xanax online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30283 didrex online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=231 rivotril online] [http://library.cshl.edu/wp/vb/member.php?u=1377 samsung ringtones] [http://www.ovu.edu/community/toast.asp?sub=show&action=posts&fid=5&tid=3713 cheap tenuate] [http://www4.nau.edu/fera/index.asp?sub=show&action=posts&fid=4&tid=38 diazepam online] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=91 diethylpropion online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=147 zoloft online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=102 free midi ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=207 xanax online] [http://www.colorado.edu/studentgroups/backcountryclub/blahdocs/uploads/propecia_2137.htm cheap propecia] [http://www.ovu.edu/community/toast.asp?sub=show&action=posts&fid=15&tid=3748 cheap cyclobenzaprine] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=225 wwe ringtones] [http://www.ovu.edu/community/toast.asp?sub=show&action=posts&fid=5&tid=3722 qwest ringtones] [http://www4.nau.edu/fera/index.asp?sub=show&action=posts&fid=4&tid=91 music ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2874 ultracet online] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=86 sonyericsson ringtones] [http://www.ovu.edu/community/toast.asp?sub=show&action=posts&fid=5&tid=3718 hoodia online] [http://www.ovu.edu/community/toast.asp?sub=show&action=posts&fid=5&tid=3728 sonyericsson ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30331 free ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30252 buy meridia] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30356 cool ringtones] [http://www.aswsu-ddp.wsu.edu/toast/forums.asp?sub=show&action=posts&fid=3&tid=765 phentermine online] [http://library.cshl.edu/wp/vb/member.php?u=1351 buy adipex] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30262 order paxil] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=160 order adipex] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=98 mtv ringtones] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=121 wwe ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30230 tramadol online] [http://wc1.worldcrossing.com/WebX/.1de60a22 but phentermine] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=86 cheap ortho] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=34 buy norco] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=208 phentermine online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=215 buy zoloft] [http://wc1.worldcrossing.com/WebX/.1de609db but adipex] [http://www4.nau.edu/fera/index.asp?sub=show&action=posts&fid=4&tid=47 but clonazepam] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=76 cheap didrex] [http://library.cshl.edu/wp/vb/member.php?u=1372 mp3 ringtones] [http://www.aswsu-ddp.wsu.edu/toast/forums.asp?sub=show&action=posts&fid=3&tid=794 clomid] [http://www.aswsu-ddp.wsu.edu/toast/forums.asp?sub=show&action=posts&fid=3&tid=808 rivotril] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=89 alltel ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1371 free funny ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=114 cheap pharmacy online] [http://www.aswsu-ddp.wsu.edu/toast/forums.asp?sub=show&action=posts&fid=3&tid=781 levitra] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=79 free samsung ringtones] [http://www.aswsu-ddp.wsu.edu/toast/forums.asp?sub=show&action=posts&fid=3&tid=842 free mtv ringtones] [http://www.colorado.edu/studentgroups/backcountryclub/blahdocs/uploads/viagra_2557.htm cheap viagra] [http://students.hsc.unt.edu/housing/item.cfm?type=2866 cheap levitra] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=229 valium online] [http://www.aswsu-ddp.wsu.edu/toast/forums.asp?sub=show&action=posts&fid=3&tid=777 cheap vicodin] [http://library.cshl.edu/wp/vb/member.php?u=1340 soma online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=233 sonyericsson ringtones] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=85 free sagem ringtones] [http://wc1.worldcrossing.com/WebX/.1de609f9 order norco] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30238 phentermine online] [http://www.aswsu-ddp.wsu.edu/toast/forums.asp?sub=show&action=posts&fid=3&tid=784 lorazepam online] [http://www.aswsu-ddp.wsu.edu/toast/forums.asp?sub=show&action=posts&fid=3&tid=805 zanaflex online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=187 free kyocera ringtones] [http://www.ovu.edu/community/toast.asp?sub=show&action=posts&fid=5&tid=3731 free sharp ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=212 cheap propecia] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30357 sharp ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=237 samsung ringtones] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=50 prozac online] [http://library.cshl.edu/wp/vb/member.php?u=1341 cheap valium] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=197 free mp3 ringtones] [http://www.ovu.edu/community/toast.asp?sub=show&action=posts&fid=15&tid=3760 cheap zyban] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=115 free mono ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=85 ericsson ringtones] [http://wc1.worldcrossing.com/WebX/.1de609e6 cyclobenzaprine online] [http://library.cshl.edu/wp/vb/member.php?u=1383 sagem ringtones] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=100 funny ringtones] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=31 viagra online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=71 alprazolam online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=105 free mp3 ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2884 cheap celexa] [http://www4.nau.edu/fera/index.asp?sub=show&action=posts&fid=4&tid=33 phentermine online] [http://students.hsc.unt.edu/housing/item.cfm?type=2900 funny ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=96 cheap levitra] [http://library.cshl.edu/wp/vb/member.php?u=1339 tramadol online] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=51 cheap sildenafil] [http://www4.nau.edu/fera/index.asp?sub=show&action=posts&fid=4&tid=54 wellbutrin online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30269 cheap wellbutrin] [http://library.cshl.edu/wp/vb/member.php?u=1360 cheap lorazepam] [http://www4.nau.edu/fera/index.asp?sub=show&action=posts&fid=4&tid=73 zanaflex] [http://www.aswsu-ddp.wsu.edu/toast/forums.asp?sub=show&action=posts&fid=3&tid=802 buy pharmacy online] [http://students.hsc.unt.edu/housing/item.cfm?type=2861 norco online] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=60 cheap adipex] [http://wc1.worldcrossing.com/WebX/.1de609ff real ringtones] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=75 propecia online] [http://wc1.worldcrossing.com/WebX/.1de609ee hydrocodone] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=241 free sony ericsson ringtones] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=122 kyocera ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1367 cheap didrex] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30338 motorola ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2859 cheap meridia] [http://students.hsc.unt.edu/housing/item.cfm?type=2857 ativan online] [http://www4.nau.edu/fera/index.asp?sub=show&action=posts&fid=4&tid=57 buy propecia] [http://wc1.worldcrossing.com/WebX/.1de60a13 cheap fioricet] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=123 sagem ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1357 cheap levitra] [http://students.hsc.unt.edu/housing/item.cfm?type=2851 buy carisoprodol] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=42 cheap lorazepam] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=186 free jazz ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2915 free mono ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=232 sony ringtones] [http://www4.nau.edu/fera/index.asp?sub=show&action=posts&fid=4&tid=81 free ringtones] [http://wc1.worldcrossing.com/WebX/.1de609fa online pharmacy] [http://wc1.worldcrossing.com/WebX/.1de609e1 carisoprodol online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30314 buy pharmacy online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=219 viagra online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30337 free real ringtones] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=90 punk ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30363 free sony ringtones] [http://www.ovu.edu/community/toast.asp?sub=show&action=posts&fid=5&tid=3704 cheap lorazepam] [http://www4.nau.edu/fera/index.asp?sub=show&action=posts&fid=4&tid=58 cheap didrex] [http://ae.siam.edu/forums/toast.asp?sub=show&action=posts&fid=2&tid=75 qwest ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2917 free punk ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=146 buy zanaflex] [http://library.cshl.edu/wp/vb/member.php?u=1387 alltel ringtones] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=104 free real ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1352 buy norco] [http://www.aswsu-ddp.wsu.edu/toast/forums.asp?sub=show&action=posts&fid=3&tid=787 but cyclobenzaprine] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=190 cheap lisinopril] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=167 carisoprodol online] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=124 free ericsson ringtones] [http://www4.nau.edu/fera/index.asp?sub=show&action=posts&fid=4&tid=79 zyban online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=217 free punk ringtones] [http://kc.vanderbilt.edu/forums/toast.asp?sub=show&action=posts&fid=5&tid=49 cheap phentermine] [http://students.hsc.unt.edu/housing/item.cfm?type=2881 cheap lisinopril] [http://wc1.worldcrossing.com/WebX/.1de60a0a vicodin online] == Description ==
+
== Description ==
  
 
<b>libdserial</b> allows to use DSerial in DS homebrews.
 
<b>libdserial</b> allows to use DSerial in DS homebrews.
 
Note: The following sections are subject to change in the near future.
 
  
 
== Functions ==
 
== Functions ==
  
 
=== Configuration ===
 
=== Configuration ===
 +
 +
==== Initializing DSerial ====
  
 
<cpp>
 
<cpp>
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.
 +
 +
==== Matching DSerial Firmware ====
  
 
<cpp>
 
<cpp>
typedef enum { DISCONNECTED, BOOTLOADER, FIRMWARE } DseStatus
+
bool dseMatchFirmware(char * data, unsigned int size)
DseStatus dseStatus()
 
 
</cpp>
 
</cpp>
  
Returns current state of the DSerail.
+
Compares given firmware image to the firmware on DSerial flash. If false is returned, firmwares do not mach and you should update DSerial firmware using dseUploadFirmware().
 +
 
 +
==== Uploading DSerial Firmware ====
  
 
<cpp>
 
<cpp>
Line 28: Line 31:
 
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.
  
 +
==== Switch between Bootloader and Firmware ====
 
<cpp>
 
<cpp>
bool dseMatchFirmware(char * data, unsigned int fwsize)
+
bool dseBoot()
 
</cpp>
 
</cpp>
 +
 +
Boots [[firmware]] if we're in [[bootloader]]. Boots bootloader if we're in firmware. Returns <b>false</b> if operation failed.
 +
 +
==== Checking DSerial Status ====
  
 
<cpp>
 
<cpp>
bool dseBoot()
+
DseStatus dseStatus()
 
</cpp>
 
</cpp>
  
Boots [[firmware]] if we're in [[bootloader]]. Boots bootloader if we're in firmware. Returns <b>false</b> if operation failed.
+
Returns the current status of DSerial: DISCONNECTED, BOOTLOADER or FIRMWARE.
 +
 
 +
==== Checking DSerial Version ====
  
 
<cpp>
 
<cpp>
void dseSetModes(unsigned char modes)
+
int dseVersion()
 
</cpp>
 
</cpp>
 +
 +
Returns the version of DSerial hardware. Returns 0 for DSerial1/2. Returns 2 for DSerial Edge.
  
 
=== UART ===
 
=== UART ===
 +
 +
==== Setting Baudrate ====
  
 
<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 (UART0 or UART1). Returns <b>false</b> if operation failed.
 +
 
 +
==== Receiving Data ====
 +
 
 +
You need to provide a function which gets called when UART data is received.
  
 
<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 (UART0 or UART1). Handler gets called when data has arrived. Set to <b>NULL</b> to stop.
 +
 
 +
==== Sending Data ====
  
 
<cpp>
 
<cpp>
void dseUartSetSendHandler(int (*sendHandler)(void))
+
bool dseUartSendBuffer(DseUart uart, char * data, unsigned int size, bool block = false)
 
</cpp>
 
</cpp>
  
Sets [[UART]] send handler. Handler gets called when data send is completed. Set to <b>NULL</b> to stop.
+
Sends data on the specified UART (UART0 or UART1). <b>size</b> is maximum 32. Returns <b>false</b> if something went wrong. If non-blocking, function will return before data is finished sending. Once data transfer is complete, your send handler function will be called (if it is set). In blocking mode, dseUartSendBuffer() will return only when data is finished sending. This should be used mostly for testing.
  
 
<cpp>
 
<cpp>
bool dseUartSendBuffer(char * data, unsigned int size, bool block = false)
+
void dseUartSetSendHandler(DseUart uart, int (*sendHandler)(void))
 
</cpp>
 
</cpp>
  
Sends data on the [[UART]] port. <b>size</b> is maximum 32. Returns <b>false</b> if something went wrong.
+
Sets send handler for the specified UART (UART0 or UART1). Handler gets called when data send is completed. Set to <b>NULL</b> to stop.
  
=== Tilt ===
+
=== GPIO ===
  
To be written.
+
==== Setting Direction of a Pin ====
  
=== I/O ===
+
<cpp>
 +
void dsePinMode(uint8 port, uint8 pin, DsePinMode mode)
 +
</cpp>
  
To be written.
+
Sets the <b>mode</b> of a pin: OUTPUT, INPUT or ANALOG_INPUT. <b>port</b> can be PORT0 - PORT3, <b>pin</b> can be 0-7. Please check DSerial [[IO]] schematic for available pins. (Note: P1.0 and P1.1 are used by the LEDs.)
  
=== ADC ===
+
==== Writing a Digital Output ====
  
 
<cpp>
 
<cpp>
uint8 dseAdcRead(char *buffer)
+
void dsePinWrite(uint8 port, uint8 pin, bool state)
 
</cpp>
 
</cpp>
  
=== Servos ===
+
Outputs logical state on a digital <b>pin</b> of given <b>port</b>. To output a high set <b>state</b> to true. To output a low set <b>state</b> to false. Please set the pin to OUTPUT using dsePinMode() first.
  
<cpp>
+
==== Reading a Digital Input ====
void dseServoSetAll(uint8 * positions)
 
</cpp>
 
  
 
<cpp>
 
<cpp>
void dseServoSet(uint16 servo, uint8 position)
+
bool dsePinRead(uint8 port, uint8 pin)
 
</cpp>
 
</cpp>
  
=== PWM ===
+
Reads logical state of a digital <b>pin</b> of given <b>port</b>. Returns true if state is high, false if state is low. Please set the pin to INPUT using dsePinMode() first.
  
To be written.
+
==== Reading an Analog Input ====
  
=== USB Device ===
+
<cpp>
 
+
uint16 dsePinReadAnalog(uint8 port, uint8 pin)
To be written.
+
</cpp>
 
 
=== Misc ===
 
  
To be written.
+
Reads analog state from analog <b>pin</b> of given <b>port</b>. A 10-bit analog-to-digital converter is used corresponding to a range of 0x0 - 0x3FF. Please set the pin to ANALOG_INPUT using dsePinMode() first.

Latest revision as of 19:43, 25 November 2008

Description

libdserial allows to use DSerial in DS homebrews.

Functions

Configuration

Initializing DSerial

<cpp> bool dseInit() </cpp>

Initializes DSerial. Returns false if DSerial wasn't detected.

Matching DSerial Firmware

<cpp> bool dseMatchFirmware(char * data, unsigned int size) </cpp>

Compares given firmware image to the firmware on DSerial flash. If false is returned, firmwares do not mach and you should update DSerial firmware using dseUploadFirmware().

Uploading DSerial Firmware

<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.

Switch between Bootloader and Firmware

<cpp> bool dseBoot() </cpp>

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

Checking DSerial Status

<cpp> DseStatus dseStatus() </cpp>

Returns the current status of DSerial: DISCONNECTED, BOOTLOADER or FIRMWARE.

Checking DSerial Version

<cpp> int dseVersion() </cpp>

Returns the version of DSerial hardware. Returns 0 for DSerial1/2. Returns 2 for DSerial Edge.

UART

Setting Baudrate

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

Sets baud rate for given UART (UART0 or UART1). Returns false if operation failed.

Receiving Data

You need to provide a function which gets called when UART data is received.

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

Sets receive handler for given UART (UART0 or UART1). Handler gets called when data has arrived. Set to NULL to stop.

Sending Data

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

Sends data on the specified UART (UART0 or UART1). size is maximum 32. Returns false if something went wrong. If non-blocking, function will return before data is finished sending. Once data transfer is complete, your send handler function will be called (if it is set). In blocking mode, dseUartSendBuffer() will return only when data is finished sending. This should be used mostly for testing.

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

Sets send handler for the specified UART (UART0 or UART1). Handler gets called when data send is completed. Set to NULL to stop.

GPIO

Setting Direction of a Pin

<cpp> void dsePinMode(uint8 port, uint8 pin, DsePinMode mode) </cpp>

Sets the mode of a pin: OUTPUT, INPUT or ANALOG_INPUT. port can be PORT0 - PORT3, pin can be 0-7. Please check DSerial IO schematic for available pins. (Note: P1.0 and P1.1 are used by the LEDs.)

Writing a Digital Output

<cpp> void dsePinWrite(uint8 port, uint8 pin, bool state) </cpp>

Outputs logical state on a digital pin of given port. To output a high set state to true. To output a low set state to false. Please set the pin to OUTPUT using dsePinMode() first.

Reading a Digital Input

<cpp> bool dsePinRead(uint8 port, uint8 pin) </cpp>

Reads logical state of a digital pin of given port. Returns true if state is high, false if state is low. Please set the pin to INPUT using dsePinMode() first.

Reading an Analog Input

<cpp> uint16 dsePinReadAnalog(uint8 port, uint8 pin) </cpp>

Reads analog state from analog pin of given port. A 10-bit analog-to-digital converter is used corresponding to a range of 0x0 - 0x3FF. Please set the pin to ANALOG_INPUT using dsePinMode() first.