Search found 2 matches
- Thu Nov 09, 2023 11:05 am
- Forum: General discussion
- Topic: What is the fastest way to change pin mode from INPUT_PULLUP to OUTPUT and back
- Replies: 3
- Views: 4340
Re: What is the fastest way to change pin mode from INPUT_PULLUP to OUTPUT and back
Thanks it doubled the reading speed.
- Tue Nov 07, 2023 9:51 am
- Forum: General discussion
- Topic: What is the fastest way to change pin mode from INPUT_PULLUP to OUTPUT and back
- Replies: 3
- Views: 4340
What is the fastest way to change pin mode from INPUT_PULLUP to OUTPUT and back
I need to change pin mode on PB6 and PB7 fast on STM32F103. Originally I was using: pinMode(PB6, INPUT_PULLUP); ... pinMode(PB6, OUTPUT); Then I extracted minimal code from pinMode function: void pin_function_fast(PinName pin, int function) { uint32_t mode = function == INPUT ? 0 : 1; // STM_PIN_FUN...