コード例 #1
0
/*
 * Handle a message that will cause us to start.
 * 
 * batteriesOnly if true, only start up the battery
 *               related items on the OneWire bus
 *               (useful when just synchronising
 *               remaining battery capacity values),
 *               otherwise setup the PIOs as well.
 * pSendMsgBody  pointer to the relevant message
 *               type to fill in with a response,
 *               which will be overlaid over the
 *               body of the response message.
 * 
 * @return       the length of the message body
 *               to send back.
 */
static UInt16 actionHardwareServerStart (Bool batteriesOnly, HardwareServerStartCnf *pSendMsgBody)
{
    Bool success;
    UInt16 sendMsgBodyLength = 0;

    ASSERT_PARAM (pSendMsgBody != PNULL, (unsigned long) pSendMsgBody);
    
   /* First of all, start up the OneWire bus */
    success = startOneWireBus();      
    if (success)
    {
        /* Find and setup the devices on the OneWire bus */
        success = setupDevices (batteriesOnly);
        if (!success)
        {
            /* If the setup fails, print out what devices we can find */
            findAllDevices();
        }
    }
    
    pSendMsgBody->success = success;
    sendMsgBodyLength += sizeof (pSendMsgBody->success);
    
    return sendMsgBodyLength;
}
コード例 #2
0
ファイル: main.c プロジェクト: JorgeGzm/JAGA
int main(void)
{
    //Inicializa sistema
    setupHardware();

    //Inicializa dispositivos
    setupDevices();
   
    while(1)
    {
        //Executa rotinas da funcionalidade
        run_system();
        
        //Executa rotina que trata a HIM
        run_him();
    }
    
    return 0;
}