Sha256: c6c245b44e5e11ed833470bb07ed178ec9706bc19121dc16de59a2e090530e03
Contents?: true
Size: 1.3 KB
Versions: 37
Compression:
Stored size: 1.3 KB
Contents
#include "unity.h" #include "Types.h" #include "AdcTemperatureSensor.h" #include "AT91SAM7X256.h" AT91S_ADC AdcPeripheral; void setUp(void) { } void tearDown(void) { } void testShouldStartTemperatureSensorConversionWhenTriggered(void) { AT91C_BASE_ADC->ADC_CR = 0; Adc_StartTemperatureSensorConversion(); TEST_ASSERT_EQUAL(AT91C_ADC_START, AT91C_BASE_ADC->ADC_CR); } void testTemperatureSensorSampleReadyShouldReturnChannelConversionCompletionStatus(void) { AT91C_BASE_ADC->ADC_SR = 0; TEST_ASSERT_EQUAL(FALSE, Adc_TemperatureSensorSampleReady()); AT91C_BASE_ADC->ADC_SR = ~AT91C_ADC_EOC4; TEST_ASSERT_EQUAL(FALSE, Adc_TemperatureSensorSampleReady()); AT91C_BASE_ADC->ADC_SR = AT91C_ADC_EOC4; TEST_ASSERT_EQUAL(TRUE, Adc_TemperatureSensorSampleReady()); AT91C_BASE_ADC->ADC_SR = 0xffffffff; TEST_ASSERT_EQUAL(TRUE, Adc_TemperatureSensorSampleReady()); } void testReadTemperatureSensorShouldFetchAndTranslateLatestReadingToMillivolts(void) { uint16 result; // ADC bit weight at 10-bit resolution with 3.0V reference = 2.9296875 mV/LSB AT91C_BASE_ADC->ADC_CDR4 = 138; result = Adc_ReadTemperatureSensor(); TEST_ASSERT_EQUAL(404, result); AT91C_BASE_ADC->ADC_CDR4 = 854; result = Adc_ReadTemperatureSensor(); TEST_ASSERT_EQUAL(2502, result); }
Version data entries
37 entries across 37 versions & 1 rubygems