Exemple #1
0
void SYSTEM_InitializeBoard(void)
{
    const DRV_SPI_INIT_DATA SPI_Init_Data = {2, 3, 7, 0, SPI_BUS_MODE_3, 0};

    // ---------------------------------------------------------
    // Make sure the display DO NOT flicker at start up
    // ---------------------------------------------------------
    DisplayBacklightConfig();
    DisplayPowerConfig();
    DisplayBacklightOff();

    // ---------------------------------------------------------
    // mikroe Board
    // SPI-Flash Device pins
    // ---------------------------------------------------------
    // chip select pin
    SST25_CS_TRIS   = 0;
    SST25_CS_LAT    = 1;
    // spi-clock pin
    SST25_SCK_TRIS  = 0;
    // spi-output pin
    SST25_SDO_TRIS  = 0;
    // spi-intput pin
    SST25_SDI_TRIS  = 1;

    /* Config the LED ports to output. */
    LEDPortsConfig();
    LEDPortsClear();
    // ---------------------------------------------------------
    // Initialize the Display Driver
    // ---------------------------------------------------------

    DRV_GFX_Initialize();

    DRV_NVM_M25P80_Initialize((DRV_SPI_INIT_DATA*)&SPI_Init_Data);

    // initialize system tick counter
    SYSTEM_TickInit();

    // initialize the components for Resistive Touch Screen
    TouchInit(NVMWrite, NVMRead, NVMSectorErase, NULL);
//    TouchInit(NULL, NULL, NULL, NULL);

}
Exemple #2
0
// *****************************************************************************
// void SYSTEM_InitializeBoard(void)
// *****************************************************************************
void SYSTEM_InitializeBoard(void)
{
    // SPI initialization for Serial RAM
    const DRV_SPI_INIT_DATA SRAM_SPI_Init_Data = {
                                2, 3,
                                7, 1,
                                SPI_BUS_MODE_1, 0};

    // SPI initialization for EPD
    const DRV_SPI_INIT_DATA EPD_SPI_Init_Data = {
                                1, 3,
                                7, 1,
                                SPI_BUS_MODE_1, 0};

    // ---------------------------------------------------------
    // Make sure the display DO NOT flicker at start up
    // ---------------------------------------------------------
    DisplayBacklightConfig();
    DisplayPowerConfig();
    DisplayBacklightOff();

    // ---------------------------------------------------------
    // ADC Explorer 16 Development Board Errata (work around 2)
    // RB15 should be output
    // ---------------------------------------------------------
    LATBbits.LATB15 = 0;
    TRISBbits.TRISB15 = 0;

    // ---------------------------------------------------------
    // EPD PicTail Plus Daughter Board 23K256
    // SPI-RAM Device Chip Select pin
    // ---------------------------------------------------------
    MCHP_23K256_CS_TRIS = 0;
    MCHP_23K256_CS_LAT  = 1;

    // ---------------------------------------------------------
    // EPD PicTail Plus Daughter
    // Board EPD Controller Device Chip Select pin
    // ---------------------------------------------------------
    DRV_EPD_SPI_CS_TRIS     = 0;
    DRV_EPD_SPI_CS_LAT     = 1;

    // ---------------------------------------------------------
    // SPI Port pins
    // ---------------------------------------------------------
    // spi-clock pin
    TRISFbits.TRISF6 = 0;
    // spi-output pin
    TRISFbits.TRISF8 = 0;
    // spi-intput pin
    TRISFbits.TRISF7 = 1;

    // initialize SPI driver
    DRV_RAM_23K256_Initialize((DRV_SPI_INIT_DATA*)&SRAM_SPI_Init_Data);

    // initialize EPD driver
    DRV_EPD_SPI_Initialize((DRV_SPI_INIT_DATA*)&EPD_SPI_Init_Data);

    // Initialize the e-paper (EPD)
    EPD_display_init();

    // ---------------------------------------------------------
    // Initialize the Display Driver
    // ---------------------------------------------------------
    DRV_GFX_Initialize();
    GFX_Initialize();
    
    // Initialize the reference timer.
    SYSTEM_TickInit();    


}
Exemple #3
0
// *****************************************************************************
void SYSTEM_InitializeBoard(void)
{

    const DRV_SPI_INIT_DATA SPI_Init_Data = {2, 3, 7, 0, SPI_BUS_MODE_3, 0};

    // ---------------------------------------------------------
    // Make sure the display DO NOT flicker at start up
    // ---------------------------------------------------------
    DisplayBacklightConfig();
    DisplayPowerConfig();
    DisplayBacklightOff();
	
    // ---------------------------------------------------------
    // ADC Explorer 16 Development Board Errata (work around 2)
    // RB15 should be output
    // ---------------------------------------------------------
    LATBbits.LATB15 = 0;
    TRISBbits.TRISB15 = 0;

    // ---------------------------------------------------------
    // Explorer 16 Development Board MCHP25LC256 chip select signal,
    // even if not used must be driven to high so it does not
    // interfere with other SPI peripherals that uses the same SPI signals.
    // ---------------------------------------------------------
    TRISDbits.TRISD12 = 0;
    LATDbits.LATD12 = 1;
    
    // ---------------------------------------------------------
    // Graphics LCD Controller PICtail Plus SSD1926 Board
    // SPI-Flash Device pins 
    // ---------------------------------------------------------
    // chip select pin
    TRISDbits.TRISD1 = 0;
    LATDbits.LATD1   = 1;
    // spi-clock pin
    TRISGbits.TRISG6 = 0;
    // spi-output pin
    TRISGbits.TRISG8 = 0;
    // spi-intput pin
    TRISGbits.TRISG7 = 1;

    // ---------------------------------------------------------
    // UART pins
    // ---------------------------------------------------------
    // initialize the UART pins
    TRISFbits.TRISF5 = 0;
    TRISFbits.TRISF4 = 1;

    // unlock PPS
    __builtin_write_OSCCONL(OSCCON & 0xbf);

    // set UART pins
    RPINR19bits.U2RXR = 10; 	// assign RP10 to RX
    RPOR8bits.RP17R = 5;    	// assign RP17 to TX

    // set SPI pins
    RPOR10bits.RP21R = 11;      // assign RP21 for SCK2
    RPOR9bits.RP19R = 10;       // assign RP19 for SDO2
    RPINR22bits.SDI2R = 26;     // assign RP26 for SDI2

    // lock   PPS
    __builtin_write_OSCCONL(OSCCON | 0x40);

    // ---------------------------------------------------------
    // Initialize the Display Driver
    // ---------------------------------------------------------
    DRV_GFX_Initialize();

    DRV_NVM_SST25VF016_Initialize((DRV_SPI_INIT_DATA*)&SPI_Init_Data);

    // initialize system tick counter
    SYSTEM_TickInit();

    // initialize the components for Resistive Touch Screen
    TouchInit(NVMWrite, NVMRead, NVMSectorErase, NULL);

    
}