12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #include "ch.h"
- #include "hal.h"
- #include "chprintf.h"
- BaseSequentialStream * chp = (BaseSequentialStream *) &SD1;
- static void gpt3cb(GPTDriver *gptp) {
- palTogglePad(IOPORT2, 7);
- }
- static GPTConfig gpt3cfg = {
- 1000,
- gpt3cb
- };
- int main(void) {
-
- halInit();
- chSysInit();
- palSetPadMode(IOPORT2, 7, PAL_MODE_OUTPUT_PUSHPULL);
- sdStart(&SD1, NULL);
- gptStart(&GPTD3, &gpt3cfg);
- gptStartContinuous(&GPTD3, 500);
- while (1) {
- chprintf(chp, "OCR3A: %d, TCCR3B: %x, period: %d, counter: %d , TCNT3: %d\r\n",
- OCR3A,
- TCCR3B,
- GPTD3.period,
- GPTD3.counter,
- TCNT3);
- chThdSleepMilliseconds(100);
- }
- }
|