Sorry, ignore. I was derefencing the pointer, that causes the seg fault. For reference, it works like this.
#include <stdio.h>
#include <stdint.h>
void test(void *d) {
int pad = (int) d;
printf("D: %d\n", pad);
}
int main(void) {
test((void *)5);
return 0;
}
Thank you ...
Search found 7 matches
- Mon Jul 20, 2020 6:37 pm
- Forum: ChibiOS/HAL
- Topic: Understanding callback arguments on palSetPadCallback
- Replies: 6
- Views: 6785
- Mon Jul 20, 2020 6:35 pm
- Forum: ChibiOS/HAL
- Topic: Understanding callback arguments on palSetPadCallback
- Replies: 6
- Views: 6785
Re: Understanding callback arguments on palSetPadCallback
If gcc is something to go by, I get a segmentation fault. Does gcc-arm-none-eabi behave differently? Or am I misunderstanding you? Thank you for your patience to look at this.
#include <stdio.h>
#include <stdint.h>
void test(void *d) {
printf("D: %d\n", *(uint8_t *)d);
}
int main ...
#include <stdio.h>
#include <stdint.h>
void test(void *d) {
printf("D: %d\n", *(uint8_t *)d);
}
int main ...
- Mon Jul 20, 2020 6:15 pm
- Forum: ChibiOS/HAL
- Topic: Understanding callback arguments on palSetPadCallback
- Replies: 6
- Views: 6785
Re: Understanding callback arguments on palSetPadCallback
I still think there are potential problems passing integer literals... I am testing with GCC on a Linux terminal, but I expect gcc-arm-none-eabi to behave the same. GCC gives segmentation faults whenever I use a literal integer and with reason. The literal will be interpreted as an address.
I guess ...
I guess ...
- Mon Jul 20, 2020 5:27 pm
- Forum: ChibiOS/HAL
- Topic: Understanding callback arguments on palSetPadCallback
- Replies: 6
- Views: 6785
Re: Understanding callback arguments on palSetPadCallback
Please ignore, this seems to have an answer already here viewtopic.php?t=5120.
Sorry Giovanni, you are faster than me! Thanks for your reply.
Sorry Giovanni, you are faster than me! Thanks for your reply.
- Mon Jul 20, 2020 4:56 pm
- Forum: ChibiOS/HAL
- Topic: Understanding callback arguments on palSetPadCallback
- Replies: 6
- Views: 6785
Understanding callback arguments on palSetPadCallback
I am trying to use the same callback for events on two different pads. After setting up the pads as inputs, I am enabling events and setting up callbacks like this:
palEnablePadEvent(GPIOA, 9, PAL_EVENT_MODE_BOTH_EDGES);
palEnablePadEvent(GPIOA, 10, PAL_EVENT_MODE_BOTH_EDGES ...
palEnablePadEvent(GPIOA, 9, PAL_EVENT_MODE_BOTH_EDGES);
palEnablePadEvent(GPIOA, 10, PAL_EVENT_MODE_BOTH_EDGES ...
- Fri Jul 10, 2020 12:53 pm
- Forum: General Support
- Topic: fmpp generating board files that fail to compile
- Replies: 4
- Views: 4351
Re: fmpp generating board files that fail to compile
Thank you Giovanni for the prompt response and thank you for ChibiOS. I used the validator and added the pins and ports that are not really used in the Black Pill, I thought unused pins could be left out. If I wanted to contribute the file, what steps are necessary?
- Thu Jul 09, 2020 9:38 pm
- Forum: General Support
- Topic: fmpp generating board files that fail to compile
- Replies: 4
- Views: 4351
fmpp generating board files that fail to compile
I have been using ChibiOS since last week and I have to say I am loving it! But here to my problem: I created a board definition file for the STM32F411CE based BlackPill. fmpp creates the board files without issues. However, when I compile my application, I am getting errors in the board.h file ...