Skip to content

Commit 3640c2e

Browse files
authored
Merge pull request #158 from MatzElectronics/Community
add s3 adc read
2 parents 451c6e3 + 3918947 commit 3640c2e

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed
Binary file not shown.

Learn/Simple Libraries/Robotics/S3/libs3/libs3.c

-7
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,6 @@ the Test Utility, cycle the Scribbler//s power switch.
7474
7575
*/
7676

77-
// ------ Libraries and Definitions ------
78-
#include "simpletools.h"
79-
#include "s3.h"
80-
81-
82-
83-
// ------ Main Program ------
8477
int main()
8578
{
8679

Learn/Simple Libraries/Robotics/S3/libs3/s3.c

+6
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,7 @@ int32_t s3_ping(int32_t Pin)
702702
return result;
703703
}
704704

705+
// User EEPROM read/write functions
705706
void s3_memoryWrite(int32_t Addr, int32_t Value) {
706707
int AddrMax = (32768 - SCRIBBLER_EE_USER_AREA) / 4; // 7936
707708
if(Addr >= 0 && Addr < AddrMax) {
@@ -711,4 +712,9 @@ void s3_memoryWrite(int32_t Addr, int32_t Value) {
711712

712713
int32_t s3_memoryRead(int32_t Addr) {
713714
return scribbler_ee_read_byte((Addr * 4) + SCRIBBLER_EE_USER_AREA);
715+
}
716+
717+
// Return the ADC reading in volt-hundreths
718+
int32_t s3_readADC(int32_t p) {
719+
(scribbler_get_results(p) * 500) >> 16;
714720
}

Learn/Simple Libraries/Robotics/S3/libs3/s3.h

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
#define S3_COLOR_00FF00 (SCRIBBLER_GREEN)
3737
#define S3_OFF (0)
3838
#define S3_COLOR_000000 (S3_OFF)
39+
#define S3_ADC_A0 (SCRIBBLER_ADC_P6)
40+
#define S3_ADC_A1 (SCRIBBLER_ADC_P7)
3941

4042

4143

0 commit comments

Comments
 (0)