/* ADC */
{ LPC_ADC_AD2_PIO_0_14, LPC_FIXED, 0 }, /* Debug */
{ LPC_ADC_AD9_PIO_0_17, LPC_FIXED, 0 },
- { LPC_ADC_AD10_PIO_0_13, LPC_FIXED, 0 },
/* Timers */
- { LPC_GPIO_0_8, LPC_SCT_POUT0, 0 },
- { LPC_GPIO_0_9, LPC_SCT_POUT1, 0 },
- { LPC_GPIO_0_3, LPC_SCT_POUT2, 0 }, /* Debug */
+ { LPC_GPIO_0_9, LPC_SCT_POUT0, 0 },
+ { LPC_GPIO_0_3, LPC_SCT_POUT1, 0 }, /* Debug */
/* GPIO */
- { LPC_GPIO_0_2, LPC_GPIO, 0 },
+ { LPC_GPIO_0_2, LPC_GPIO, 0 }, /* Led */
{ LPC_GPIO_0_12, LPC_GPIO, 0 },
ARRAY_LAST_PIO,
};
/* Configure pins as used for capacitance sensing */
const struct pio_config capacitance_pins[] = {
- { LPC_GPIO_0_9, LPC_SCT_POUT1, 0 },
+ { LPC_GPIO_0_9, LPC_SCT_POUT0, 0 },
{ LPC_ADC_AD9_PIO_0_17, LPC_FIXED, 0 },
ARRAY_LAST_PIO,
};
/* Temp sensor */
ret = tmp101_sensor_config(&tmp101_sensor);
if (ret != 0) {
- serial_write(uart_num, "Temp config error\r\n", 19);
+ uprintf(uart_num, "Temp config error\n");
}
}
msleep(50); /* Wait for the end of the conversion : 40ms */
len = tmp101_sensor_read(&tmp101_sensor, &raw, &deci_degrees);
if (len != 0) {
- serial_write(uart_num, "Temp read error\r\n", 19);
+ uprintf(uart_num, "Temp read error\n");
} else {
- uprintf(uart_num, "Temp read: %d,%d - raw: 0x%04x.\r\n",
+ uprintf(uart_num, "Temp read: %d,%d - raw: 0x%04x.\n",
(deci_degrees/10), (deci_degrees%10), raw);
}
}
void set_led_color(void)
{
uint16_t red = 0, green = 0, blue = 0;
- static uint16_t tmp = 0;
/* Get ADC values */
- adc_get_value(&tmp, LPC_ADC_NUM(9));
- red = tmp;
- adc_get_value(&tmp, LPC_ADC_NUM(10));
- blue = tmp;
+ adc_get_value(&blue, LPC_ADC(9));
/* Set pixel */
- ws2812_set_pixel(0, (((red >> 6) & 0xFF) - 30), green, (((blue >> 6) & 0xFF) - 30));
+ ws2812_set_pixel(0, red, green, (((blue >> 6) & 0xFF) - 30));
ws2812_send_frame(0);
- uprintf(UART0, "ADC9: %d, ADC10: %d\n", red, blue);
+ uprintf(UART0, "ADC9: %d\n", blue);
}
}
const struct lpc_timer_pwm_config pwm_conf = {
- .nb_channels = 2,
+ .nb_channels = 1,
.period = 30,
- .outputs_initial_state = 0x07,
- .match_values = { 15, 10, 15, },
- .outputs = { 0, 1, 2, },
+ .outputs_initial_state = 0x01,
+ .match_values = { 10, },
+ .outputs = { 0, },
};
/***************************************************************************** */
config_gpio(&cap_trig_gpio, 0, GPIO_DIR_OUT, 0);
config_gpio(&cap_adc_gpio, 0, GPIO_DIR_OUT, 0);
adc_on(NULL);
- adc_start_burst_conversion(LPC_ADC_CHANNEL(2) | LPC_ADC_CHANNEL(9) | LPC_ADC_CHANNEL(10), LPC_ADC_SEQA);
-// adc_start_burst_conversion(LPC_ADC_CHANNEL(9) | LPC_ADC_CHANNEL(10), LPC_ADC_SEQA);
+ adc_start_burst_conversion(ADC_MCH(9), LPC_ADC_SEQA);
uprintf(UART0, "ADC config done\n");
/* Led strip configuration */