/** write byte to SMB380 EEPROM
   \param addr address to write to (image addresses are automatically extended to EEPROM space)
   \param data byte content to write 
   \return result of bus communication function
*/
int smb380_write_ee(unsigned char addr, unsigned char data) 
{	
	int comres;
	if (p_smb380==0) 			/* check pointers */
		return E_SMB_NULL_PTR;
    if (p_smb380->delay_msec == 0)
	    return E_SMB_NULL_PTR;
    comres = smb380_set_ee_w( SMB380_EE_W_ON );
	addr|=0x20;   /* add eeprom address offset to image address if not applied */
	comres += smb380_write_reg(addr, &data, 1 );
	p_smb380->delay_msec( SMB380_EE_W_DELAY );
	comres += smb380_set_ee_w( SMB380_EE_W_OFF);
	return comres;
}
Beispiel #2
0
int smb380_write_ee(unsigned char addr, unsigned char data) 
{	
	int comres;
	if (p_smb380==0) 			
		return E_SMB_NULL_PTR;
    if (p_smb380->delay_msec == 0)
	    return E_SMB_NULL_PTR;
    comres = smb380_set_ee_w( SMB380_EE_W_ON );
	addr|=0x20;   
	comres += smb380_write_reg(addr, &data, 1 );
	p_smb380->delay_msec( SMB380_EE_W_DELAY );
	comres += smb380_set_ee_w( SMB380_EE_W_OFF);
	return comres;
}