Skip to content

Commit 0210cef

Browse files
embeddedteam103CoolUsername
authored andcommitted
Add unsigned everywhere in the driver for
compatibility with the CAN HAL
1 parent 463a453 commit 0210cef

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/CAN.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ class CANMessage : public CAN_Message {
4141
*/
4242
CANMessage() : CAN_Message()
4343
{
44-
len = 8;
44+
len = 8U;
4545
type = CANData;
4646
format = CANStandard;
47-
id = 0;
47+
id = 0U;
4848
memset(data, 0, 8);
4949
}
5050

@@ -56,7 +56,7 @@ class CANMessage : public CAN_Message {
5656
* @param _type Type of Data: Use enum CANType for valid parameter values
5757
* @param _format Data Format: Use enum CANFormat for valid parameter values
5858
*/
59-
CANMessage(unsigned _id, const char *_data, char _len = 8, CANType _type = CANData, CANFormat _format = CANStandard)
59+
CANMessage(unsigned int _id, const unsigned char *_data, unsigned char _len = 8, CANType _type = CANData, CANFormat _format = CANStandard)
6060
{
6161
len = _len & 0xF;
6262
type = _type;
@@ -70,7 +70,7 @@ class CANMessage : public CAN_Message {
7070
* @param _id Message ID
7171
* @param _format Data Format: Use enum CANType for valid parameter values
7272
*/
73-
CANMessage(unsigned _id, CANFormat _format = CANStandard)
73+
CANMessage(unsigned int _id, CANFormat _format = CANStandard)
7474
{
7575
len = 0;
7676
type = CANRemote;
@@ -104,10 +104,10 @@ class CAN : private NonCopyable<CAN> {
104104
* CAN can1(MBED_CONF_APP_CAN1_RD, MBED_CONF_APP_CAN1_TD);
105105
* CAN can2(MBED_CONF_APP_CAN2_RD, MBED_CONF_APP_CAN2_TD);
106106
*
107-
* char counter = 0;
107+
* unsigned char counter = 0;
108108
*
109109
* void send() {
110-
* if(can1.write(CANMessage(1337, &counter, 1))) {
110+
* if(can1.write(CANMessage(1337U, &counter, 1))) {
111111
* printf("Message sent: %d\n", counter);
112112
* counter++;
113113
* }
@@ -116,7 +116,7 @@ class CAN : private NonCopyable<CAN> {
116116
*
117117
* int main() {
118118
* ticker.attach(&send, 1);
119-
* CANMessage msg;
119+
* CANMessage msg;
120120
* while(1) {
121121
* if(can2.read(msg)) {
122122
* printf("Message received: %d\n\n", msg.data[0]);

0 commit comments

Comments
 (0)