// License: CC0
//
// To the extent possible under law, Clementine Computing LLC has waived
// all copyright and related or neighboring rights to this file.
//
// This work is published from: United States.
//

include <PopufareHousingCommon.scad>

module PopufarePowerAdapterBottomPlate() {
  _w = _POWER_BOX_WIDTH;
  _h = _POWER_BOX_HEIGHT;
  _r = _POWER_BOX_R;
  
  piu_usb_h = _POWER_BOX_PIU_USB_H;
  
  difference() {
    rounded_rect(_w, _h, _r);
    
    // housing holes
    //
    translate([ (_w/2 - 3*_r), (_h/2 - 3*_r)]) circle(_r);
    translate([-(_w/2 - 3*_r), (_h/2 - 3*_r)]) circle(_r);
    translate([-(_w/2 - 3*_r),-(_h/2 - 3*_r)]) circle(_r);
    translate([ (_w/2 - 3*_r),-(_h/2 - 3*_r)]) circle(_r);
    
    // max232 converter. It has no holes so we'll be using cable ties
    //
    translate([5,5])
    union() {
      translate([-_POWER_BOX_STRAP_DW/2, -_POWER_BOX_STRAP_DH/2]) circle(_r);
      translate([ _POWER_BOX_STRAP_DW/2, -_POWER_BOX_STRAP_DH/2]) circle(_r);
      translate([ _POWER_BOX_STRAP_DW/2,  _POWER_BOX_STRAP_DH/2]) circle(_r);
      translate([-_POWER_BOX_STRAP_DW/2,  _POWER_BOX_STRAP_DH/2]) circle(_r);
    }
    
    // PIU rs232 ttl USB out
    //
    translate([-_w/2+_PIU_USB_HOLE_DE, piu_usb_h + _PIU_USB_HOLE_DW/2])
      circle(_PIU_USB_HOLE_R);
    translate([-_w/2+_PIU_USB_HOLE_DE, piu_usb_h - _PIU_USB_HOLE_DW/2])
      circle(_PIU_USB_HOLE_R);
  }
}
