Esempio n. 1
0
        public static void ReceiveByte(int val)
        {
            SPDR_ReadBuffer = val;

            // set the SPIF flag
            SPI.SPSR[AtmelIO.SPIF] = 1;
            AtmelContext.UpdateInterruptFlags();
        }
Esempio n. 2
0
 void UCSR0B_OnRegisterChanged(int oldVal, int newVal)
 {
     // is the Transmit Compete Interrupt flags being enabled?
     if ((newVal & (1 << AtmelIO.UDRIE0)) != 0)
     {
         // yep, so check if we need to generate an interrupt
         AtmelContext.UpdateInterruptFlags();
     }
 }
Esempio n. 3
0
        void UDR0_OnRegisterChanged(int oldVal, int newVal)
        {
            // byte is being transmitted
            TransmitLog += Convert.ToChar(newVal);

            // assume transfer happened immediately and set TXC0
            UCSR0A.Value |= (1 << AtmelIO.TXC0);

            // check if we need to generate another interrupt
            AtmelContext.UpdateInterruptFlags();
        }
Esempio n. 4
0
        void SPDR_OnRegisterChanged(int oldVal, int newVal)
        {
            // make sure SPI is enabled
            if (SPI.SPCR[AtmelIO.SPE] == 0)
            {
                return;
            }

            // broadcast the byte immediately
            if (this.OnReceivedByte != null)
            {
                this.OnReceivedByte(newVal);
            }

            // set the transfer complete flag
            SPI.SPSR[AtmelIO.SPIF] = 1;
            AtmelContext.UpdateInterruptFlags();
        }