// (C) 2020 Philip Endecott.
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENCE.txt or copy at https://www.boost.org/LICENSE_1_0.txt

#ifndef lipstick_power_hh
#define lipstick_power_hh

#include "registers.hh"

enum peripheral_power_bits {
  // Reserved    0
  PCTIM0  = 1 << 1,
  PCTIM1  = 1 << 2,
  PCUART0 = 1 << 3,
  PCUART1 = 1 << 4,
  PCPWM0  = 1 << 5,
  // Reserved    6
  PCI2C   = 1 << 7,
  PCSPI0  = 1 << 8,
  PCRTC   = 1 << 9,
  PCSPI1  = 1 << 10,
  PCEMC   = 1 << 11,
  PCAD    = 1 << 12,  // "Note: clear the PDN bit in the ADCR before clearing this bit, and set this bit before setting PDB."
  PCCAN1  = 1 << 13,
  PCCAN2  = 1 << 14,
  PCCAN3  = 1 << 15,
  PCCAN4  = 1 << 16,
  // Reserved    17-20
  PCSSP   = 1 << 21
  // Reserved    22-31
};


inline void set_peripheral_power(uint32_t bits)
{
  *PCONP = bits;
}


#endif

