## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
##
import sigrokdecode as srd
}
class Decoder(srd.Decoder):
- api_version = 1
+ api_version = 3
id = 'mxc6225xu'
name = 'MXC6225XU'
longname = 'MEMSIC MXC6225XU'
desc = 'Digital Thermal Orientation Sensor (DTOS) protocol.'
license = 'gplv2+'
inputs = ['i2c']
- outputs = ['mxc6225xu']
- optional_probes = [
- {'id': 'int', 'name': 'INT', 'desc': 'DTOS interrupt output pin'},
- ]
- annotations = [
- ['text', 'Human-readable text'],
- ]
-
- def __init__(self, **kwargs):
+ outputs = []
+ tags = ['IC', 'Sensor']
+ annotations = (
+ ('text', 'Human-readable text'),
+ )
+
+ def __init__(self):
+ self.reset()
+
+ def reset(self):
self.state = 'IDLE'
def start(self):
- # self.out_python = self.register(srd.OUTPUT_PYTHON)
self.out_ann = self.register(srd.OUTPUT_ANN)
def putx(self, data):
# Bits[7:7]: INT
int_val = (b >> 7) & 1
s = 'unchanged and no' if (int_val == 0) else 'changed or'
- ann = 'INT = %d: Orientation %s shake event occured\n' % (int_val, s)
+ ann = 'INT = %d: Orientation %s shake event occurred\n' % (int_val, s)
# Bits[6:5]: SH[1:0]
sh = (((b >> 6) & 1) << 1) | ((b >> 5) & 1)
if cmd != 'START':
return
self.state = 'GET SLAVE ADDR'
- self.block_start_sample = ss
elif self.state == 'GET SLAVE ADDR':
# Wait for an address write operation.
# TODO: We should only handle packets to the slave(?)
self.state = 'IDLE'
else:
pass # TODO?
- else:
- raise Exception('Invalid state: %s' % self.state)
-