예제 #1
0
파일: bldc_emf.c 프로젝트: hoo2/toolbox
void bldc_startup (bldc_t *bldc, float sp)
{
   uint32_t startup_timing [30] = {
      500000, 450000, 400000, 300000, 200000, 100000,
       90000,  80000,  70000,  60000,  55000,  52000,
       51000,  50000,  49500,  49000,  48500,  48000,
       47500,  47000,  46500,  46000,  45000,  45000,
       45000,  45000,  45000,  45000,  45000,  45000
   };
   bldc_br_state_en state;
   int i;

   // charge low site capacitors
   bldc->io.ul (100);   bldc->io.vl (100);   bldc->io.wl (100);
   jf_delay_ms (100);
   bldc->io.ul (0);     bldc->io.vl (0);     bldc->io.wl (0);

   i=0;
   state = BLDC_ST0;
   do {
      if ( !jf_check_usec (startup_timing[i]) ) {
         ++i;
         ++state;
         if (state >BLDC_ST5)
            state = BLDC_ST0;
      }
      _set_output (bldc, state, sp);
   } while (i<30);

}
module&	module::set_output_rollback(Record_info &op_info) {
	net* tar_net = op_info.net_ref;
	bool value = !op_info.value_set;

	if (!_set_output(tar_net, value))
		throw exception("rollback set output failed. (set_output_rollback)");
	return *this;
}
module& module::set_output(net* tar_net, bool value) {
	if (tar_net == NULL)
		throw exception("NULL net specified. (set_output)");
	if (!_set_output(tar_net, value))
		throw exception(("setting " + tar_net->get_net_name() + ((value) ? "" : " not") +
			" as output failed. (set_output)").c_str());

	Record new_record;
	new_record.op_type = SO;
	new_record.op_info.net_ref = tar_net;
	new_record.op_info.value_set = value;
	lRecordLst.push_back(new_record);
	return *this;
}
예제 #4
0
// Set pin as output
static inline void Pin_Output(struct _pin_t pin) {
    _set_output(pin.port, pin.mask);
}