Commit 9b8a8aae authored by Jake Read's avatar Jake Read

apa fast packets

parent 8c063d60
......@@ -68,19 +68,19 @@ Layer=21
Package="AYZ0102AGRLC"
[Win_2]
Type="Board Editor"
Type="Schematic Editor"
Loc="0 0 1919 1016"
State=1
Number=2
File="mkrouter.brd"
View="-14.045 -4.4575 135.445 78.9618"
WireWidths=" 0.0762 0.1016 0.127 0.15 0.4064 0.508 0.6096 0.8128 1.016 1.27 2.54 0.3048 0.2 0.254 0.1524 0.2032"
Number=1
File="mkrouter.sch"
View="-49.6823 -37.446 410.437 258.349"
WireWidths=" 0.0762 0.1016 0.127 0.15 0.2 0.2032 0.254 0.3048 0.4064 0.508 0.6096 0.8128 1.016 1.27 2.54 0.1524"
PadDiameters=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.27 1.4224 1.6764 1.778 1.9304 2.1844 2.54 3.81 6.4516 0"
PadDrills=" 0.2 0.25 0.35 0.4 0.45 0.5 0.55 0.65 0.7 0.75 0.8 0.85 0.9 1 0.6 0.3"
PadDrills=" 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.65 0.7 0.75 0.8 0.85 0.9 1 0.6"
ViaDiameters=" 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1 1.05 1.1 1.15 1.2 1.3 0"
ViaDrills=" 0.2 0.4 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 1 0.25 0.45 0.35 0.3"
HoleDrills=" 0.2 0.25 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 1 0.35 0.3"
TextSizes=" 0.254 0.3048 0.4064 0.8128 1.27 1.9304 2.1844 2.54 3.81 5.08 6.4516 1.778 1.016 0.6096 1.4224 1.6764"
ViaDrills=" 0.2 0.25 0.3 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 1 0.35"
HoleDrills=" 0.2 0.25 0.3 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 1 0.35"
TextSizes=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.27 1.4224 1.6764 1.9304 2.1844 2.54 3.81 5.08 6.4516 1.778"
PolygonSpacings=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.4224 1.6764 1.778 1.9304 2.1844 2.54 3.81 5.08 6.4516 1.27"
PolygonIsolates=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.27 1.4224 1.6764 1.778 1.9304 2.1844 2.54 3.81 6.4516 0"
MiterRadiuss=" 0.254 0.3175 0.635 1.27 2.54 1 2 2.5 5 7.5 10 0"
......@@ -89,14 +89,14 @@ DimensionExtWidths=" 0.127 0.254 0.1 0.13 0.26 0"
DimensionExtLengths=" 1.27 2.54 1 2 3 0"
DimensionExtOffsets=" 1.27 2.54 1 2 3 0"
SmdSizes=" 0.3048 0.1524 0.4064 0.2032 0.6096 0.3048 0.8128 0.4064 1.016 0.508 1.27 0.6604 1.4224 0.7112 1.6764 0.8128 1.778 0.9144 1.9304 0.9652 2.1844 1.0668 2.54 1.27 3.81 1.9304 5.08 2.54 6.4516 3.2512 1.27 0.635"
WireBend=6
WireBendSet=0
WireBend=0
WireBendSet=31
WireCap=1
MiterStyle=0
PadShape=0
ViaShape=1
PolygonPour=0
PolygonRank=1
PolygonRank=0
PolygonThermals=1
PolygonOrphans=0
TextRatio=8
......@@ -111,22 +111,24 @@ SwapLevel=0
ArcDirection=0
AddLevel=2
PadsSameType=0
Layer=1
Layer=91
Views=" 1: -49.6823 -37.446 410.437 258.349"
Sheet="1"
[Win_3]
Type="Schematic Editor"
Type="Board Editor"
Loc="0 0 1919 1016"
State=1
Number=1
File="mkrouter.sch"
View="-49.6823 -37.446 410.437 258.349"
WireWidths=" 0.0762 0.1016 0.127 0.15 0.2 0.2032 0.254 0.3048 0.4064 0.508 0.6096 0.8128 1.016 1.27 2.54 0.1524"
Number=2
File="mkrouter.brd"
View="-15.8584 -4.26648 133.632 79.1528"
WireWidths=" 0.0762 0.1016 0.127 0.15 0.4064 0.508 0.6096 0.8128 1.016 1.27 2.54 0.3048 0.2 0.254 0.1524 0.2032"
PadDiameters=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.27 1.4224 1.6764 1.778 1.9304 2.1844 2.54 3.81 6.4516 0"
PadDrills=" 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.65 0.7 0.75 0.8 0.85 0.9 1 0.6"
PadDrills=" 0.2 0.25 0.35 0.4 0.45 0.5 0.55 0.65 0.7 0.75 0.8 0.85 0.9 1 0.6 0.3"
ViaDiameters=" 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1 1.05 1.1 1.15 1.2 1.3 0"
ViaDrills=" 0.2 0.25 0.3 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 1 0.35"
HoleDrills=" 0.2 0.25 0.3 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 1 0.35"
TextSizes=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.27 1.4224 1.6764 1.9304 2.1844 2.54 3.81 5.08 6.4516 1.778"
ViaDrills=" 0.2 0.4 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 1 0.25 0.45 0.35 0.3"
HoleDrills=" 0.2 0.25 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 1 0.35 0.3"
TextSizes=" 0.254 0.3048 0.4064 0.8128 1.27 1.9304 2.1844 2.54 3.81 5.08 6.4516 1.778 1.016 0.6096 1.4224 1.6764"
PolygonSpacings=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.4224 1.6764 1.778 1.9304 2.1844 2.54 3.81 5.08 6.4516 1.27"
PolygonIsolates=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.27 1.4224 1.6764 1.778 1.9304 2.1844 2.54 3.81 6.4516 0"
MiterRadiuss=" 0.254 0.3175 0.635 1.27 2.54 1 2 2.5 5 7.5 10 0"
......@@ -135,14 +137,14 @@ DimensionExtWidths=" 0.127 0.254 0.1 0.13 0.26 0"
DimensionExtLengths=" 1.27 2.54 1 2 3 0"
DimensionExtOffsets=" 1.27 2.54 1 2 3 0"
SmdSizes=" 0.3048 0.1524 0.4064 0.2032 0.6096 0.3048 0.8128 0.4064 1.016 0.508 1.27 0.6604 1.4224 0.7112 1.6764 0.8128 1.778 0.9144 1.9304 0.9652 2.1844 1.0668 2.54 1.27 3.81 1.9304 5.08 2.54 6.4516 3.2512 1.27 0.635"
WireBend=0
WireBendSet=31
WireBend=6
WireBendSet=0
WireCap=1
MiterStyle=0
PadShape=0
ViaShape=1
PolygonPour=0
PolygonRank=0
PolygonRank=1
PolygonThermals=1
PolygonOrphans=0
TextRatio=8
......@@ -157,9 +159,7 @@ SwapLevel=0
ArcDirection=0
AddLevel=2
PadsSameType=0
Layer=91
Views=" 1: -49.6823 -37.446 410.437 258.349"
Sheet="1"
Layer=1
[Win_4]
Type="Control Panel"
......
......@@ -9,11 +9,11 @@
#include "apahandler.h"
void apa_handle_packet(uint8_t *packet, uint8_t length){
// dirty debug reply
uart_sendchars_buffered(&up0, packet, length);
// ack with new packet
apa_return_packet(packet, length);
// through packet
for(int i = 0; i < length; i ++){
if(packet[i] == APA_END_ADDR_DELIMITER){
if(packet[i] == APA_END_ROUTE_DELIMITER){
// data begins
// check we have data after addr delimiter
if(i + 1 < length){
......@@ -25,4 +25,37 @@ void apa_handle_packet(uint8_t *packet, uint8_t length){
}
}
}
}
\ No newline at end of file
}
void apa_return_packet(uint8_t *packet, uint8_t length){
uint8_t ackpack[length];
ackpack[0] = length;
// find route header
int i = 2;
int stop = 0;
while(i < length){
if(packet[i] == APA_END_ROUTE_DELIMITER){
stop = i;
break;
}
i ++;
}
// do the business
if(!stop){
// error if stop == 0
} else {
// reverse the address header
for(int a = stop - 1, b = 1; a >= 1; a--, b++){
ackpack[b] = packet[a];
}
// fill the rest with same packet data
ackpack[stop] = APA_END_ROUTE_DELIMITER;
for(int u = stop; u < length; u ++){
ackpack[u] = packet[u];
}
uart_sendchars_buffered(ups[ackpack[1]], ackpack, length);
}
}
// NOW: test this
// then, also: can we avoid packing ups into apaports, use hardware.h instead?
......@@ -12,5 +12,6 @@
#include <asf.h>
void apa_handle_packet(uint8_t *packet, uint8_t length);
void apa_return_packet(uint8_t *packet, uint8_t length);
#endif /* APAHANDLER_H_ */
\ No newline at end of file
......@@ -6,14 +6,12 @@
*/
#include "apaport.h"
#include "hardware.h"
void apaport_build(apaport_t *apap, uint8_t portnum, uartport_t *uart, uartport_t **uarts, uint8_t numports, pin_t *stlr, pin_t *stlg, pin_t *stlb){
void apaport_build(apaport_t *apap, uint8_t portnum, uartport_t *uart, pin_t *stlr, pin_t *stlb){
apap->uart = uart;
apap->uarts = uarts;
apap->portnum = portnum;
apap->numports = numports;
apap->stlr = stlr;
apap->stlg = stlg;
apap->stlb = stlb;
}
......@@ -24,7 +22,6 @@ void apaport_reset(apaport_t *apap){
apap->packet_position = 0;
pin_set(apap->stlr);
pin_set(apap->stlg);
pin_set(apap->stlb);
}
......@@ -57,35 +54,31 @@ void apaport_scan(apaport_t *apap, uint32_t maxpackets){
while(apap->packets_ready > 0){
// the particular packet index
uint32_t p = (apap->packet_num + APAPORT_NUM_STATIC_PACKETS - apap->packets_ready) % APAPORT_NUM_STATIC_PACKETS;
// first we shift the old pointer out (p[1] is, at the moment, the port the last node tx'd on)
apapacket_shift_pointer(apap->packets[p], apap->portnum);
// now p[1] is next port
// now to handle
// [p][0] is length of packet
if(apap->packets[p][1] == APA_ADDR_POINTER){
if(apap->packets[p][1] == APA_ROUTE_POINTER){
apa_handle_packet(apap->packets[p], apap->packets[p][0]);
} else if(apap->packets[p][1] == APA_ADDR_FLOOD){
} else if(apap->packets[p][1] == APA_ROUTE_FLOOD){
// loop through bytes to find pointer and increment
apapacket_increment_pointer(apap->packets[p], apap->portnum);
// now ship it out on all ports
for(int i = 0; i < APAPORT_NUM_PORTS; i ++){
if(i == apap->portnum){
// don't flood back
} else {
uart_sendchars_buffered(apap->uarts[i], apap->packets[p], apap->packets[p][0]);
uart_sendchars_buffered(ups[i], apap->packets[p], apap->packets[p][0]);
}
}
} else {
// packet is for a particular port,
// we pull that out of the packet now in case the pointer decrements into [1]
uint8_t port = apap->packets[p][1];
// and check that we're sending it out on a port that exists
if (port >= APAPORT_NUM_PORTS){
port = APAPORT_NUM_PORTS - 1;
if(apap->packets[p][1] > APAPORT_NUM_PORTS){
// port does not exist, throw error
// pin_clear(&stlr);
} else {
uart_sendchars_buffered(ups[apap->packets[p][1]], apap->packets[p], apap->packets[p][0]);
}
// now we can increment, safely moving pointer
apapacket_increment_pointer(apap->packets[p], apap->portnum);
// send on next port
// HERE: failing on send to other ports?
// double / triple check pointer to pointer
uart_sendchars_buffered(apap->uarts[port], apap->packets[p], apap->packets[p][0]);
}
// debug reply (at the moment, reply is handled in apa_handle_packet
// uart_sendchars_buffered(apap->uart, apap->packets[p], apap->packets[p][0]);
......@@ -93,14 +86,18 @@ void apaport_scan(apaport_t *apap, uint32_t maxpackets){
}
}
void apapacket_increment_pointer(uint8_t *packet, uint8_t portnum){
for(int i = 2; i < packet[0]; i ++){
// loop through bytes to find pointer and increment
if(packet[i] == APA_ADDR_POINTER){
packet[i-1] = APA_ADDR_POINTER; // increment pointer forwards
packet[i] = portnum; // port received on is this one
break; // we can finish scan now, not looping senselessly through rest of packet
void apapacket_shift_pointer(uint8_t *packet, uint8_t portnum){
int i = 2;
while(i < packet[0]){ // while less than length
if(packet[i] == APA_END_ROUTE_DELIMITER){
// put our port in tail
packet[i-1] = portnum;
break;
} else {
// shift 'em down
packet[i-1] = packet[i];
}
i ++;
}
}
......
......@@ -20,19 +20,16 @@
#define APAPORT_OUTSIDE_PACKET 0
#define APAPORT_INSIDE_PACKET 1
#define APA_END_ADDR_DELIMITER 255
#define APA_ADDR_POINTER 254
#define APA_ADDR_FLOOD 253
#define APA_END_ROUTE_DELIMITER 255
#define APA_ROUTE_POINTER 254
#define APA_ROUTE_FLOOD 253
typedef struct{
uartport_t *uart;
uartport_t **uarts; // ptr to array of ptrs ?
pin_t *stlr;
pin_t *stlb;
pin_t *stlg;
uint8_t portnum; // which port are we
uint8_t numports; // how many in the array we got
uint32_t packet_num;
uint32_t packet_position;
......@@ -41,12 +38,12 @@ typedef struct{
uint8_t packets[APAPORT_NUM_STATIC_PACKETS][256]; // packets for handling by app
}apaport_t;
void apaport_build(apaport_t *apap, uint8_t portnum, uartport_t *uart, uartport_t **uarts, uint8_t numports, pin_t *stlr, pin_t *stlg, pin_t *stlb);
void apaport_build(apaport_t *apap, uint8_t portnum, uartport_t *uart, pin_t *stlr, pin_t *stlb);
void apaport_reset(apaport_t *apap);
void apaport_scan(apaport_t *apap, uint32_t maxpackets);
void apapacket_increment_pointer(uint8_t *packet, uint8_t portnum);
void apapacket_shift_pointer(uint8_t *packet, uint8_t portnum);
#endif /* APAPORT_H_ */
\ No newline at end of file
......@@ -15,22 +15,22 @@
#include "apaport.h"
// status lights
pin_t np0stlr;
pin_t np0stlg;
pin_t np0stlb;
pin_t up0_stlr;
pin_t up0_stlg;
pin_t up0_stlb;
pin_t np1stlr;
pin_t np1stlb;
pin_t up1_stlr;
pin_t up1_stlb;
pin_t np2stlr;
pin_t np2stlb;
pin_t up2_stlr;
pin_t up2_stlb;
pin_t np3stlr;
pin_t np3stlb;
pin_t up3_stlr;
pin_t up3_stlb;
pin_t np4stlr;
pin_t np4stlg;
pin_t np4stlb;
pin_t up4_stlr;
pin_t up4_stlg;
pin_t up4_stlb;
// array of ptrs to lights
// init in main.c
......@@ -38,16 +38,16 @@ pin_t np4stlb;
pin_t *lights[NUM_LIGHTS];
// ringbuffers
ringbuffer_t up0rbrx;
ringbuffer_t up0rbtx;
ringbuffer_t up1rbrx;
ringbuffer_t up1rbtx;
ringbuffer_t up2rbrx;
ringbuffer_t up2rbtx;
ringbuffer_t up3rbrx;
ringbuffer_t up3rbtx;
ringbuffer_t up4rbrx;
ringbuffer_t up4rbtx;
ringbuffer_t up0_rbrx;
ringbuffer_t up0_rbtx;
ringbuffer_t up1_rbrx;
ringbuffer_t up1_rbtx;
ringbuffer_t up2_rbrx;
ringbuffer_t up2_rbtx;
ringbuffer_t up3_rbrx;
ringbuffer_t up3_rbtx;
ringbuffer_t up4_rbrx;
ringbuffer_t up4_rbtx;
// uartports
uartport_t up0;
......@@ -63,6 +63,10 @@ uartport_t *ups[NUM_UPS];
// apaports
apaport_t apap0;
apaport_t apap1;
apaport_t apap2;
apaport_t apap3;
apaport_t apap4;
#endif /* HARDWARE_H_ */
\ No newline at end of file
......@@ -50,34 +50,34 @@ void setupinterrupts(void){
}
void lightsetup(void){
pin_init(&np0stlr, PIOD, PIO_PER_P12);
pin_output(&np0stlr);
pin_init(&np0stlg, PIOA, PIO_PER_P3);
pin_output(&np0stlg);
pin_init(&np0stlb, PIOA, PIO_PER_P2);
pin_output(&np0stlb);
pin_init(&np1stlr, PIOA, PIO_PER_P11);
pin_output(&np1stlr);
pin_init(&np1stlb, PIOD, PIO_PER_P20);
pin_output(&np1stlb);
pin_init(&np2stlr, PIOA, PIO_PER_P15);
pin_output(&np2stlr);
pin_init(&np2stlb, PIOD, PIO_PER_P27);
pin_output(&np2stlb);
pin_init(&np3stlr, PIOA, PIO_PER_P22);
pin_output(&np3stlr);
pin_init(&np3stlb, PIOA, PIO_PER_P8);
pin_output(&np3stlb);
pin_init(&np4stlr, PIOB, PIO_PER_P0);
pin_output(&np4stlr);
pin_init(&np4stlg, PIOA, PIO_PER_P20);
pin_output(&np4stlg);
pin_init(&np4stlb, PIOB, PIO_PER_P1);
pin_output(&np4stlb);
pin_init(&up0_stlr, PIOD, PIO_PER_P12);
pin_output(&up0_stlr);
pin_init(&up0_stlg, PIOA, PIO_PER_P3);
pin_output(&up0_stlg);
pin_init(&up0_stlb, PIOA, PIO_PER_P2);
pin_output(&up0_stlb);
pin_init(&up1_stlr, PIOA, PIO_PER_P11);
pin_output(&up1_stlr);
pin_init(&up1_stlb, PIOD, PIO_PER_P20);
pin_output(&up1_stlb);
pin_init(&up2_stlr, PIOA, PIO_PER_P15);
pin_output(&up2_stlr);
pin_init(&up2_stlb, PIOD, PIO_PER_P27);
pin_output(&up2_stlb);
pin_init(&up3_stlr, PIOA, PIO_PER_P22);
pin_output(&up3_stlr);
pin_init(&up3_stlb, PIOA, PIO_PER_P8);
pin_output(&up3_stlb);
pin_init(&up4_stlr, PIOB, PIO_PER_P0);
pin_output(&up4_stlr);
pin_init(&up4_stlg, PIOA, PIO_PER_P20);
pin_output(&up4_stlg);
pin_init(&up4_stlb, PIOB, PIO_PER_P1);
pin_output(&up4_stlb);
}
void lightstoggle(void){
......@@ -88,53 +88,53 @@ void lightstoggle(void){
void initports(void){
// RBs 1
rb_init(&up0rbrx);
rb_init(&up0rbtx);
rb_init(&up0_rbrx);
rb_init(&up0_rbtx);
// UP1 on UART0, RX 9 TX 10 on PIOA
uart_build(&up0, UART0, PIOA, 9, 10, &up0rbrx, &up0rbtx, &np0stlr, &np0stlb);
uart_build(&up0, UART0, PIOA, 9, 10, &up0_rbrx, &up0_rbtx, &up0_stlr, &up0_stlb);
uart_init(&up0, 81, UART_IS_PERIPHERAL_A);
// RBs 2
rb_init(&up1rbrx);
rb_init(&up1rbtx);
rb_init(&up1_rbrx);
rb_init(&up1_rbtx);
// UP2 on UART1, RX 5 TX 4 on PIOA
uart_build(&up1, UART1, PIOA, 5, 4, &up1rbrx, &up1rbtx, &np1stlr, &np1stlb);
uart_build(&up1, UART1, PIOA, 5, 4, &up1_rbrx, &up1_rbtx, &up1_stlr, &up1_stlb);
uart_init(&up1, 81, UART_IS_PERIPHERAL_C); // 81 for FTDI 115200 :|
// RBs 3
rb_init(&up2rbrx);
rb_init(&up2rbtx);
rb_init(&up2_rbrx);
rb_init(&up2_rbtx);
// UP3 on UART2, RX 25 TX 26 on PIOD
uart_build(&up2, UART2, PIOD, 25, 26, &up2rbrx, &up2rbtx, &np2stlr, &np2stlb);
uart_build(&up2, UART2, PIOD, 25, 26, &up2_rbrx, &up2_rbtx, &up2_stlr, &up2_stlb);
uart_init(&up2, 81, UART_IS_PERIPHERAL_C);
// RBs 4
rb_init(&up3rbrx);
rb_init(&up3rbtx);
rb_init(&up3_rbrx);
rb_init(&up3_rbtx);
// UP4 on UART3, RX 28 TX 30 on PIOD
uart_build(&up3, UART3, PIOD, 28, 30, &up3rbrx, &up3rbtx, &np3stlr, &np3stlb);
uart_build(&up3, UART3, PIOD, 28, 30, &up3_rbrx, &up3_rbtx, &up3_stlr, &up3_stlb);
uart_init(&up3, 81, UART_IS_PERIPHERAL_A);
// RBs 5
rb_init(&up4rbrx);
rb_init(&up4rbtx);
rb_init(&up4_rbrx);
rb_init(&up4_rbtx);
// UP5 on UART4, RX 18 TX 19 on PIOD
uart_build(&up4, UART4, PIOD, 18, 19, &up4rbrx, &up4rbtx, &np4stlr, &np4stlb);
uart_build(&up4, UART4, PIOD, 18, 19, &up4_rbrx, &up4_rbtx, &up4_stlr, &up4_stlb);
uart_init(&up4, 81, UART_IS_PERIPHERAL_C);
}
void listsetup(void){
// array of ptrs to lights
lights[0] = &np0stlr;
lights[1] = &np0stlb;
lights[2] = &np1stlr;
lights[3] = &np1stlb;
lights[4] = &np2stlr;
lights[5] = &np2stlb;
lights[6] = &np3stlr;
lights[7] = &np3stlb;
lights[8] = &np4stlr;
lights[9] = &np4stlb;
lights[0] = &up0_stlr;
lights[1] = &up0_stlb;
lights[2] = &up1_stlr;
lights[3] = &up1_stlb;
lights[4] = &up2_stlr;
lights[5] = &up2_stlb;
lights[6] = &up3_stlr;
lights[7] = &up3_stlb;
lights[8] = &up4_stlr;
lights[9] = &up4_stlb;
// array of ptrs to uarts
ups[0] = &up0;
......@@ -153,14 +153,27 @@ int main (void){
initports();
listsetup();
apaport_build(&apap0, 0, &up0, ups, 5, &np0stlr, &np0stlg, &np0stlb);
apaport_build(&apap0, 0, &up0, &up0_stlr, &up0_stlb);
apaport_reset(&apap0);
apaport_build(&apap1, 1, &up1, &up1_stlr, &up1_stlb);
apaport_reset(&apap1);
apaport_build(&apap2, 2, &up2, &up2_stlr, &up2_stlb);
apaport_reset(&apap2);
apaport_build(&apap3, 3, &up3, &up3_stlr, &up3_stlb);
apaport_reset(&apap3);
apaport_build(&apap4, 4, &up4, &up4_stlr, &up4_stlb);
apaport_reset(&apap4);
pin_set(&up0_stlg);
pin_set(&up4_stlg);
while(1){
apaport_scan(&apap0, 2);
pin_toggle(&np4stlg);
delay_ms(75);
apaport_scan(&apap1, 2);
apaport_scan(&apap2, 2);
apaport_scan(&apap3, 2);
apaport_scan(&apap4, 2);
delay_cycles(1);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment