Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADC Implementation #5

Open
wallarug opened this issue Sep 3, 2019 · 0 comments
Open

ADC Implementation #5

wallarug opened this issue Sep 3, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@wallarug
Copy link
Member

wallarug commented Sep 3, 2019

Please implement the ADC for CircuitPython SeeSaw.

Some of the below can be simplified to achieve required functionality.

seesaw/include/RegisterMap.h

#define SEESAW_ADC_BASE 0x09

	/****** STATUS *****/
	#define SEESAW_ADC_STATUS 0x00

	//this is asserted when this encorunters an error
	#define SEESAW_ADC_STATUS_ERROR_BITS 0x01
	
	//this is asserted when window monitor interrupt occurs
	#define SEESAW_ADC_STATUS_WINMON 0x02
	
	/****** INTENSET *****/
	//writing a 1 to any of the bits in this register enables the interrupt
	#define SEESAW_ADC_INTEN 0x02

	// if this bit is set to 1, assert interrupt when window monitor conditions are met
	#define SEESAW_ADC_INTEN_WINMON_BITS 0x01

	/****** INTENCLR *****/
	/* writing a 1 to any of these bits disables the interrupt.
	 * this automatically updates the inten register
	 */
	#define SEESAW_ADC_INTENCLR 0x03

	// writing a 1 disables the window monitor interrupt
	#define SEESAW_ADC_INTENCLR_WINMON_BITS 0x01
	
	/****** WINMODE *****/
	#define SEESAW_ADC_WINMODE 0x04
		
	/****** WINTHRESH *****/
	//window monitor thresholds
	#define SEESAW_ADC_WINTHRESH 0x05
	
	/****** CHANNELS *****/
	#define SEESAW_ADC_CHANNEL_0 0x07
	#define SEESAW_ADC_CHANNEL_1 0x08
	#define SEESAW_ADC_CHANNEL_2 0x09
	#define SEESAW_ADC_CHANNEL_3 0x0A
    #define SEESAW_ADC_CHANNEL_4 0x0B
    #define SEESAW_ADC_CHANNEL_5 0x0C
    #define SEESAW_ADC_CHANNEL_6 0x0D
    #define SEESAW_ADC_CHANNEL_7 0x0E

Documentation: https://learn.adafruit.com/adafruit-seesaw-atsamd09-breakout/analog-to-digital-converter

CircuitPython Learn Guide: https://learn.adafruit.com/circuitpython-essentials/circuitpython-analog-in

@wallarug wallarug added the enhancement New feature or request label Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant