0 Replies Latest reply on Apr 12, 2016 7:10 AM by MichelleC_Intel

    'Blink' Example for Microcontroller D2000 Development Platform

    MichelleC_Intel

      Below example code will blink the onboard LED on the D2000 Development Platform.


      #include "qm_soc_regs.h"

      #include "qm_gpio.h"

      #include "qm_scss.h"

       

       

      /* LED on Intel(R) Quark(TM) Microcontroller D2000 Development Platform */

      #define LED_BIT 24

       

       

      #define DELAY 300000UL

      #define MAX_LED_BLINKS (10)

       

       

      static qm_gpio_port_config_t cfg;

       

       

      int main(void)

      {

               uint32_t counter = 0;

               QM_PUTS("Starting: Led blink\n");

       

       

               cfg.direction = BIT(LED_BIT);

               qm_gpio_set_config(QM_GPIO_0, &cfg);

       

       

                while (counter < MAX_LED_BLINKS) {

                       qm_gpio_set_pin(QM_GPIO_0, LED_BIT);

                       clk_sys_udelay(DELAY);

                       qm_gpio_clear_pin(QM_GPIO_0, LED_BIT);

                       clk_sys_udelay(DELAY);

                       counter++;

               }

               QM_PUTS("Finished: Led blink\n");

               return 0;

      }

       

      If using ISSM create a project using a template (e.g. hello_word) using the  'Create New QMSI/BSP Project'. Then just paste the above into the main.c .