cleanup main
This commit is contained in:
@@ -34,6 +34,15 @@ void init_timer_100us(){
|
|||||||
TCC0.INTCTRLA |= TC_OVFINTLVL_HI_gc;
|
TCC0.INTCTRLA |= TC_OVFINTLVL_HI_gc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void io_setup(void){
|
||||||
|
// LED
|
||||||
|
PORTD.DIRSET = 1 << 5;
|
||||||
|
|
||||||
|
// pullups for address switch
|
||||||
|
PORTCFG.MPCMASK = 0xFF;
|
||||||
|
PORTC.PIN1CTRL = PORT_OPC_PULLUP_gc;
|
||||||
|
}
|
||||||
|
|
||||||
void modbusGet(void) {
|
void modbusGet(void) {
|
||||||
if (modbusGetBusState() & (1<<ReceiveCompleted))
|
if (modbusGetBusState() & (1<<ReceiveCompleted))
|
||||||
{
|
{
|
||||||
@@ -50,17 +59,18 @@ void modbusGet(void) {
|
|||||||
|
|
||||||
int main(void){
|
int main(void){
|
||||||
init_clk();
|
init_clk();
|
||||||
PORTD.DIRSET = 1 << 5;
|
io_setup();
|
||||||
|
|
||||||
|
// blink LED on startup
|
||||||
PORTD.OUTTGL = 1 << 5;
|
PORTD.OUTTGL = 1 << 5;
|
||||||
_delay_ms(500);
|
_delay_ms(500);
|
||||||
PORTD.OUTTGL = 1 << 5;
|
PORTD.OUTTGL = 1 << 5;
|
||||||
|
|
||||||
|
// init pt100 stuff
|
||||||
adc_init();
|
adc_init();
|
||||||
dma_init();
|
dma_init();
|
||||||
|
|
||||||
PORTCFG.MPCMASK = 0xFF;
|
// setup modbus tick timer
|
||||||
PORTC.PIN1CTRL = PORT_OPC_PULLUP_gc;
|
|
||||||
|
|
||||||
init_timer_100us();
|
init_timer_100us();
|
||||||
|
|
||||||
PMIC.CTRL |= PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm;
|
PMIC.CTRL |= PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm;
|
||||||
|
|||||||
Reference in New Issue
Block a user