void adc_start_single(uint8_t c) { // ADC reference voltage is AVcc ADMUX = _UV(REFS0) | (c & 0x07); _SETBIT(ADCSRA, ADSC); _SETBIT(ADCSRA, ADIE); }
static void __cdecl _lock_create ( unsigned locknum ) { #ifdef _IOSDEBUG /* * See if the lock already exists; if so, die. */ if (_TESTBIT(_lockmap, locknum)) _FATAL; #endif /* * Convert the lock number into a lock address * and create the semaphore. */ /* * Convert the lock number into a lock address * and initialize the critical section. */ InitializeCriticalSection( &_locktable[locknum] ); /* * Set the appropriate bit in the lock bit map. */ _SETBIT(_lockmap, locknum); }
/* init */ void nokia1100_init() { /* output port */ NOKIA1100_PDIR |= (1 << NOKIA1100_SS) | (1 << NOKIA1100_RESET) | (1 << NOKIA1100_CLK) | (1 << NOKIA1100_MOSI); _SETBIT(NOKIA1100_POUT, NOKIA1100_SS); _RSTBIT(NOKIA1100_POUT, NOKIA1100_RESET); _SETBIT(NOKIA1100_POUT, NOKIA1100_RESET); /* initalization commands */ _nokia1100_chargepump_on(); nokia1100_contrast(NOKIA1100_INIT_CONTRAST); nokia1100_power_on(); nokia1100_clear(); nokia1100_gotoy(0); nokia1100_gotox(0); }