Git
Wiki
Site
projects
/
soft
/
lpc82x
/
exanh
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
063079b
)
Exanh test app changed according to ADC and timers API changes. Includes changes...
author
Nathael Pajani
<nathael.pajani@ed3l.fr>
Tue, 27 Sep 2016 22:13:31 +0000
(
00:13
+0200)
committer
Nathael Pajani
<nathael.pajani@ed3l.fr>
Sat, 11 Feb 2023 04:09:54 +0000
(
05:09
+0100)
test/main.c
patch
|
blob
|
history
diff --git
a/test/main.c
b/test/main.c
index
9e496cc
..
accd5d2
100644
(file)
--- a/
test/main.c
+++ b/
test/main.c
@@
-57,20
+57,18
@@
const struct pio_config common_pins[] = {
/* ADC */
{ LPC_ADC_AD2_PIO_0_14, LPC_FIXED, 0 }, /* Debug */
{ LPC_ADC_AD9_PIO_0_17, LPC_FIXED, 0 },
/* 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 */
/* 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 */
/* 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_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_POUT
1
, 0 },
+ { LPC_GPIO_0_9, LPC_SCT_POUT
0
, 0 },
{ LPC_ADC_AD9_PIO_0_17, LPC_FIXED, 0 },
ARRAY_LAST_PIO,
};
{ LPC_ADC_AD9_PIO_0_17, LPC_FIXED, 0 },
ARRAY_LAST_PIO,
};
@@
-99,7
+97,7
@@
void temp_config(int uart_num)
/* Temp sensor */
ret = tmp101_sensor_config(&tmp101_sensor);
if (ret != 0) {
/* 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"
);
}
}
}
}
@@
-113,9
+111,9
@@
void temp_display(int uart_num)
msleep(50); /* Wait for the end of the conversion : 40ms */
len = tmp101_sensor_read(&tmp101_sensor, &raw, &deci_degrees);
if (len != 0) {
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 {
} 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);
}
}
(deci_degrees/10), (deci_degrees%10), raw);
}
}
@@
-153,19
+151,15
@@
void fault_info(const char* name, uint32_t len)
void set_led_color(void)
{
uint16_t red = 0, green = 0, blue = 0;
void set_led_color(void)
{
uint16_t red = 0, green = 0, blue = 0;
- static uint16_t tmp = 0;
/* Get ADC values */
/* 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 */
/* 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);
ws2812_send_frame(0);
- uprintf(UART0, "ADC9: %d
, ADC10: %d\n", red
, blue);
+ uprintf(UART0, "ADC9: %d
\n"
, blue);
}
}
@@
-176,11
+170,11
@@
void trigger_message(uint32_t int_num) {
}
const struct lpc_timer_pwm_config pwm_conf = {
}
const struct lpc_timer_pwm_config pwm_conf = {
- .nb_channels =
2
,
+ .nb_channels =
1
,
.period = 30,
.period = 30,
- .outputs_initial_state = 0x0
7
,
- .match_values = { 1
5, 10, 15
, },
- .outputs = { 0,
1, 2,
},
+ .outputs_initial_state = 0x0
1
,
+ .match_values = { 1
0
, },
+ .outputs = { 0, },
};
/***************************************************************************** */
};
/***************************************************************************** */
@@
-199,8
+193,7
@@
int main(void)
config_gpio(&cap_trig_gpio, 0, GPIO_DIR_OUT, 0);
config_gpio(&cap_adc_gpio, 0, GPIO_DIR_OUT, 0);
adc_on(NULL);
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 */
uprintf(UART0, "ADC config done\n");
/* Led strip configuration */
Techno-Innov
42 impasse de la Combe du Bois
01150 Blyes - France
contact@techno-innov.fr
Design et hébergement du site :
Techno-Innov
Techno-Innov
- SARL Coopérative
539 169 417 RCS Bourg-en-Bresse
Ce site n'utilise pas de cookies, désolé pour les gourmands !