// initialize pin 2 of J5A, as Digital input with internal Pull-UP //connect to ground MIOS32\_BOARD\_J5\_PinInit(0, MIOS32\_BOARD\_PIN\_MODE\_INPUT\_PU); MIOS32\_BOARD\_J5\_PinInit(1, MIOS32\_BOARD\_PIN\_MODE\_INPUT\_PU);
and i also can observe the state of the J5a pin by putting following code into APP_Background:
how does a Encoder-Code look like (without any Acceleration), and how does Hardware debouncing look like (the same like for buttons?), i want to use as less code then possible…
This Settings in “mios32_config.h” are working for 0-7A (5a,5b) - i am on a stm32f4
#define MIOS32\_AIN\_CHANNEL\_MASK 0x00ff // AIN define the deadband (min. difference to report a change to the application hook) #define MIOS32\_AIN\_DEADBAND 31 //7Bit
Strange, would not that just be for analog inputs? A0 … A3 work fine without setting “#define MIOS32_AIN_CHANNEL_MASK 0x00ff”.
I do not want analog inputs. I want 4 encoders
what i have done with J10A-B (if you replace J10 with J5 i think its the same)
@top of programm (declaration)
// ENCODER SR begin with 1, ENC with 0) // setup the Pinout of Encoders const mios32\_enc\_config\_t encoders[1] = {{ .cfg.type=DETENTED2, .cfg.speed=FAST, .cfg.speed\_par=3, .cfg.sr=7, .cfg.pos=0 }};
void APP\_Init(void){ BLM\_SCALAR\_Init(0); // initialize BLM\_SCALAR driver // Set GPIO @ J10A+B int pin; for(pin=0; pin\<16; ++pin){ MIOS32\_BOARD\_J10\_PinInit(pin, MIOS32\_BOARD\_PIN\_MODE\_INPUT\_PU);} // Set Menue Encoder int enc; for(enc=0; enc\<4; ++enc) { mios32\_enc\_config\_t enc\_config = MIOS32\_ENC\_ConfigGet(enc); enc\_config.cfg.type = DETENTED3; // see mios32\_enc.h for available types enc\_config.cfg.sr = 0; // must be 0 if controlled from application enc\_config.cfg.pos = 0; // doesn't matter if controlled from application enc\_config.cfg.speed = FAST; enc\_config.cfg.speed\_par = 0; MIOS32\_ENC\_ConfigSet(enc, enc\_config);} }
void APP\_SRIO\_ServicePrepare(void) { // get current J10B value and update all encoder states int enc; u16 state = MIOS32\_BOARD\_J10B\_Get(); for(enc=0; enc\<4; ++enc) { MIOS32\_ENC\_StateSet(enc, state & 3); // two pins state \>\>= 2; // shift to next two pins } }
Just got a flashback: this is actually a known issue and I thought that I fixed this some years ago… somehow the change didn’t find it’s way into the repository.
I updated mios32/LPC17xx/mios32_board.c, please update your repository
Acabei de receber um flashback: este é realmente um problema conhecido e achei que consertei isso há alguns anos … de alguma forma, a mudança não encontrou o caminho para o repositório.
Eu atualizei o mios32 / LPC17xx / mios32_board.c, atualize seu repositório
Atenciosamente, Thorsten.
Hi TK,
Thank you so much!!! Now it works !!! I’ve been looking for where the bug would be for two days and today I would look at “mios32_board.c”. Thanks for the quick help !!!