From fd22542ad1c3d8043a9b7cb177e0d0dc5e4840d0 Mon Sep 17 00:00:00 2001 From: skarg Date: Mon, 23 Aug 2010 14:03:06 +0000 Subject: [PATCH] Added comments. --- bacnet-stack/ports/bdk-atxx4-mstp/seeprom.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/seeprom.c b/bacnet-stack/ports/bdk-atxx4-mstp/seeprom.c index ea33e032..39395089 100644 --- a/bacnet-stack/ports/bdk-atxx4-mstp/seeprom.c +++ b/bacnet-stack/ports/bdk-atxx4-mstp/seeprom.c @@ -1,6 +1,7 @@ /************************************************************************** * * Copyright (C) 2009 Steve Karg +* Used algorithm and code from Joerg Wunsch and Ruwan Jayanetti. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -420,8 +421,8 @@ static int seeprom_bytes_write_page( * byte is placed at the beginning of the same * page. If more than 64 data words are * transmitted to the EEPROM, the data word -* address will “roll over” and previous data will be -* overwritten. The address “roll over” during write +* address will "roll over" and previous data will be +* overwritten. The address "roll over" during write * is from the last byte of the current page to the * first byte of the same page. **************************************************************************/ @@ -462,6 +463,8 @@ void seeprom_init( TWSR = 0; TWCR = _BV(TWEN) | _BV(TWEA); /* bit rate */ + /* SCL freq = F_CPU/(16+2*TWBR*4^TWPS) */ + /* since TWPS in TWSR is set to zero, 4^TWPS resolves to 1 */ TWBR = (F_CPU / SEEPROM_I2C_CLOCK - 16) / 2; /* my address */ TWAR = 0;