-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect breaks task #15
base: main
Are you sure you want to change the base?
Conversation
sending signal for break interupt to the CAN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to add this message to UOSM-core
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
||
/** | ||
* Brakes are connected to GPIO 0 | ||
*/ | ||
const uint BRAKE_PIN = 0; | ||
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
look at those to function that might work :
used interupts instead of pooling the data