digital.h File Reference

Digital Inputs. More...


Functions

void digital_init (void)
uint8_t digital_read_8 ()
uint8_t digital_read (uint8_t port)

Detailed Description

The Happyboard has 8 digital inputs.

The digital inputs on the Happyboard are unfiltered and as such there is "switch bounce" when they are connected to bump-sensors. To compensate for this users should read digital inputs a few times with short delays between readings to ensure accurate sensing.


Function Documentation

void digital_init ( void   ) 

Initialize digital ports. Should not be called by user.

uint8_t digital_read ( uint8_t  port  ) 

Return the value of a specific digital port. If the port specified is an analog port (8-23), digital_read() returns the equivalent digital reading - <2.5V: FALSE >=2.5V: TRUE.

Parameters:
port port to read (0-23)

uint8_t digital_read_8 (  ) 

Return the value of all of the digital ports as a single packed byte. The least significant bit is port 0, the most significant is port 7.