Sounds great. Definitely something we would consider.
I have one final problem with my program, in regards to my one pin I switch from input to output and back again.
With a multi-meter I can confirm that the pin is set LOW at the beginning of the thread.
When it switches to input the pin in HIGH, I expected it to be LOW as nothing drives the line. The pin is connected to a loose wire not connected anywhere.
When I take the wire and briefly connect it to ground it correctly recognize the input state to be LOW by sending a serial command.
This is followed by changing the port from input to output and set it to LOW. Here I measure no LOW but instead it is HIGH.
Did I miss anything in the process?
Regards
Sebastian
Code: Select all
static THD_FUNCTION(rc1Thread, arg)
{
(void)arg;
chRegSetThreadName("RC1 thread");
msg_t rc1HighMsg = (msg_t)"LOW";
palClearPad(GPIOA, GPIOA_RC1);
chThdSleepMilliseconds(10000);
palSetPadMode(GPIOA, GPIOA_RC1, PAL_MODE_INPUT);
while (true) {
if( palReadPad(GPIOA, GPIOA_RC1) == PAL_LOW )
{
chThdSleepMilliseconds(5000);
chMtxLock(&bufferAccess);
sdWrite(&SD1, (uint8_t*)rc1HighMsg, sizeof(rc1HighMsg));
chMtxUnlock(&bufferAccess);
palSetPadMode(GPIOC, GPIOA_RC1, PAL_MODE_OUTPUT_PUSHPULL );
palClearPad(GPIOA, GPIOA_RC1);
chThdSleepMilliseconds(10000);
palSetPad(GPIOA, GPIOA_RC1);
palSetPadMode(GPIOA, GPIOA_RC1, PAL_MODE_INPUT);
}
chThdSleepMilliseconds(100);
}
}

