def write_tdi_bits(self, buff, return_tdo=False, TMS=True):
        """
        Command controller to write TDI data (with constant TMS bit)
        to the physical scan chain. Optionally return TDO bits sent
        back from scan the chain.

        Args:
            data - bits to send over TDI line of scan chain (bitarray)
            return_tdo (bool) - return the devices bitarray response
            TMS (bool) - whether TMS should send a bitarray of all 0's
                         of same length as `data` (i.e False) or all 1's
                         (i.e. True)

        Returns:
            None by default or the (bitarray) response of the device
            after receiving data, if return_tdo is True.

        Usage:
            >>> from proteusisc import getAttachedControllers, bitarray
            >>> c = getAttachedControllers()[0]
            >>> c.jtag_enable()
            >>> c.write_tdi_bits(bitarray("11111"), return_tdo=True)
            >>> c.jtag_disable()
        """
        self._check_jtag()
        tms_bits = bitarray([TMS]*len(buff))
        self._update_scanchain(tms_bits)

        self.bulkCommandDefault(_BMSG_WRITE_TDI %
                    (return_tdo, TMS,  len(buff).to_bytes(4, 'little')))
        self.bulkWriteData(build_byte_align_buff(buff).tobytes()[::-1])
        tdo_bits = self._read_tdo(len(buff)) if return_tdo else None
        self._get_adv_trans_stats(0x08, return_tdo)
        return tdo_bits