コード例 #1
0
ファイル: canstats.c プロジェクト: ahmedjafri/EE478
unsigned char CAN2510ReadStatus( void )
{
    unsigned char readValue;

    CAN2510Enable(  );                // Enable SPI Communication to MCP2510
    WriteSPI(CAN2510_CMD_STATUS);     // Send code for Read Status command
    readValue = ReadSPI();            // Read the status code, this is a Dummy read
    CAN2510Disable(  );               // Disable SPI Communication to MCP2510
    return ( readValue );             // Return the status code (same as previous read)
}
コード例 #2
0
ファイル: ReadSeq.c プロジェクト: martinpg/bms
void CAN2510SequentialRead( unsigned char *DataArray, unsigned char CAN2510addr, unsigned char numbytes )
{
    unsigned char i;

    CAN2510Enable(  );                        // Enable SPI Communication to MCP2510
    while( WriteSPI(CAN2510_CMD_READ) );
    while( WriteSPI(CAN2510addr) );
    i = 0;
    while ( numbytes != 0 )
    {
        DataArray[i] = ReadSPI();
        i++;
        numbytes--;
    }
    CAN2510Disable(  );                       // Disable SPI Communication to MCP2510
}