text: /***************************************************************************//**
   * @file main_s0.c
   * @brief This project outputs 2 microamps to the pin specified in the 
   * readme.txt file. This project operates in EM3.
   *******************************************************************************
   * # License
   * <b>Copyright 2020 Silicon Laboratories Inc. www.silabs.com</b>
   *******************************************************************************
   *
   * SPDX-License-Identifier: Zlib
   *
   * The licensor of this software is Silicon Laboratories Inc.
   *
   * This software is provided 'as-is', without any express or implied
   * warranty. In no event will the authors be held liable for any damages
   * arising from the use of this software.
   *
   * Permission is granted to anyone to use this software for any purpose,
   * including commercial applications, and to alter it and redistribute it
   * freely, subject to the following restrictions:
   *
   * 1. The origin of this software must not be misrepresented; you must not
   *    claim that you wrote the original software. If you use this software
   *    in a product, an acknowledgment in the product documentation would be
   *    appreciated but is not required.
   * 2. Altered source versions must be plainly marked as such, and must not be
   *    misrepresented as being the original software.
   * 3. This notice may not be removed or altered from any source distribution.
   *
   *******************************************************************************
   * # Evaluation Quality
   * This code has been minimally tested to ensure that it builds and is suitable 
   * as a demonstration for evaluation purposes only. This code will be maintained
   * at the sole discretion of Silicon Labs.
   ******************************************************************************/
  
  #include "em_device.h"
  #include "em_cmu.h"
  #include "em_emu.h"
  #include "em_chip.h"
  #include "em_idac.h"
  
  /**************************************************************************//**
   * @brief 
   *    IDAC initialization
   *****************************************************************************/
  void initIdac(void)
  {
    // Enable IDAC clock
    CMU_ClockEnable(cmuClock_IDAC0, true);
  
    // Initialize IDAC
    IDAC_Init_TypeDef init = IDAC_INIT_DEFAULT;
    IDAC_Init(IDAC0, &init);
  
    // Choose the output current to be 2 microamps
    IDAC_RangeSet(IDAC0, idacCurrentRange1);
    IDAC_StepSet(IDAC0, 4);
  
    // Enable IDAC output mode and also enable the IDAC module itself
    IDAC_OutEnable(IDAC0, true);
    IDAC_Enable(IDAC0, true);
  }
  
  /**************************************************************************//**
   * @brief  
   *    Output 2 microamps on the pin specified in the readme.txt
   *****************************************************************************/
  int main(void)
  {
    // Chip errata
    CHIP_Init();
  
    // Initialization
    initIdac();
  
    while (1) {
      EMU_EnterEM3(false); // Enter EM3 (won't exit)
    }
  }
  
  