示例#1
0
/** A series of tests of setDigitalPin.
  * @param tc Test object.
  */
void
test_gpioSetDigitalPin(CuTest* tc)
{
    // An exception should be thrown in an invalid port / pin
    CuAssertTrue(tc, setDigitalPin(PORT_A_INDEX, 5, C_TRUE) == PM_RET_EX_VAL);

    // Test setting a pin true and false
    _LATA0 = 0;
    CuAssertTrue(tc, setDigitalPin(PORT_A_INDEX, 0, C_TRUE) == PM_RET_OK);
    CuAssertTrue(tc, _LATA0 == 1);
    CuAssertTrue(tc, setDigitalPin(PORT_A_INDEX, 0, C_FALSE) == PM_RET_OK);
    CuAssertTrue(tc, _LATA0 == 0);
}
示例#2
0
void OutputPins::setDigital(int value) {
	for (int i = 0; i < pinCount; i++) {
		setDigitalPin(i, value);
	}
}