Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: pixy2.cpp
- Revision:
- 6:e9e3aa6f1a55
- Parent:
- 5:28e47187bb5c
- Child:
- 10:ea759846c2d5
diff -r 28e47187bb5c -r e9e3aa6f1a55 pixy2.cpp --- a/pixy2.cpp Mon Mar 11 17:18:25 2019 +0000 +++ b/pixy2.cpp Mon Mar 11 17:28:59 2019 +0000 @@ -65,7 +65,7 @@ } } -int PIXY2::pixy2_sndGetVersion (void){ +Pixy2ErrorCode PIXY2::pixy2_sndGetVersion (void){ T_pixy2sendBuffer msg; int i = 0, dataSize = 0; msg.frame.header.pixSync = PIXY2_SYNC; @@ -79,7 +79,7 @@ return PIXY2_OK; } -int PIXY2::pixy2_sndGetResolution (void){ +Pixy2ErrorCode PIXY2::pixy2_sndGetResolution (void){ T_pixy2sendBuffer msg; int i = 0, dataSize = 1; msg.frame.header.pixSync = PIXY2_SYNC; @@ -94,7 +94,7 @@ return PIXY2_OK; } -int PIXY2::pixy2_sndSetCameraBrightness (Byte brightness){ +Pixy2ErrorCode PIXY2::pixy2_sndSetCameraBrightness (Byte brightness){ T_pixy2sendBuffer msg; int i = 0, dataSize = 1; msg.frame.header.pixSync = PIXY2_SYNC; @@ -109,7 +109,7 @@ return PIXY2_OK; } -int PIXY2::pixy2_sndSetServo (Word s0, Word s1){ +Pixy2ErrorCode PIXY2::pixy2_sndSetServo (Word s0, Word s1){ T_pixy2sendBuffer msg; int i = 0, dataSize = 4; T_Word tmp; @@ -130,7 +130,7 @@ return PIXY2_OK; } -int PIXY2::pixy2_sndSetLED (Byte red, Byte green, Byte blue){ +Pixy2ErrorCode PIXY2::pixy2_sndSetLED (Byte red, Byte green, Byte blue){ T_pixy2sendBuffer msg; int i = 0, dataSize = 3; msg.frame.header.pixSync = PIXY2_SYNC; @@ -147,7 +147,7 @@ return PIXY2_OK; } -int PIXY2::pixy2_sndSetLamp (Byte upper, Byte lower){ +Pixy2ErrorCode PIXY2::pixy2_sndSetLamp (Byte upper, Byte lower){ T_pixy2sendBuffer msg; int i = 0, dataSize = 2; msg.frame.header.pixSync = PIXY2_SYNC; @@ -163,7 +163,7 @@ return PIXY2_OK; } -int PIXY2::pixy2_sndGetFPS (void){ +Pixy2ErrorCode PIXY2::pixy2_sndGetFPS (void){ T_pixy2sendBuffer msg; int i = 0, dataSize = 0; msg.frame.header.pixSync = PIXY2_SYNC; @@ -177,7 +177,7 @@ return PIXY2_OK; } -int PIXY2::pixy2_sndGetBlocks (Byte sigmap, Byte maxBloc){ +Pixy2ErrorCode PIXY2::pixy2_sndGetBlocks (Byte sigmap, Byte maxBloc){ T_pixy2sendBuffer msg; int i = 0, dataSize = 2; msg.frame.header.pixSync = PIXY2_SYNC; @@ -193,7 +193,7 @@ return PIXY2_OK; } -int PIXY2::pixy2_sndGetMainFeature (Byte type, Byte feature){ +Pixy2ErrorCode PIXY2::pixy2_sndGetMainFeature (Byte type, Byte feature){ T_pixy2sendBuffer msg; int i = 0, dataSize = 2; msg.frame.header.pixSync = PIXY2_SYNC; @@ -209,7 +209,7 @@ return PIXY2_OK; } -int PIXY2::pixy2_sndSetMode (Byte mode){ +Pixy2ErrorCode PIXY2::pixy2_sndSetMode (Byte mode){ T_pixy2sendBuffer msg; int i = 0, dataSize = 1; msg.frame.header.pixSync = PIXY2_SYNC; @@ -224,7 +224,7 @@ return PIXY2_OK; } -int PIXY2::pixy2_sndSetNexTurn (Word angle){ +Pixy2ErrorCode PIXY2::pixy2_sndSetNexTurn (Word angle){ T_pixy2sendBuffer msg; int i = 0, dataSize = 2; T_Word tmp; @@ -243,7 +243,7 @@ return PIXY2_OK; } -int PIXY2::pixy2_sndSetDefaultTurn (Word angle){ +Pixy2ErrorCode PIXY2::pixy2_sndSetDefaultTurn (Word angle){ T_pixy2sendBuffer msg; int i = 0, dataSize = 2; T_Word tmp; @@ -262,7 +262,7 @@ return PIXY2_OK; } -int PIXY2::pixy2_sndSetVector (Byte vectorIndex){ +Pixy2ErrorCode PIXY2::pixy2_sndSetVector (Byte vectorIndex){ T_pixy2sendBuffer msg; int i = 0, dataSize = 1; msg.frame.header.pixSync = PIXY2_SYNC; @@ -277,7 +277,7 @@ return PIXY2_OK; } -int PIXY2::pixy2_sndReverseVector (void){ +Pixy2ErrorCode PIXY2::pixy2_sndReverseVector (void){ T_pixy2sendBuffer msg; int i = 0, dataSize = 0; msg.frame.header.pixSync = PIXY2_SYNC; @@ -291,7 +291,7 @@ return PIXY2_OK; } -int PIXY2::pixy2_sndGetRGB (Word x, Word y, Byte saturate){ +Pixy2ErrorCode PIXY2::pixy2_sndGetRGB (Word x, Word y, Byte saturate){ T_pixy2sendBuffer msg; int i = 0, dataSize = 3; msg.frame.header.pixSync = PIXY2_SYNC; @@ -311,10 +311,10 @@ /* La fonction est bloquante à l'envoi (pas vraiment le choix), mais elle est non bloquante en réception. On essayera de faire une fonction non bloquante en envoi avec write, mais c'est pas la priorité. Le principe c'est de stocker dans un buffer circulaire les données au fur et à mesure qu'elle sont reçues et de traiter uniquement en castant les infos. Pour cela, il faut recevoir et stocker. */ -int PIXY2::pixy2_getVersion (T_Pixy2Version *version){ +Pixy2ErrorCode PIXY2::pixy2_getVersion (T_Pixy2Version *version){ T_pixy2RcvHeader *msg = (T_pixy2RcvHeader*) &Pixy2_buffer[rPointer]; - int cr = PIXY2_OK; + Pixy2ErrorCode cr = PIXY2_OK; switch (etat) { case idle : // Si la caméra est inactive @@ -349,10 +349,10 @@ return cr; } -int PIXY2::pixy2_getResolution (T_Pixy2Resolution *resolution){ +Pixy2ErrorCode PIXY2::pixy2_getResolution (T_Pixy2Resolution *resolution){ T_pixy2RcvHeader *msg = (T_pixy2RcvHeader*) &Pixy2_buffer[rPointer]; - int cr = PIXY2_OK; + Pixy2ErrorCode cr = PIXY2_OK; switch (etat) { case idle : // Si la caméra est inactive @@ -388,22 +388,22 @@ } -int PIXY2::pixy2_setCameraBrightness (Byte brightness){return 0;} -int PIXY2::pixy2_setServos (Word s0, Word s1){return 0;} -int PIXY2::pixy2_setLED (Byte red, Byte green, Byte blue){return 0;} -int PIXY2::pixy2_setLamp (Byte upper, Byte lower){return 0;} -int PIXY2::pixy2_getFPS (T_pixy2returnCode *framerate){return 0;} -int PIXY2::pixy2_getBlocks (Byte sigmap, Byte maxBloc){return 0;} -int PIXY2::pixy2_getMainFeature (Byte type, Byte features){return 0;} -int PIXY2::pixy2_getAllFeature (Byte features){return 0;} -int PIXY2::pixy2_setMode (Byte mode){return 0;} -int PIXY2::pixy2_setNexTurn (Word angle){return 0;} -int PIXY2::pixy2_setDefaultTurn (Word angle){return 0;} -int PIXY2::pixy2_setVector (Byte vectorIndex){return 0;} -int PIXY2::pixy2_ReverseVector (void){return 0;} -int PIXY2::pixy2_getRGB (Word x, Word y, Byte saturate, T_pixy2Pixel *pixel){return 0;} +Pixy2ErrorCode PIXY2::pixy2_setCameraBrightness (Byte brightness){return 0;} +Pixy2ErrorCode PIXY2::pixy2_setServos (Word s0, Word s1){return 0;} +Pixy2ErrorCode PIXY2::pixy2_setLED (Byte red, Byte green, Byte blue){return 0;} +Pixy2ErrorCode PIXY2::pixy2_setLamp (Byte upper, Byte lower){return 0;} +Pixy2ErrorCode PIXY2::pixy2_getFPS (T_pixy2returnCode *framerate){return 0;} +Pixy2ErrorCode PIXY2::pixy2_getBlocks (Byte sigmap, Byte maxBloc){return 0;} +Pixy2ErrorCode PIXY2::pixy2_getMainFeature (Byte type, Byte features){return 0;} +Pixy2ErrorCode PIXY2::pixy2_getAllFeature (Byte features){return 0;} +Pixy2ErrorCode PIXY2::pixy2_setMode (Byte mode){return 0;} +Pixy2ErrorCode PIXY2::pixy2_setNexTurn (Word angle){return 0;} +Pixy2ErrorCode PIXY2::pixy2_setDefaultTurn (Word angle){return 0;} +Pixy2ErrorCode PIXY2::pixy2_setVector (Byte vectorIndex){return 0;} +Pixy2ErrorCode PIXY2::pixy2_ReverseVector (void){return 0;} +Pixy2ErrorCode PIXY2::pixy2_getRGB (Word x, Word y, Byte saturate, T_pixy2Pixel *pixel){return 0;} -int PIXY2::pixy2_validateChecksum (Byte* tab){ +Pixy2ErrorCode PIXY2::pixy2_validateChecksum (Byte* tab){ Word i, sum = 0; T_Word *tmp;