コード例 #1
0
/*********************************************************************
* Function:  void DisplayBrightness(WORD level)
*
* PreCondition: none
*
* Input: level - Brightness level. Valid values are 0 to 100.
*			- 0: brightness level is zero or display is turned off
*			- 1: brightness level is maximum 
*
* Output: none
*
* Side Effects: none
*
* Overview: Sets the brightness of the display.
*
* Note: none
*
********************************************************************/
void DisplayBrightness(WORD level)
{
    // If the brightness can be controlled (for example through PWM)
    // add code that will control the PWM here.

    if (level > 0)
    {
        DisplayBacklightOn();           
    }    
    else if (level == 0)
    {
        DisplayBacklightOff();
    }    
        
}    
コード例 #2
0
ファイル: system.c プロジェクト: bekeband/CarMikroe.X
// *****************************************************************************
// void SYSTEM_InitializeBoard(void)
// *****************************************************************************
void SYSTEM_InitializeBoard(void)
{

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


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


}
コード例 #3
0
ファイル: system.c プロジェクト: bekeband/DashBoard
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);

}
コード例 #4
0
ファイル: system.c プロジェクト: KaraAtchison/microchip
// *****************************************************************************
// 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();    


}
コード例 #5
0
ファイル: system.c プロジェクト: kerikun11/MPLABXProjects
// *****************************************************************************
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);

    
}
コード例 #6
0
ファイル: app_init.c プロジェクト: ctapang/v0_70_01b
/*
*********************************************************************************************************
*                                          ApplicationInitialize
*
* Description :  This function is called by SYS_Initialize() function and run after power up.  Global 
*                interrupts are not enabled here (i.e. CP0 Status register).  Interrupts will be enabled 
*                by RTOS when the highest priority task is run for the first time.
* Arguments   : 
*********************************************************************************************************
*/
void ApplicationInitialize ( void )
{
   portBASE_TYPE errStatus;
   
   /*initialize app_data object to initial values for this application*/
   appData.deviceHandle = USB_DEVICE_HANDLE_INVALID;
   appData.isConfigured = false;
   /* Initialize the keycode array */
   appData.key = USB_HID_KEYBOARD_KEYPAD_KEYBOARD_A;
   appData.keyCodeArray.keyCode[0] = USB_HID_KEYBOARD_KEYPAD_RESERVED_NO_EVENT_INDICATED;
   appData.keyCodeArray.keyCode[1] = USB_HID_KEYBOARD_KEYPAD_RESERVED_NO_EVENT_INDICATED;
   appData.keyCodeArray.keyCode[2] = USB_HID_KEYBOARD_KEYPAD_RESERVED_NO_EVENT_INDICATED;
   appData.keyCodeArray.keyCode[3] = USB_HID_KEYBOARD_KEYPAD_RESERVED_NO_EVENT_INDICATED;
   appData.keyCodeArray.keyCode[4] = USB_HID_KEYBOARD_KEYPAD_RESERVED_NO_EVENT_INDICATED;
   appData.keyCodeArray.keyCode[5] = USB_HID_KEYBOARD_KEYPAD_RESERVED_NO_EVENT_INDICATED;
   /* Initialize the modifier keys */
   appData.keyboardModifierKeys.modifierkeys = 0;
   /* Initialise the led state */
   appData.keyboardOutputReport.data = 0;
   /* Intialize the switch state */
   appData.isSwitchPressed = false;
   appData.ignoreSwitchPress = false;
   /* Initialize the HID instance index.  */
   appData.hidInstance = 0;
   /* Initialize tracking variables */
   appData.isReportReceived = false;
   appData.isReportSentComplete = true;
   /* Initialize the application state*/
   appData.state = APP_STATE_INIT;
   
   /*write proper hardware pins to setup gfx*/
   DisplayResetEnable();
   DisplayResetConfig();
   DisplayCmdDataConfig();
   DisplayConfig();
   DisplayBacklightOff();
   DisplayBacklightConfig();
   
   /*create applicaiton specific tasks*/
   errStatus = xTaskCreate((pdTASK_CODE) ApplicationLEDblinkTask,
                (const signed char*)"LED Blink Task",
                APPLICATION_LEDBLINKTASK_STKSIZE,
                NULL,
                APPLICATION_LEDBLINKTASK_PRIO,
                NULL);

   errStatus = xTaskCreate((pdTASK_CODE) ApplicationUSBDeviceTask,
                (const signed char*)"USB Device Task",
                APPLICATION_USBDEVICETASK_STKSIZE,
                NULL,
                APPLICATION_USBDEVICETASK_PRIO,
                NULL);
    errStatus = xTaskCreate((pdTASK_CODE) ApplicationDisplayTask,
                (const signed char*)"Display Task",
                APPLICATION_DISPLAYTASK_STKSIZE,
                NULL,
                APPLICATION_DISPLAYTASK_PRIO,
                NULL);

   /*setup up interrupt controller to use multi-vectored mode, this is not the internal CP0 register,
   this sets the SFR register*/
   PLIB_INT_MultiVectorSelect(INT_ID_0);
   /* Set priority for USB interrupt source */                                
   PLIB_INT_VectorPrioritySet(INT_ID_0,INT_VECTOR_USB,INT_PRIORITY_LEVEL4);
}