* Retuen 1 if the value is an old one
* Return 2 if an overrun occured
*/
-int adc_get_value(uint16_t * val, unsigned int channel)
+int adc_get_value(uint16_t * val, uint8_t channel)
{
struct lpc_adc* adc = LPC_ADC;
uint32_t save_reg = 0;
- if (channel > NB_ADC_CHANNELS)
+ if (channel >= NB_ADC_CHANNELS)
return -1;
/* Save the whole register as some bits are cleared when register is read */
}
/* Start a conversion on the given channel (0 to 7) */
-void adc_start_convertion_once(unsigned int channel, uint8_t seq_num, int use_int)
+void adc_start_convertion_once(uint8_t channel, uint8_t seq_num, uint8_t use_int)
{
struct lpc_adc* adc = LPC_ADC;
uint32_t reg_val = 0;
* some signals, or on timer for burst conversions.
*/
void adc_prepare_conversion_on_event(uint16_t channels, uint8_t event, uint8_t seq_num,
- int use_int, uint32_t mode)
+ uint8_t use_int, uint32_t mode)
{
struct lpc_adc* adc = LPC_ADC;
uint32_t reg_val = 0;
NVIC_DisableIRQ(ADC_SEQB_IRQ);
NVIC_DisableIRQ(ADC_THCMP_IRQ);
NVIC_DisableIRQ(ADC_OVR_IRQ);
+ /* Remove callback */
+ adc_int_callback = NULL;
/* Power Down ADC */
sys_config->powerdown_run_cfg |= LPC_POWER_DOWN_ADC;
/* Remove clock from ADC block */
* Return 1 if the value is an old one.
* Return 2 if an overrun occured
*/
-int adc_get_value(uint16_t * val, unsigned int channel);
+int adc_get_value(uint16_t * val, uint8_t channel);
-/* Start a conversion on the given channel (0 to 7)
+/* Start a conversion on the given channel
* Unsupported yet : Set use_int to 1 to have your interrupt callback called upon conversion done.
*/
-void adc_start_convertion_once(unsigned int channel, uint8_t seq_num, int use_int);
+void adc_start_convertion_once(uint8_t channel, uint8_t seq_num, uint8_t use_int);
/* Start burst conversions.
* channels is a bit mask of requested channels.
- * Use LPC_ADC_CHANNEL(x) (x = 0 .. 7) for channels selection.
+ * Use LPC_ADC_CHANNEL(x) (x = 0 .. 11) for channels selection.
*/
void adc_start_burst_conversion(uint16_t channels, uint8_t seq_num);
void adc_stop_burst_conversion(uint8_t seq_num);
* some signals, or on timer for burst conversions.
*/
void adc_prepare_conversion_on_event(uint16_t channels, uint8_t seq_num, uint8_t event,
- int use_int, uint32_t mode);
+ uint8_t use_int, uint32_t mode);
/* Software trigger of the given configured sequence */
void adc_trigger_sequence_conversion(uint8_t seq_num);