.
Dependencies: L432KC_SPI_Pey_Lal
Diff: protocol.h
- Revision:
- 115:156b8234f2de
- Parent:
- 114:c1f7be27aa5d
- Child:
- 116:6dfcafa00e42
--- a/protocol.h Wed May 18 16:12:59 2022 +0000 +++ b/protocol.h Wed May 18 18:07:09 2022 +0000 @@ -3,16 +3,21 @@ #include "mbed.h" -#define STATE_START_OF_FRAME 0 -#define STATE_COMMAND_TYPE 1 -#define STATE_PAYLOAD 2 -#define STATE_PROPULSION 1 -#define STATE_DIRECTION 2 -#define STATE_CHECKSUM 3 +#define PAYLOAD_MAX_SIZE 128 + +#define STATE_START_OF_FRAME 0 +#define STATE_COMMAND_TYPE 1 +#define STATE_PAYLOAD 2 +#define STATE_CHECKSUM 3 -char calculateChecksum(uint32_t propulsion, uint32_t direction); +#define COMMAND_PWM 0b10101010 +#define COMMAND_ASSERVISSEMENT 0b01010101 +#define COMMAND_PARAMETRES 0b10100101 + + +char calculateChecksum(char command, char* payload, char payloadLength); void decodeMessage(char c); -void getVerifiedPWMValues(uint32_t *pwmPropulsion, uint32_t *pwmDirection); +char getVerifiedPayload(char *payloadOutput); char isDataAvailable(); #endif \ No newline at end of file