Conversation
sending signal for break interupt to the CAN
toxoscorp
left a comment
There was a problem hiding this comment.
Have you tested if your code works (I don't see why it wouldn't. I just want to make sure). I added a couple of comment and also I don't remember exactly but is the interrupt called only on state change (from breaking to no breaking and other way around) ? If so, you should add a message when it disable the break too since right now you're only sending it when the break is pressed.
|
|
||
| // Sending the brake signal through CAN | ||
| if (brake_pressed) { | ||
| brakeMsg.standardMessageID = 0x123; // Brake message ID |
There was a problem hiding this comment.
I would suggest to add this message to UOSM-core
There was a problem hiding this comment.
there is a couple of place you need to add code for that but a good start to look is here :
https://github.com/UOSupermileage/UOSM-Pressure-Sensor/blob/d4d55eec0faa8c9e6d6fd3841e7ce6d48e2f44c6/UOSM-Core/Modules/CANMessageLookUpModule.c#L32
There was a problem hiding this comment.
you also need to create the external call back in the core like this :
https://github.com/UOSupermileage/UOSM-Pressure-Sensor/blob/d4d55eec0faa8c9e6d6fd3841e7ce6d48e2f44c6/UOSM-Core/Modules/CANMessageLookUpModule.c#L17
| void brakes_callback(uint gpio, uint32_t events) { | ||
| bool brake_pressed = (events & GPIO_IRQ_EDGE_RISE); | ||
| data_aggregator_set_breaks_pressed(brake_pressed); | ||
| iCommsMessage_t brakeMsg; |
There was a problem hiding this comment.
in UOSM-core there is function to create CAN message directly. Those are the standard in our code currently but in the end it does the same thing (IComms_CreateMessage) feel free to look at it and change your function if you want
There was a problem hiding this comment.
look at those to function that might work :
used interupts instead of pooling the data