Exemple #1
0
void MCP23009::init() {
	// the same as Power-On/Reset value
	IOMode(0xff); // set IODIR, 0x00 = all output
	polarity(0x00);
	config(0x00); // set IOCON w/ non-increment register address mode
	pullup(0x00); // set no pull-ups
}
int				ft_atoi(const char *str)
{
	char	*buf;
	int		i;
	int		*sign;
	int		len;
	int		result;

	sign = (int *)malloc(sizeof(int));
	buf = (char *)str;
	buf = polarity(ft_rm_whitespace(buf), sign);
	i = 0;
	len = ft_len(buf);
	result = 0;
	while (buf[i] >= '0' && buf[i] <= '9')
	{
		result = result + (buf[i] - '0') * ft_power_ten(len - i - 1);
		i++;
	}
	return (*sign * result);
}