58 changed files with 3872 additions and 2896 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,79 +1,133 @@ |
|||
#include "check_pin.h" |
|||
#include "r_cg_port.h" |
|||
#include <stdint.h> |
|||
|
|||
#define BIT(n) (1u << (n)) |
|||
|
|||
static void write_port(volatile uint8_t *port, uint8_t mask, uint8_t on) |
|||
void Gate_SetByNum(uint8_t num, uint8_t hash_on, uint8_t anaout_on, uint8_t check_on) |
|||
{ |
|||
if (on) *port |= mask; |
|||
else *port &= (uint8_t)~mask; |
|||
} |
|||
switch (num) |
|||
{ |
|||
case 1: /* HASH P153(P15.3), ANAOUT P64(P6.4), CHECK P154(P15.4) */ |
|||
P15 = hash_on ? _08_Pn3_OUTPUT_1 : _00_Pn3_OUTPUT_0; /* P153 */ |
|||
P6 = anaout_on ? _10_Pn4_OUTPUT_1 : _00_Pn4_OUTPUT_0; /* P64 */ |
|||
P15 = check_on ? _10_Pn4_OUTPUT_1 : _00_Pn4_OUTPUT_0; /* P154 */ |
|||
break; |
|||
|
|||
static void set_output_pm(volatile uint8_t *pm, uint8_t mask) |
|||
{ |
|||
*pm &= (uint8_t)~mask; |
|||
} |
|||
case 2: /* P152(P15.2), P65(P6.5), P155(P15.5) */ |
|||
P15 = hash_on ? _04_Pn2_OUTPUT_1 : _00_Pn2_OUTPUT_0; /* P152 */ |
|||
P6 = anaout_on ? _20_Pn5_OUTPUT_1 : _00_Pn5_OUTPUT_0; /* P65 */ |
|||
P15 = check_on ? _20_Pn5_OUTPUT_1 : _00_Pn5_OUTPUT_0; /* P155 */ |
|||
break; |
|||
|
|||
void check_pin_init(void) |
|||
{ |
|||
// CHECK_1,2,4 : P15.4,5,6
|
|||
set_output_pm(&PM15, (uint8_t)(BIT(4)|BIT(5)|BIT(6))); |
|||
case 3: /* P151(P15.1), P66(P6.6), P00(P0.0) */ |
|||
P15 = hash_on ? _02_Pn1_OUTPUT_1 : _00_Pn1_OUTPUT_0; /* P151 */ |
|||
P6 = anaout_on ? _40_Pn6_OUTPUT_1 : _00_Pn6_OUTPUT_0; /* P66 */ |
|||
P0 = check_on ? _01_Pn0_OUTPUT_1 : _00_Pn0_OUTPUT_0; /* P00 */ |
|||
break; |
|||
|
|||
// CHECK_3,7 : P0.0,3
|
|||
set_output_pm(&PM0, (uint8_t)(BIT(0)|BIT(3))); |
|||
case 4: /* P150(P15.0), P67(P6.7), P156(P15.6) */ |
|||
P15 = hash_on ? _01_Pn0_OUTPUT_1 : _00_Pn0_OUTPUT_0; /* P150 */ |
|||
P6 = anaout_on ? _80_Pn7_OUTPUT_1 : _00_Pn7_OUTPUT_0; /* P67 */ |
|||
P15 = check_on ? _40_Pn6_OUTPUT_1 : _00_Pn6_OUTPUT_0; /* P156 */ |
|||
break; |
|||
|
|||
// CHECK_5,6 : P3.0,2
|
|||
set_output_pm(&PM3, (uint8_t)(BIT(0)|BIT(2))); |
|||
case 5: /* P120(P12.0), P44(P4.4), P30(P3.0) */ |
|||
P12 = hash_on ? _01_Pn0_OUTPUT_1 : _00_Pn0_OUTPUT_0; /* P120 */ |
|||
P4 = anaout_on ? _10_Pn4_OUTPUT_1 : _00_Pn4_OUTPUT_0; /* P44 */ |
|||
P3 = check_on ? _01_Pn0_OUTPUT_1 : _00_Pn0_OUTPUT_0; /* P30 */ |
|||
break; |
|||
|
|||
// CHECK_8,9 : P7.0,1
|
|||
set_output_pm(&PM7, (uint8_t)(BIT(0)|BIT(1))); |
|||
case 6: /* P125(P12.5), P43(P4.3), P32(P3.2) */ |
|||
P12 = hash_on ? _20_Pn5_OUTPUT_1 : _00_Pn5_OUTPUT_0; /* P125 */ |
|||
P4 = anaout_on ? _08_Pn3_OUTPUT_1 : _00_Pn3_OUTPUT_0; /* P43 */ |
|||
P3 = check_on ? _04_Pn2_OUTPUT_1 : _00_Pn2_OUTPUT_0; /* P32 */ |
|||
break; |
|||
|
|||
// CHECK_10~13 : P10.4~7
|
|||
set_output_pm(&PM10, (uint8_t)(BIT(4)|BIT(5)|BIT(6)|BIT(7))); |
|||
case 7: /* P01(P0.1), P42(P4.2), P03(P0.3) */ |
|||
P0 = hash_on ? _02_Pn1_OUTPUT_1 : _00_Pn1_OUTPUT_0; /* P01 */ |
|||
P4 = anaout_on ? _04_Pn2_OUTPUT_1 : _00_Pn2_OUTPUT_0; /* P42 */ |
|||
P0 = check_on ? _08_Pn3_OUTPUT_1 : _00_Pn3_OUTPUT_0; /* P03 */ |
|||
break; |
|||
|
|||
// CHECK_14~17 : P5.7,6,5,4
|
|||
set_output_pm(&PM5, (uint8_t)(BIT(7)|BIT(6)|BIT(5)|BIT(4))); |
|||
case 8: /* P126(P12.6), P41(P4.1), P70(P7.0) */ |
|||
P12 = hash_on ? _40_Pn6_OUTPUT_1 : _00_Pn6_OUTPUT_0; /* P126 */ |
|||
P4 = anaout_on ? _02_Pn1_OUTPUT_1 : _00_Pn1_OUTPUT_0; /* P41 */ |
|||
P7 = check_on ? _01_Pn0_OUTPUT_1 : _00_Pn0_OUTPUT_0; /* P70 */ |
|||
break; |
|||
|
|||
// CHECK_18~20 : P1.0,3,4
|
|||
set_output_pm(&PM1, (uint8_t)(BIT(0)|BIT(3)|BIT(4))); |
|||
case 9: /* P127(P12.7), P50(P5.0), P71(P7.1) */ |
|||
P12 = hash_on ? _80_Pn7_OUTPUT_1 : _00_Pn7_OUTPUT_0; /* P127 */ |
|||
P5 = anaout_on ? _01_Pn0_OUTPUT_1 : _00_Pn0_OUTPUT_0; /* P50 */ |
|||
P7 = check_on ? _02_Pn1_OUTPUT_1 : _00_Pn1_OUTPUT_0; /* P71 */ |
|||
break; |
|||
|
|||
check_all_off(); |
|||
} |
|||
case 10: /* P02(P0.2), P51(P5.1), P104(P10.4) */ |
|||
P0 = hash_on ? _04_Pn2_OUTPUT_1 : _00_Pn2_OUTPUT_0; /* P02 */ |
|||
P5 = anaout_on ? _02_Pn1_OUTPUT_1 : _00_Pn1_OUTPUT_0; /* P51 */ |
|||
P10 = check_on ? _10_Pn4_OUTPUT_1 : _00_Pn4_OUTPUT_0; /* P104 */ |
|||
break; |
|||
|
|||
void check_all_off(void) |
|||
{ |
|||
P15 &= (uint8_t)~(BIT(4)|BIT(5)|BIT(6)); |
|||
P0 &= (uint8_t)~(BIT(0)|BIT(3)); |
|||
P3 &= (uint8_t)~(BIT(0)|BIT(2)); |
|||
P7 &= (uint8_t)~(BIT(0)|BIT(1)); |
|||
P10 &= (uint8_t)~(BIT(4)|BIT(5)|BIT(6)|BIT(7)); |
|||
P5 &= (uint8_t)~(BIT(4)|BIT(5)|BIT(6)|BIT(7)); |
|||
P1 &= (uint8_t)~(BIT(0)|BIT(3)|BIT(4)); |
|||
} |
|||
case 11: /* P103(P10.3), P52(P5.2), P105(P10.5) */ |
|||
P10 = hash_on ? _08_Pn3_OUTPUT_1 : _00_Pn3_OUTPUT_0; /* P103 */ |
|||
P5 = anaout_on ? _04_Pn2_OUTPUT_1 : _00_Pn2_OUTPUT_0; /* P52 */ |
|||
P10 = check_on ? _20_Pn5_OUTPUT_1 : _00_Pn5_OUTPUT_0; /* P105 */ |
|||
break; |
|||
|
|||
void check_pin(uint8_t ch, uint8_t on) |
|||
{ |
|||
switch (ch) |
|||
{ |
|||
case 1: write_port(&P15, BIT(4), on); break; // CHECK_1 : P154
|
|||
case 2: write_port(&P15, BIT(5), on); break; // CHECK_2 : P155
|
|||
case 3: write_port(&P0, BIT(0), on); break; // CHECK_3 : P00
|
|||
case 4: write_port(&P15, BIT(6), on); break; // CHECK_4 : P156
|
|||
case 5: write_port(&P3, BIT(0), on); break; // CHECK_5 : P30
|
|||
case 6: write_port(&P3, BIT(2), on); break; // CHECK_6 : P32
|
|||
case 7: write_port(&P0, BIT(3), on); break; // CHECK_7 : P03
|
|||
case 8: write_port(&P7, BIT(0), on); break; // CHECK_8 : P70
|
|||
case 9: write_port(&P7, BIT(1), on); break; // CHECK_9 : P71
|
|||
case 10: write_port(&P10, BIT(4), on); break; // CHECK_10: P104
|
|||
case 11: write_port(&P10, BIT(5), on); break; // CHECK_11: P105
|
|||
case 12: write_port(&P10, BIT(6), on); break; // CHECK_12: P106
|
|||
case 13: write_port(&P10, BIT(7), on); break; // CHECK_13: P107
|
|||
case 14: write_port(&P5, BIT(7), on); break; // CHECK_14: P57
|
|||
case 15: write_port(&P5, BIT(6), on); break; // CHECK_15: P56
|
|||
case 16: write_port(&P5, BIT(5), on); break; // CHECK_16: P55
|
|||
case 17: write_port(&P5, BIT(4), on); break; // CHECK_17: P54
|
|||
case 18: write_port(&P1, BIT(0), on); break; // CHECK_18: P10
|
|||
case 19: write_port(&P1, BIT(3), on); break; // CHECK_19: P13
|
|||
case 20: write_port(&P1, BIT(4), on); break; // CHECK_20: P14
|
|||
default: /* ignore */ break; |
|||
case 12: /* P102(P10.2), P60(P6.0), P106(P10.6) */ |
|||
P10 = hash_on ? _04_Pn2_OUTPUT_1 : _00_Pn2_OUTPUT_0; /* P102 */ |
|||
P6 = anaout_on ? _01_Pn0_OUTPUT_1 : _00_Pn0_OUTPUT_0; /* P60 */ |
|||
P10 = check_on ? _40_Pn6_OUTPUT_1 : _00_Pn6_OUTPUT_0; /* P106 */ |
|||
break; |
|||
|
|||
case 13: /* P101(P10.1), P61(P6.1), P107(P10.7) */ |
|||
P10 = hash_on ? _02_Pn1_OUTPUT_1 : _00_Pn1_OUTPUT_0; /* P101 */ |
|||
P6 = anaout_on ? _02_Pn1_OUTPUT_1 : _00_Pn1_OUTPUT_0; /* P61 */ |
|||
P10 = check_on ? _80_Pn7_OUTPUT_1 : _00_Pn7_OUTPUT_0; /* P107 */ |
|||
break; |
|||
|
|||
case 14: /* P100(P10.0), P72(P7.2), P57(P5.7) */ |
|||
P10 = hash_on ? _01_Pn0_OUTPUT_1 : _00_Pn0_OUTPUT_0; /* P100 */ |
|||
P7 = anaout_on ? _04_Pn2_OUTPUT_1 : _00_Pn2_OUTPUT_0; /* P72 */ |
|||
P5 = check_on ? _80_Pn7_OUTPUT_1 : _00_Pn7_OUTPUT_0; /* P57 */ |
|||
break; |
|||
|
|||
case 15: /* P97(P9.7), P73(P7.3), P56(P5.6) */ |
|||
P9 = hash_on ? _80_Pn7_OUTPUT_1 : _00_Pn7_OUTPUT_0; /* P97 */ |
|||
P7 = anaout_on ? _08_Pn3_OUTPUT_1 : _00_Pn3_OUTPUT_0; /* P73 */ |
|||
P5 = check_on ? _40_Pn6_OUTPUT_1 : _00_Pn6_OUTPUT_0; /* P56 */ |
|||
break; |
|||
|
|||
case 16: /* P96(P9.6), P75(P7.5), P55(P5.5) */ |
|||
P9 = hash_on ? _40_Pn6_OUTPUT_1 : _00_Pn6_OUTPUT_0; /* P96 */ |
|||
P7 = anaout_on ? _20_Pn5_OUTPUT_1 : _00_Pn5_OUTPUT_0; /* P75 */ |
|||
P5 = check_on ? _20_Pn5_OUTPUT_1 : _00_Pn5_OUTPUT_0; /* P55 */ |
|||
break; |
|||
|
|||
case 17: /* P95(P9.5), P74(P7.4), P54(P5.4) */ |
|||
P9 = hash_on ? _20_Pn5_OUTPUT_1 : _00_Pn5_OUTPUT_0; /* P95 */ |
|||
P7 = anaout_on ? _10_Pn4_OUTPUT_1 : _00_Pn4_OUTPUT_0; /* P74 */ |
|||
P5 = check_on ? _10_Pn4_OUTPUT_1 : _00_Pn4_OUTPUT_0; /* P54 */ |
|||
break; |
|||
|
|||
case 18: /* P94(P9.4), P76(P7.6), P10(P1.0) */ |
|||
P9 = hash_on ? _10_Pn4_OUTPUT_1 : _00_Pn4_OUTPUT_0; /* P94 */ |
|||
P7 = anaout_on ? _40_Pn6_OUTPUT_1 : _00_Pn6_OUTPUT_0; /* P76 */ |
|||
P1 = check_on ? _01_Pn0_OUTPUT_1 : _00_Pn0_OUTPUT_0; /* P10 */ |
|||
break; |
|||
|
|||
case 19: /* P93(P9.3), P77(P7.7), P13(P1.3) */ |
|||
P9 = hash_on ? _08_Pn3_OUTPUT_1 : _00_Pn3_OUTPUT_0; /* P93 */ |
|||
P7 = anaout_on ? _80_Pn7_OUTPUT_1 : _00_Pn7_OUTPUT_0; /* P77 */ |
|||
P1 = check_on ? _08_Pn3_OUTPUT_1 : _00_Pn3_OUTPUT_0; /* P13 */ |
|||
break; |
|||
|
|||
case 20: /* P92(P9.2), P130(P13.0), P14(P1.4) */ |
|||
P9 = hash_on ? _04_Pn2_OUTPUT_1 : _00_Pn2_OUTPUT_0; /* P92 */ |
|||
P13 = anaout_on ? _01_Pn0_OUTPUT_1 : _00_Pn0_OUTPUT_0; /* P130 */ |
|||
P1 = check_on ? _10_Pn4_OUTPUT_1 : _00_Pn4_OUTPUT_0; /* P14 */ |
|||
break; |
|||
|
|||
default: |
|||
break; |
|||
} |
|||
} |
|||
|
|||
|
|||
@ -1,40 +1,5 @@ |
|||
#ifndef GATECTRL_H |
|||
#define GATECTRL_H |
|||
|
|||
#include "r_cg_macrodriver.h" |
|||
#include "r_cg_port.h" |
|||
#include "anaout.h" |
|||
#include "hash_pin.h" |
|||
#include "check_pin.h" |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
void GateCtrl_Init(void); |
|||
|
|||
/** ???: ALL (P47) */ |
|||
void GateCtrl_SetAll(uint8_t on); |
|||
|
|||
/** ???: ZACWIRE (P157) */ |
|||
void GateCtrl_SetZacwire(uint8_t on); |
|||
|
|||
void GateCtrl_SelectChannel(uint8_t ch); |
|||
|
|||
/** ?? ??? ??? ANAOUT ?? (?? ?? ???) */ |
|||
void GateCtrl_Anaout(uint8_t on); |
|||
|
|||
/** ?? ??? ??? #? ?? */ |
|||
void GateCtrl_Hash(uint8_t on); |
|||
|
|||
/** ?? ??? ??? CHECK? ?? */ |
|||
void GateCtrl_Check(uint8_t on); |
|||
|
|||
/** (??) #/CHECK ?? OFF */ |
|||
void GateCtrl_ClearChannelPins(void); |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* GATECTRL_H */ |
|||
void Gate_SetByNum(uint8_t num, uint8_t hash_on, uint8_t anaout_on, uint8_t check_on); |
|||
void Col_Init(void); |
|||
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue