SAADC library and drivers for nrf52832.
Dependents: acd52832_SAADC_Differential_input_EPD acd52832_Car_battery_ch acd52832_Car_battery_ch_2
Library to use aconno drivers for Nordic Semiconductor nrf52832 SAADC.
acd_nrf52_saadc.h@5:f797719350a6, 2017-08-23 (annotated)
- Committer:
- Dautor
- Date:
- Wed Aug 23 09:28:35 2017 +0000
- Revision:
- 5:f797719350a6
- Parent:
- 3:fcada8b3b567
- Child:
- 8:b4afe08821f5
Small changes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jurica238814 | 0:838e26b2ef09 | 1 | /* |
Dautor | 1:2d6e904c6843 | 2 | * Made by Jurica Resetar and Karlo Milicevic @ aconno, 2017 |
jurica238814 | 0:838e26b2ef09 | 3 | * jurica_resetar@yahoo.com |
jurica238814 | 0:838e26b2ef09 | 4 | * aconno.de |
jurica238814 | 0:838e26b2ef09 | 5 | * All rights reserved |
jurica238814 | 0:838e26b2ef09 | 6 | * |
jurica238814 | 0:838e26b2ef09 | 7 | */ |
Dautor | 3:fcada8b3b567 | 8 | |
Dautor | 3:fcada8b3b567 | 9 | #ifndef ACD_NRF52_SAADC_H |
Dautor | 3:fcada8b3b567 | 10 | #define ACD_NRF52_SAADC_H |
Dautor | 3:fcada8b3b567 | 11 | |
Dautor | 3:fcada8b3b567 | 12 | #include "mbed.h" |
Dautor | 3:fcada8b3b567 | 13 | |
Dautor | 3:fcada8b3b567 | 14 | /** NRF52 adc library |
Dautor | 3:fcada8b3b567 | 15 | */ |
Dautor | 3:fcada8b3b567 | 16 | class NRF52_SAADC{ |
Dautor | 1:2d6e904c6843 | 17 | public: |
Dautor | 3:fcada8b3b567 | 18 | /** Initializes adc module |
Dautor | 3:fcada8b3b567 | 19 | */ |
Dautor | 3:fcada8b3b567 | 20 | NRF52_SAADC(); |
Dautor | 1:2d6e904c6843 | 21 | ~NRF52_SAADC(); |
Dautor | 3:fcada8b3b567 | 22 | /** @returns |
Dautor | 3:fcada8b3b567 | 23 | * 0 on success, 1 otherwise |
Dautor | 3:fcada8b3b567 | 24 | */ |
Dautor | 3:fcada8b3b567 | 25 | bool addChannel(uint8_t pin); |
Dautor | 3:fcada8b3b567 | 26 | void calibrate(); |
Dautor | 5:f797719350a6 | 27 | /** Reads analog pins |
Dautor | 5:f797719350a6 | 28 | */ |
Dautor | 3:fcada8b3b567 | 29 | void updateData(); |
Dautor | 5:f797719350a6 | 30 | /** @returns |
Dautor | 5:f797719350a6 | 31 | * pointer to analog input data - data is stored in channel add order |
Dautor | 5:f797719350a6 | 32 | */ |
Dautor | 3:fcada8b3b567 | 33 | int16_t *getData() { return data; } |
Dautor | 1:2d6e904c6843 | 34 | private: |
Dautor | 3:fcada8b3b567 | 35 | int16_t data[sizeof(int16_t)*8]; // 8 channels |
Dautor | 1:2d6e904c6843 | 36 | }; |
jurica238814 | 0:838e26b2ef09 | 37 | |
jurica238814 | 0:838e26b2ef09 | 38 | #endif // ACD_NRF52_SAADC_H |