Ejemplo n.º 1
0
uint8_t show_BH1750_Bright(struct bhl1750 *bright){


	if ( Semaphore_getCount(brightDataHandle) == 0 )   {
		//putstr("\r\nRead Brightness Data blocked!\r\n");
	}else{
		Semaphore_pend(brightDataHandle, BIOS_WAIT_FOREVER);
		putstr("\r\nBrightness: ");
		putdata(bright->SensBrightness);
		putstr(" Lux                            ");
		Semaphore_post(brightDataHandle);
	}

		return 0;
}
Ejemplo n.º 2
0
uint8_t save_BH1750_Bright(struct bhl1750 *bright){


	if ( Semaphore_getCount(brightDataHandle) == 0 )   {
		//putstr("\r\nWrite Brightness Data blocked!\r\n");
	}else{
		Semaphore_pend(brightDataHandle, BIOS_WAIT_FOREVER);
		bright->SensBrightness = get_BH1750_LightLevel();
		Semaphore_post(brightDataHandle);
	}

	if( bright->SensBrightness != 0 ){
		return 0;
	}else{
		return 1;
	}

}
Ejemplo n.º 3
0
/*
 *  ======== SyncSem_Instance_init ========
 */
Int  SyncSem_Instance_init(SyncSem_Object *obj, const SyncSem_Params *params,
                           Error_Block *eb)
{
    Semaphore_Params semPrms;

    if (params->sem == NULL) {
        Semaphore_Params_init(&semPrms);
        semPrms.mode = Semaphore_Mode_BINARY;
        obj->sem = Semaphore_create(0, &semPrms, eb);
        if (obj->sem == NULL) {
            return (1);
        }
        obj->userSem = FALSE;
    }
    else {
        obj->userSem = TRUE;
        obj->sem = params->sem;
        Assert_isTrue(!Semaphore_getCount(obj->sem), NULL);
    }

    return (0);
}