def DMA_TCD(self, dma_channel): ''' Parameters ---------- dma_channel : int DMA channel for which to read the Transfer Control Descriptor. Returns ------- pandas.DataFrame Table of Transfer Control Descriptor fields with corresponding values. In addition, several reference columns are included. For example, the ``page`` column indicates the page in the [reference manual][1] where the respective register field is described. [1]: http://www.freescale.com/products/arm-processors/kinetis-cortex-m/adc-calculator:ADC_CALCULATOR ''' from arduino_rpc.protobuf import resolve_field_values import arduino_helpers.hardware.teensy.dma as dma from .DMA import TCD tcd = TCD.FromString(self.read_dma_TCD(dma_channel).tostring()) df_tcd = resolve_field_values(tcd) return (df_tcd[['full_name', 'value']].dropna() .join(dma.TCD_DESCRIPTIONS, on='full_name') [['full_name', 'value', 'short_description', 'page']] .sort_values(['page','full_name']))
def config(self): import pandas as pd try: fv = resolve_field_values(self._config_pb, set_default=True).set_index(['full_name']) return pd.Series(OrderedDict([(k, PYTYPE_MAP[v.field_desc .type](v.value)) for k, v in fv.iterrows()]), dtype=object) except ValueError: return pd.Series()
def DMA_registers(self): ''' Returns ------- pandas.DataFrame Table of DMA configuration fields with corresponding values. In addition, several reference columns are included. For example, the ``page`` column indicates the page in the [reference manual][1] where the respective register field is described. [1]: http://www.freescale.com/products/arm-processors/kinetis-cortex-m/adc-calculator:ADC_CALCULATOR ''' from arduino_rpc.protobuf import resolve_field_values import arduino_helpers.hardware.teensy.dma as dma from .DMA import Registers dma_registers = (Registers .FromString(self.read_dma_registers().tostring())) df_dma = resolve_field_values(dma_registers) return (df_dma.dropna(subset=['value']) .join(dma.REGISTERS_DESCRIPTIONS, on='full_name') [['full_name', 'value', 'short_description', 'page']])