Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@csukuangfj
Last active April 16, 2019 02:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csukuangfj/8932b723e3ee4b3564bd8ad5ca97d065 to your computer and use it in GitHub Desktop.
Save csukuangfj/8932b723e3ee4b3564bd8ad5ca97d065 to your computer and use it in GitHub Desktop.
stm32f469I-discovery notes

Table of Contents

References

LED

HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_RESET);  // turn on LED1
HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_RESET);  // turn on LED2

HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_SET);  // turn off LED3
HAL_GPIO_WritePin(LED4_GPIO_Port, LED4_Pin, GPIO_PIN_SET);  // turn off LED4
#define TURN_ON(n) \
  HAL_GPIO_WritePin(LED ## n ## _GPIO_Port, LED ## n ## _Pin, GPIO_PIN_RESET)

#define TURN_OFF(n) \
  HAL_GPIO_WritePin(LED ## n ## _GPIO_Port, LED ## n ## _Pin, GPIO_PIN_SET)

  int i = 0;
  for(;;)
  {
    i =  (i + 1) & 0x0f;

    if (i&0x1) TURN_ON(1); else TURN_OFF(1);
    if (i&0x2) TURN_ON(2); else TURN_OFF(2);
    if (i&0x4) TURN_ON(3); else TURN_OFF(3);
    if (i&0x8) TURN_ON(4); else TURN_OFF(4);
    osDelay(1000);
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment