View allAll Photos Tagged optimize
Setup for low current measurement. This little BLE thingy we are building has to work forever on next to no power :). It seems that whatever we achieve in terms of low power and tiny packages it's never enough - there's always this one project where they need it just a little bit smaller with just a little bit smaller battery and just a little more range.
www.howtoseodubai.com/seo-engine-optimization-dubai/seo-o... SEO optimization Dubai: Compelling headline, credibility, social proof, summary, CTA, guarantee & benefits help your visitors act. Get 100s of free seo tips
When dealing with this I realized (finally) that I could remove duplicate code and use this as the replacement:
uint8_t bit_value = _BV(bit);
if(bit <= 7) { // read data-bits 0...7
if( (PINA & _BV(PA0)) ) {
soft_uart_rx_byte |= bit_value;
} else {
soft_uart_rx_byte &= ~bit_value;
}
[...]
Now the _BV(bit) expression has to be evaluated just once. But that didn't help at all. It seems the compiler had already optimized the previous code.