예제 #1
0
int process_command(char** data){
	if (!data[0]) return 0;
	if (is_equal_string(data[0], "start")){
		int gpio = 0;
		int duty = 0;
		if (!data[1] || !data[2]) return 0;
		gpio = starts_with(data[1], "con:");
		duty = starts_with(data[2], "duty:");
		if (gpio == NA || duty == NA) return 0;
		dbg_print("Starts con %d, duty %d\r\n", gpio, duty);
		start_pwm(gpio, duty);
	} else if (is_equal_string(data[0], "stop")){
		int gpio = 0;
		if (!data[1] ) return 0;
		gpio = starts_with(data[1], "con:");
		if (gpio == NA ) return 0;
		dbg_print("Stops con %d\r\n", gpio);
		stop_pwm(gpio);
	} else if (is_equal_string(data[0], "period")){
		int period = 0;
		if (!data[1] ) return 0;
		period = starts_with(data[1], "");
		if (period == NA ) return 0;
		dbg_print("Period %d\r\n", period);
		set_period(period);
	}
	return 0;
}
예제 #2
0
파일: cbdd.c 프로젝트: nassersala/cbdd
void _refute_equal_string(const char* exp, const char* act, const char* file, int line) {
  if (either_or_both_is_null(exp, act) || is_equal_string(exp, act))
    refute_equal_string_failed(exp, act, file, line);
  else
    expectation_passed();
}